How to make Flake8 ignore syntax within strings?
Asked Answered
L

1

8

I'm suddenly getting flake8 errors for syntax within strings.

For example, for the following line of code:

    tags.append(f'error_type:{error.get("name")}')

I'm getting this error: E231 missing whitespace after ':'.

I don't want to ignore all E231 errors, because I care about them when they don't refer to text within strings.

I also don't want to have to go and add # noqa comments to each of my strings.

I've tried to pin my flake8 version to 6.0.0 (which is the version that previously didn't raise these errors before).

I'm running flake8 with pre-commit (if that is relevant).

Why am I suddenly getting these errors for strings and how can I turn them off?

I should also mention that this is happening in Github Actions, specifically.

Laktasic answered 1/11, 2023 at 8:13 Comment(2)
This definitely sounds like a bug in flake8.Legendary
this is definitely a bug that I fixed months ago :)Gamp
L
20

This issue seems limited to Python 3.12+ and it was fixed by flake8 version 6.1.0.

The errors stopped appearing when I upgrade to flake8 6.1.0.

Laktasic answered 1/11, 2023 at 11:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.