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

Fix false negative for calling module-level function before definition #8494

Merged
merged 11 commits into from
Apr 29, 2023

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Closes #1144

@jacobtylerwalls jacobtylerwalls added the False Negative πŸ¦‹ No message is emitted but something is wrong with the code label Mar 26, 2023
@jacobtylerwalls jacobtylerwalls added this to the 3.0.0 milestone Mar 26, 2023
@codecov
Copy link

codecov bot commented Mar 26, 2023

Codecov Report

Merging #8494 (6be389a) into main (a59f3d5) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8494      +/-   ##
==========================================
- Coverage   95.81%   95.81%   -0.01%     
==========================================
  Files         174      174              
  Lines       18321    18319       -2     
==========================================
- Hits        17554    17552       -2     
  Misses        767      767              
Impacted Files Coverage Ξ”
pylint/checkers/variables.py 97.24% <100.00%> (-0.01%) ⬇️

@github-actions

This comment has been minimized.

@jacobtylerwalls jacobtylerwalls marked this pull request as draft March 26, 2023 20:40
@jacobtylerwalls jacobtylerwalls marked this pull request as ready for review March 26, 2023 21:00
DanielNoord
DanielNoord previously approved these changes Mar 26, 2023
@github-actions

This comment has been minimized.

@jacobtylerwalls jacobtylerwalls marked this pull request as draft March 27, 2023 02:29
@jacobtylerwalls jacobtylerwalls marked this pull request as ready for review April 15, 2023 14:23
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@jacobtylerwalls jacobtylerwalls added the Needs astroid update Needs an astroid update (probably a release too) before being mergable label Apr 15, 2023
@github-actions
Copy link
Contributor

πŸ€– Effect of this PR on checked open source code: πŸ€–

Effect on astroid:
The following messages are now emitted:

  1. used-before-assignment:
    Using variable '_class_type' before assignment
    https://github.com/pylint-dev/astroid/blob/495581f0ff1b0513397b9177c62f27e702e11bb2/astroid/nodes/scoped_nodes/scoped_nodes.py#L1947

Effect on django:
The following messages are now emitted:

  1. used-before-assignment:
    Using variable 'validators' before assignment
    https://github.com/django/django/blob/255f5345904854128647705adcb8d21138e87c63/django/db/models/fields/__init__.py#L120

Effect on poetry-core:
The following messages are now emitted:

  1. used-before-assignment:
    Using variable 'operator' before assignment
    https://github.com/python-poetry/poetry-core/blob/81805766cf57563b626b3bde41f4edfd7e4b08e9/src/poetry/core/constraints/generic/constraint.py#L12

This comment was generated for commit 3fdf7fe

@jacobtylerwalls jacobtylerwalls removed the Needs astroid update Needs an astroid update (probably a release too) before being mergable label Apr 29, 2023
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM !

@Pierre-Sassoulas Pierre-Sassoulas merged commit 1cbc3d8 into pylint-dev:main Apr 29, 2023
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0, 3.0.0b1 Apr 29, 2023
@jacobtylerwalls
Copy link
Member Author

I was going to wait for a new primer result, but if there are follow-ups, I'll just open a new PR. Sorry for not saying something sooner!

@jacobtylerwalls jacobtylerwalls deleted the issue-1144 branch April 29, 2023 18:35
@Pierre-Sassoulas
Copy link
Member

That's my bad for merging too fast :)

@jacobtylerwalls
Copy link
Member Author

No worries, I just checked and I can't reproduce the 2nd and 3rd items from the earlier primer comment, so I think they were also property-related like the 1st one I addressed in astroid (and checking the files confirms it) πŸŽ‰

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0b1, 3.0.0a7 May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative πŸ¦‹ No message is emitted but something is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail to find NameError for undefined functions
3 participants