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

allowed-unused-imports has incorrect documentation #13668

Closed
tylerlaprade opened this issue Oct 7, 2024 · 12 comments · Fixed by #13677
Closed

allowed-unused-imports has incorrect documentation #13668

tylerlaprade opened this issue Oct 7, 2024 · 12 comments · Fixed by #13677
Labels
question Asking for support or clarification
Milestone

Comments

@tylerlaprade
Copy link
Contributor

  • In the docs, it's part of the lint section rather than lint.pyflakes
  • In those same docs, "thought" is used in place of "though"
  • The TOML schema doesn't recognize the setting at any of the three possible levels.
image
@zanieb
Copy link
Member

zanieb commented Oct 7, 2024

We should allow defining this either at lint or lint.pyflakes from my read of the code.
I presume the schema store has just not been updated since the last release.

Typo fix at #13669

@zanieb zanieb added the question Asking for support or clarification label Oct 7, 2024
@zanieb
Copy link
Member

zanieb commented Oct 7, 2024

@tylerlaprade
Copy link
Contributor Author

Thanks! Is there precedent for allowing other settings at two different levels? It seems a bit confusing.

@zanieb
Copy link
Member

zanieb commented Oct 8, 2024

I'm not sure honestly. It does seem confusing if it's not necessary for some reason. cc @charliermarsh who reviewed that contribution.

@charliermarsh
Copy link
Member

It should only be under lint.pyflakes.

@tylerlaprade
Copy link
Contributor Author

Image `lint` is still not recognized for me

@MichaReiser
Copy link
Member

@tylerlaprade I'm unable to reproduce this. I created a .ruff.toml file and opened it in VS Code with even better toml installed. It provides me intelli sense and auto suggestions. Any chance you manually selected an old schema in Better toml for ruff.toml files?

@tylerlaprade
Copy link
Contributor Author

@MichaReiser, hmm, these are the three options it gives me. I don't know how to distinguish between them. All three seem to have the same problem, though.

Image

@MichaReiser
Copy link
Member

What's the exact error message from the schema? Can you try commenting out all settings and then, one by one (or doing a binary search where you comment in 50%) comment in the sections? Do you see the same in a pyproject.toml?

@tylerlaprade
Copy link
Contributor Author

Oh! Good idea - it was hard to tell which line was problematic since all occurrences of lint were squiggled, but the problem seems to come solely from extend-safe-fixes = ["ANN", "C4", "EM", "RET", "SIM", "TCH", "UP"]. Was that setting deprecated?

@tylerlaprade
Copy link
Contributor Author

Ah ha! If I move it outside of [lint] (for some reason it's valid in both places???), the error actually becomes helpful.
Image

@MichaReiser
Copy link
Member

The setting wasn't deprecated but TCH was renamed to TC (blog) and this seems to be causing the issue.

I see you just solved it. Nice. Yeah, our error reporting for the lint section is unfortunate because we use some functionality to avoid repeating all options globally and under lint and it doesn't seem to be that well supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants