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

tool.flake8.known-modules namespace issues #58

Closed
jonyscathe opened this issue Sep 15, 2022 · 2 comments · Fixed by #59
Closed

tool.flake8.known-modules namespace issues #58

jonyscathe opened this issue Sep 15, 2022 · 2 comments · Fixed by #59

Comments

@jonyscathe
Copy link

jonyscathe commented Sep 15, 2022

Hi,

Just moved over to usingflake8-pyproject and [tool.flake8.known-modules] looks like a great addition for that.

Did take me a while to get it working though, due to the use of a namespace in the project.

My previous known-modules from setup.cfg was of the form:

known-modules = my_namespace.my_project:[my_namespace.my_project, packaging, dunamai]

I attempted to change to this but was getting a whole lot of I900s flagged:

[tool.flake8.known-modules]
my_namespace.my_project = [
    'my_namespace.my_project',
    'packaging',
    'dunamai',
]

Eventually I worked out that I could change to:

[tool.flake8.known-modules]
'my_namespace.my_project' = [
    'my_namespace.my_project',
    'packaging',
    'dunamai',
]

It looks a little gross with the key in quotes but it at least works. I'm not sure there is any way around this? If not, might be worth adding a short note to the documentation as otherwise this could confuse a few people.

@arkq
Copy link
Owner

arkq commented Sep 15, 2022

It looks a little gross with the key in quotes but it at least works. I'm not sure there is any way around this?

Maybe @nyuszika7h can say more about this, I'm not using pyproject as for now.

@ghost
Copy link

ghost commented Sep 15, 2022

Yeah I think you have to add the quotes, otherwise TOML treats it as a nested key. Unless we add some hack in flake8-requirements itself to map nested keys back to a flat key but I don’t think it’s worth adding such a hack.

@arkq arkq closed this as completed in #59 Sep 15, 2022
arkq pushed a commit that referenced this issue Sep 15, 2022
arkq pushed a commit that referenced this issue Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants