MichaelKim0407 / flake8-use-fstring

MIT License
51 stars 7 forks source link

FS003 behavior no longer defaulted to ignore in release 1.1 #5

Closed alfinkel closed 4 years ago

alfinkel commented 4 years ago

The latest release seems to have changed the default behavior for FS003. It looks like now this is not ignored by default?

MichaelKim0407 commented 4 years ago

FS003 was added to the new release. I believe it is off by default. See #1 #2

Please share more information on how you are running flake8

alfinkel commented 4 years ago

I guess to be fair I wasn't aware that FS003 is new with release 1.1. Apologies for that. I just happened to notice new FS003 warnings and then read your readme which says that FS003 is ignored by default.

We're running it through pre-commit but I'm not sure that matters? I don't think that it does. What's happening for us is that we're now getting a bunch of FS003 f-string missing prefix warnings for strings that contain {...}. Things like:

test_content = '{"Squirtle": true, "Pikachu": 1, "Bulbasaur": 2}'

and

link_format = '<{url}|{name}>'

...are causing the warnings.

I've added FS003 to the flake8 --ignore list and that suppressed the warnings but after reading the readme I expected that it would be off by default.

MichaelKim0407 commented 4 years ago

It is ignored by default. You need to have --enable-extension FS003 or some variant to enable it. I just tried myself and there is also a unittest for it.

Please provide a minimal reproduceable example otherwise I can't help you here.

alfinkel commented 4 years ago

I guess that this is not true:

We're running it through pre-commit but I'm not sure that matters? I don't think that it does.

Looks like running things directly from flake8 works as you've described but running it through pre-commit does not. As I said, I need to explicitly ignore FS003 which isn't a big deal. It's too bad that it seems like flake8, this plugin, and pre-commit don't seem to be playing nice together. Thanks. Closing...

MichaelKim0407 commented 4 years ago

@alfinkel see https://github.com/MichaelKim0407/flake8-use-fstring/issues/6#issuecomment-642154911