Skip to content

Ban dynamic builtins and typing.cast in lint config#3016

Merged
adamtheturtle merged 1 commit into
mainfrom
chore/pylint-builtin-bans
May 20, 2026
Merged

Ban dynamic builtins and typing.cast in lint config#3016
adamtheturtle merged 1 commit into
mainfrom
chore/pylint-builtin-bans

Conversation

@adamtheturtle
Copy link
Copy Markdown
Member

@adamtheturtle adamtheturtle commented May 20, 2026

Summary

  • Add literalizer DEPRECATED_BUILTINS.bad-functions pylint config (filter, getattr, hasattr, map, setattr).
  • Ban typing.cast imports via ruff flake8-tidy-imports where the project uses ruff.
  • Fix or pylint-disable existing violations uncovered by the new rules.

Test plan

  • CI lint passes (pylint, ruff, pre-commit).

Note

Low Risk
Low risk since this only tightens Ruff/Pylint lint configuration, though it may cause new lint failures in downstream or future changes that rely on typing.cast or the banned builtins.

Overview
Updates linting rules to disallow typing.cast imports via Ruff (flake8-tidy-imports) and to flag usage of certain dynamic builtins (filter, map, getattr, setattr, hasattr) via Pylint’s DEPRECATED_BUILTINS.bad-functions configuration.

Reviewed by Cursor Bugbot for commit 1ced42d. Bugbot is set up for automated code reviews on this repo. Configure here.

Align pylint and ruff with literalizer: forbid bare filter, getattr,
hasattr, map, and setattr via pylint, and ban typing.cast via ruff.
Fix or exempt existing violations.
@adamtheturtle adamtheturtle merged commit 94ef760 into main May 20, 2026
16 checks passed
@adamtheturtle adamtheturtle deleted the chore/pylint-builtin-bans branch May 20, 2026 07:09
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 this pull request may close these issues.

1 participant