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

Extend documentation for redefined-builtin #10167

Merged
merged 3 commits into from
Jan 4, 2025

Conversation

zenlyj
Copy link
Contributor

@zenlyj zenlyj commented Jan 4, 2025

Closes #10160

Type of Changes

Type
πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
βœ“ πŸ“œ Docs

Description

The redefined-builtin check has an option - allowed-redefined-builtins that allows users to specify names that are allowed to shadow built-ins. However, there are exceptions where this option does not apply, which might lead to confusion. Users may reasonably expect the option to be effective in all cases.

The option is not effective when:

  • the shadowing occurs at module level
  • the shadowing occurs at local scope, but the global keyword is applied to the name

The justification for these exceptions was discussed in #3643. Therefore, these cases should be documented to provide better clarity for users.

Additionally, add functional test for the global keyword case, as it is not covered by existing tests.

Screenshot reference of updated doc page:

image

Closes #10160

Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 95.80%. Comparing base (0d5439b) to head (934539c).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10167   +/-   ##
=======================================
  Coverage   95.80%   95.80%           
=======================================
  Files         174      174           
  Lines       18976    18976           
=======================================
  Hits        18180    18180           
  Misses        796      796           

@DanielNoord DanielNoord added the Skip news πŸ”‡ This change does not require a changelog entry label Jan 4, 2025
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One comment about the link, the rest LGTM!

doc/data/messages/r/redefined-builtin/details.rst Outdated Show resolved Hide resolved
@DanielNoord DanielNoord enabled auto-merge (squash) January 4, 2025 13:50
@DanielNoord DanielNoord merged commit 054f233 into pylint-dev:main Jan 4, 2025
26 checks passed
@zenlyj zenlyj deleted the doc/allowed-redefined-builtins branch January 4, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation πŸ“— Skip news πŸ”‡ This change does not require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option allowed-redefined-builtins has no effect
2 participants