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

New rule prohibiting modification of sys.path #15806

Open
vraintanakarei opened this issue Jan 29, 2025 · 1 comment
Open

New rule prohibiting modification of sys.path #15806

vraintanakarei opened this issue Jan 29, 2025 · 1 comment
Labels
needs-decision Awaiting a decision from a maintainer rule Implementing or modifying a lint rule

Comments

@vraintanakarei
Copy link

Description

I think modification of sys.path is a bad practice because it breaks type checking, code completion, code highlighting, etc.
Therefore, I would like to ban it in my team, but I could not find a rule to check it.

If such a rule does not already exist, please consider adding a rule prohibiting changes to sys.path.
For my purpose, these codes should be prohibited with a few exceptions.

  • sys.path.append(...)
  • sys.path.extend(...)
  • sys.path = ...
  • etc.

Thank you very much.

@MichaReiser MichaReiser added rule Implementing or modifying a lint rule needs-decision Awaiting a decision from a maintainer labels Feb 2, 2025
@MichaReiser
Copy link
Member

This seems reasonable, although I'd prefer to wait to add it until #1774 is complete because we should then have a good place for "restriction" rules -- rules that disallow a valid code pattern mainly because "We don't like it for reasons"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Awaiting a decision from a maintainer rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

2 participants