flake8-quotes icon indicating copy to clipboard operation
flake8-quotes copied to clipboard

strings on multiple lines with different quotes

Open samuelcolvin opened this issue 5 years ago • 5 comments

I'm really keen to use this on pydantic, however there's one ~~blocking~~ issue

Take the following example:

        raise ConfigError(
            "validators should be used with fields and keyword arguments, not bare. "
            "E.g. usage should be `@validator('<field_name>', ...)`"
        )

I would say both lines should use double quotes so they're the same even though only one line includes single quotes.

I'm aware this would make analysis more complicated, but is it something you would consider? Either as default or via an option.

samuelcolvin avatar Jun 21 '19 10:06 samuelcolvin

not a big worry if this isn't possible since I can use # noqa: Q000 in the few places where this happens.

samuelcolvin avatar Jun 21 '19 10:06 samuelcolvin

I think we're open to supporting this but I concur it will add a layer of complexity to everything. One other option aside from noqa is to use escaping of the quotes to keep everything consistent:

'validators should be used with fields and keyword arguments, not bare. '
'E.g. usage should be `@validator(\'<field_name>\', ...)`'

That being said, I'll leave this issue open as "help wanted" if anyone wants to explore it. Maybe we could call the option adjacent_line_quotes = False (default)/True

twolfson avatar Jun 21 '19 20:06 twolfson

I would also be interested in this feature/option

MaZZly avatar Sep 13 '19 07:09 MaZZly

Also interested in this feature

iMakedonsky avatar Jan 15 '20 19:01 iMakedonsky

I'd like it too, but it needs to allow the quotes to differ if doing so avoids escapes. e.g.

        raise ConfigError(
            'validators should be used with "fields" and "keyword" arguments, not bare. '
            "E.g. usage should be `@validator('<field_name>', ...)`"
        )

should not be an error.

plinss avatar Jun 04 '20 04:06 plinss