Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strings on multiple lines with different quotes #82

Open
samuelcolvin opened this issue Jun 21, 2019 · 5 comments
Open

strings on multiple lines with different quotes #82

samuelcolvin opened this issue Jun 21, 2019 · 5 comments

Comments

@samuelcolvin
Copy link

samuelcolvin commented Jun 21, 2019

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
Copy link
Author

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

@twolfson
Copy link
Collaborator

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

@MaZZly
Copy link

MaZZly commented Sep 13, 2019

I would also be interested in this feature/option

@iMakedonsky
Copy link

Also interested in this feature

@plinss
Copy link

plinss commented Jun 4, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants