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

False positive global-variable-not-assigned #7479

Merged

Conversation

mbyrnepr2
Copy link
Member

Type of Changes

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

Description

Closes #4809

@coveralls
Copy link

coveralls commented Sep 16, 2022

Pull Request Test Coverage Report for Build 3077460088

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.319%

Totals Coverage Status
Change from base Build 3068685942: 0.0%
Covered Lines: 17044
Relevant Lines: 17881

πŸ’› - Coveralls

@github-actions

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Sep 17, 2022
@mbyrnepr2 mbyrnepr2 marked this pull request as ready for review September 17, 2022 08:41
doc/whatsnew/fragments/4809.false_positive Outdated Show resolved Hide resolved
@jacobtylerwalls jacobtylerwalls added this to the 2.15.3 milestone Sep 18, 2022
@jacobtylerwalls jacobtylerwalls added the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label Sep 18, 2022
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@github-actions
Copy link
Contributor

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

Effect on pandas:
The following messages are now emitted:

  1. global-statement:
    Using the global statement
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L147
  2. global-statement:
    Using the global statement
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L324
  3. global-statement:
    Using the global statement
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325

The following messages are no longer emitted:

  1. global-variable-not-assigned:
    Using global for 'QApplication' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L147
  2. global-variable-not-assigned:
    Using global for 'HGLOBAL' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L324
  3. global-variable-not-assigned:
    Using global for 'LPVOID' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L324
  4. global-variable-not-assigned:
    Using global for 'DWORD' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L324
  5. global-variable-not-assigned:
    Using global for 'LPCSTR' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L324
  6. global-variable-not-assigned:
    Using global for 'INT' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L324
  7. global-variable-not-assigned:
    Using global for 'HWND' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325
  8. global-variable-not-assigned:
    Using global for 'HINSTANCE' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325
  9. global-variable-not-assigned:
    Using global for 'HMENU' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325
  10. global-variable-not-assigned:
    Using global for 'BOOL' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325
  11. global-variable-not-assigned:
    Using global for 'UINT' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325
  12. global-variable-not-assigned:
    Using global for 'HANDLE' but no assignment is done
    https://github.com/pandas-dev/pandas/blob/a712c5019dc0cfb58652ddcdf06361244f38ad9f/pandas/io/clipboard/__init__.py#L325

Effect on psycopg:
The following messages are now emitted:

  1. global-statement:
    Using the global statement
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/uuid.py#L40
  2. global-statement:
    Using the global statement
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L41
  3. global-statement:
    Using the global statement
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L42
  4. global-statement:
    Using the global statement
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L43

The following messages are no longer emitted:

  1. global-variable-not-assigned:
    Using global for 'UUID' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/uuid.py#L40
  2. global-variable-not-assigned:
    Using global for 'ip_address' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L41
  3. global-variable-not-assigned:
    Using global for 'ip_interface' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L41
  4. global-variable-not-assigned:
    Using global for 'ip_network' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L41
  5. global-variable-not-assigned:
    Using global for 'IPv4Address' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L42
  6. global-variable-not-assigned:
    Using global for 'IPv6Address' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L42
  7. global-variable-not-assigned:
    Using global for 'IPv4Interface' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L42
  8. global-variable-not-assigned:
    Using global for 'IPv6Interface' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L42
  9. global-variable-not-assigned:
    Using global for 'IPv4Network' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L43
  10. global-variable-not-assigned:
    Using global for 'IPv6Network' but no assignment is done
    https://github.com/psycopg/psycopg/blob/8a44473e3f75c1bfdd26052b68b1ead49b2e4ebe/psycopg/psycopg/types/net.py#L43

This comment was generated for commit 6a05239

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.

πŸ‘Œ

@Pierre-Sassoulas Pierre-Sassoulas merged commit 36e1238 into pylint-dev:main Sep 19, 2022
@mbyrnepr2 mbyrnepr2 deleted the 4809_global_variable_not_assigned branch September 19, 2022 07:41
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Sep 19, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Sep 19, 2022
* Fix false positive for ``global-variable-not-assigned`` when a global variable is re-assigned via a ``ImportFrom`` node.

Closes pylint-dev#4809

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Pierre-Sassoulas pushed a commit that referenced this pull request Sep 19, 2022
* Fix false positive for ``global-variable-not-assigned`` when a global variable is re-assigned via a ``ImportFrom`` node.

Closes #4809

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False Positive for W0602: global-variable-not-assigned
4 participants