You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to ban usage of certain builtins using the "banned-api" (TID251) rule.
Something like this:
[tool.ruff.lint.flake8-tidy-imports.banned-api]
# Don't use delattr/getattr/setattr -> too dynamic!
"__builtins__.delattr".msg = "Don't use delattr/setattr/getattr."
"__builtins__.setattr".msg = "Don't use delattr/setattr/getattr."
"__builtins__.getattr".msg = "Don't use delattr/setattr/getattr."
# Don't use `@property`, because methods are more flexible and allow access to unbound methods.
"__builtins__.property".msg = "Don't use properties in this part of the code."
# Don't print. Basically the same as the `T` rule.
"__builtins__.print".msg = "Don't use print."
"__builtins__.list".msg = "Use list literal instead."
The text was updated successfully, but these errors were encountered:
I would prefer builtins.eggs over __builtins__.eggs, that's the actual name of the module, and:
As an implementation detail, most modules have the name __builtins__ made available as part of their globals. The value of __builtins__ is normally either this module or the value of this module’s __dict__ attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python.
- https://docs.python.org/3/library/builtins.html
I'd love to ban usage of certain builtins using the "banned-api" (TID251) rule.
Something like this:
The text was updated successfully, but these errors were encountered: