Skip to content

allowed-unused-imports has incorrect documentation #13668

Description

@tylerlaprade
  • 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

Activity

  1. zanieb commented on Oct 7, 2024

    @zanieb
    Member

    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

  2. added
    questionAn issue asking for support or clarification
    on Oct 7, 2024
  3. zanieb commented on Oct 7, 2024

    @zanieb
    Member
  4. tylerlaprade commented on Oct 8, 2024

    @tylerlaprade
    ContributorAuthor

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

  5. zanieb commented on Oct 8, 2024

    @zanieb
    Member

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

  6. charliermarsh commented on Oct 8, 2024

    @charliermarsh
    Member

    It should only be under lint.pyflakes.

  7. added this to the v0.7 milestone on Oct 17, 2024
  8. tylerlaprade commented on Jan 2, 2025

    @tylerlaprade
    ContributorAuthor
    Image `lint` is still not recognized for me
  9. MichaReiser commented on Jan 2, 2025

    @MichaReiser
    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?

  10. tylerlaprade commented on Jan 3, 2025

    @tylerlaprade
    ContributorAuthor

    @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
  11. MichaReiser commented on Jan 3, 2025

    @MichaReiser
    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?

  12. tylerlaprade commented on Jan 3, 2025

    @tylerlaprade
    ContributorAuthor

    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?

  13. tylerlaprade commented on Jan 3, 2025

    @tylerlaprade
    ContributorAuthor

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

  14. MichaReiser commented on Jan 3, 2025

    @MichaReiser
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAn issue asking for support or clarification

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions