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 FN for invalid-name for type-annotated module constants #9771

Merged
merged 3 commits into from
Mar 3, 2025

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Closes #9770

@jacobtylerwalls jacobtylerwalls added this to the 3.3.0 milestone Jul 7, 2024

This comment has been minimized.

@jacobtylerwalls jacobtylerwalls force-pushed the invalid-name-type-annotation branch 2 times, most recently from 4035baa to 2811003 Compare July 7, 2024 15:47
@jacobtylerwalls jacobtylerwalls requested a review from mbyrnepr2 July 7, 2024 15:51

This comment has been minimized.

@jacobtylerwalls
Copy link
Member Author

jacobtylerwalls commented Jul 7, 2024

Will leave this in a failing state until we remove support for Python 3.8 in #9774.

@jacobtylerwalls jacobtylerwalls added C: invalid-name Blocked 🚧 Blocked by a particular issue labels Jul 7, 2024
mbyrnepr2
mbyrnepr2 previously approved these changes Jul 8, 2024
@jacobtylerwalls jacobtylerwalls modified the milestones: 3.3.0, 4.0.0 Jul 8, 2024
@jacobtylerwalls jacobtylerwalls modified the milestones: 4.0.0, 3.3.0 Sep 18, 2024
@jacobtylerwalls jacobtylerwalls force-pushed the invalid-name-type-annotation branch from 2811003 to 16c68f0 Compare September 18, 2024 21:51
@jacobtylerwalls jacobtylerwalls removed the Blocked 🚧 Blocked by a particular issue label Sep 18, 2024
@jacobtylerwalls jacobtylerwalls force-pushed the invalid-name-type-annotation branch from 16c68f0 to 692895e Compare September 18, 2024 22:15

This comment has been minimized.

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

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

Project coverage is 95.86%. Comparing base (c668682) to head (3783a47).
Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9771      +/-   ##
==========================================
- Coverage   95.86%   95.86%   -0.01%     
==========================================
  Files         175      175              
  Lines       19069    19068       -1     
==========================================
- Hits        18281    18280       -1     
  Misses        788      788              
Files with missing lines Coverage Ξ”
pylint/checkers/base/name_checker/checker.py 98.67% <100.00%> (-0.02%) ⬇️

... and 2 files with indirect coverage changes

This comment has been minimized.

@jacobtylerwalls
Copy link
Member Author

DO NOT MERGE -- discussion on #9770 suggests holding until 4.0

This comment has been minimized.

@jacobtylerwalls jacobtylerwalls force-pushed the invalid-name-type-annotation branch from cec2b31 to f0a834c Compare March 2, 2025 14:29
@jacobtylerwalls jacobtylerwalls marked this pull request as ready for review March 2, 2025 14:32
Copy link
Contributor

github-actions bot commented Mar 2, 2025

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

Effect on astroid:
The following messages are now emitted:

  1. invalid-name:
    Constant name "MetaPathFinderModuleTypes" doesn't conform to '(([A-Z][A-Z0-9_])|(.*))$' pattern*
    https://github.com/pylint-dev/astroid/blob/ead8a3c759152627825da3977bfae2aff4959c58/astroid/interpreter/_import/spec.py#L54
  2. invalid-name:
    Constant name "EditableFinderClasses" doesn't conform to '(([A-Z][A-Z0-9_])|(.*))$' pattern*
    https://github.com/pylint-dev/astroid/blob/ead8a3c759152627825da3977bfae2aff4959c58/astroid/interpreter/_import/spec.py#L62

Effect on home-assistant:
The following messages are now emitted:

  1. invalid-name:
    Variable name "DEFAULT_TIME_ZONE" doesn't conform to snake_case naming style
    https://github.com/home-assistant/core/blob/0c803520a33af3b528756e8b099daeaecc3a957f/homeassistant/util/dt.py#L20
  2. invalid-name:
    Variable name "ENTITY_DESCRIPTIONS" doesn't conform to snake_case naming style
    https://github.com/home-assistant/core/blob/0c803520a33af3b528756e8b099daeaecc3a957f/homeassistant/components/unifi/sensor.py#L376
  3. invalid-name:
    Variable name "PLATFORM_SCHEMA" doesn't conform to snake_case naming style
    https://github.com/home-assistant/core/blob/0c803520a33af3b528756e8b099daeaecc3a957f/homeassistant/components/aftership/sensor.py#L39
  4. invalid-name:
    Variable name "JSON_DUMP" doesn't conform to snake_case naming style
    https://github.com/home-assistant/core/blob/0c803520a33af3b528756e8b099daeaecc3a957f/homeassistant/helpers/json.py#L178

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

  1. invalid-name:
    Variable name "SUPPORTED_EXTENSIONS" doesn't conform to snake_case naming style
    https://github.com/python-poetry/poetry-core/blob/369f5a9b67603a1f8e353f01886774096bdc9a52/src/poetry/core/packages/utils/utils.py#L37

Effect on black:
The following messages are no longer emitted:

  1. invalid-name:
    Constant name "syms" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/black/nodes.py#L24
  2. invalid-name:
    Constant name "tok_name" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/blib2to3/pgen2/token.py#L77
  3. invalid-name:
    Constant name "pseudoprog" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/blib2to3/pgen2/tokenize.py#L184
  4. invalid-name:
    Constant name "endprogs" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/blib2to3/pgen2/tokenize.py#L199
  5. invalid-name:
    Constant name "triple_quoted" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/blib2to3/pgen2/tokenize.py#L214
  6. invalid-name:
    Constant name "single_quoted" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/blib2to3/pgen2/tokenize.py#L219
  7. invalid-name:
    Constant name "fstring_prefix" doesn't conform to UPPER_CASE naming style
    https://github.com/psf/black/blob/00c0d6d91ae3dc31894fadd37968ec0bb01e0d0d/src/blib2to3/pgen2/tokenize.py#L224

Effect on music21:
The following messages are now emitted:

  1. invalid-name:
    Constant name "durationTupleCacheQuarterLength" doesn't conform to '(([A-Z][A-Z0-9_])|(.*))$' pattern*
    https://github.com/cuthbertLab/music21/blob/a929dc3078f2f362310fbdf9cdf6e38aee9b317d/music21/duration.py#L873
  2. invalid-name:
    Constant name "pitchStep" doesn't conform to '(([A-Z_][A-Z0-9_])|(.*))$' pattern*
    https://github.com/cuthbertLab/music21/blob/a929dc3078f2f362310fbdf9cdf6e38aee9b317d/music21/defaults.py#L44
  3. invalid-name:
    Constant name "instrumentName" doesn't conform to '(([A-Z_][A-Z0-9_])|(.*))$' pattern*
    https://github.com/cuthbertLab/music21/blob/a929dc3078f2f362310fbdf9cdf6e38aee9b317d/music21/defaults.py#L52
  4. invalid-name:
    Constant name "partName" doesn't conform to '(([A-Z_][A-Z0-9_])|(.*))$' pattern*
    https://github.com/cuthbertLab/music21/blob/a929dc3078f2f362310fbdf9cdf6e38aee9b317d/music21/defaults.py#L53

Effect on pytest:
The following messages are now emitted:

  1. invalid-name:
    Variable name "CHECKER_CLASS" doesn't conform to snake_case naming style
    https://github.com/pytest-dev/pytest/blob/58326f9d6177e23ba0a0006145652b62b2c68934/src/_pytest/doctest.py#L67
  2. invalid-name:
    Constant name "_reprcompare" doesn't conform to UPPER_CASE naming style
    https://github.com/pytest-dev/pytest/blob/58326f9d6177e23ba0a0006145652b62b2c68934/src/_pytest/assertion/util.py#L31
  3. invalid-name:
    Constant name "_assertion_pass" doesn't conform to UPPER_CASE naming style
    https://github.com/pytest-dev/pytest/blob/58326f9d6177e23ba0a0006145652b62b2c68934/src/_pytest/assertion/util.py#L35
  4. invalid-name:
    Constant name "_config" doesn't conform to UPPER_CASE naming style
    https://github.com/pytest-dev/pytest/blob/58326f9d6177e23ba0a0006145652b62b2c68934/src/_pytest/assertion/util.py#L38

Effect on pandas:
The following messages are now emitted:

  1. invalid-name:
    Variable name "GLOBAL_USE_NUMBA" doesn't conform to snake_case naming style
    https://github.com/pandas-dev/pandas/blob/57fd50221ea3d5de63d909e168f10ad9fc0eee9b/pandas/core/util/numba_.py#L17
  2. invalid-name:
    Variable name "_TEST_MODE" doesn't conform to snake_case naming style
    https://github.com/pandas-dev/pandas/blob/57fd50221ea3d5de63d909e168f10ad9fc0eee9b/pandas/core/computation/expressions.py#L30
  3. invalid-name:
    Variable name "_TEST_RESULT" doesn't conform to snake_case naming style
    https://github.com/pandas-dev/pandas/blob/57fd50221ea3d5de63d909e168f10ad9fc0eee9b/pandas/core/computation/expressions.py#L31

Effect on sentry:
The following messages are now emitted:

  1. invalid-name:
    Constant name "openai_client" doesn't conform to UPPER_CASE naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/llm/providers/openai.py#L42
  2. invalid-name:
    Variable name "LANGUAGES" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/conf/server.py#L230
  3. invalid-name:
    Variable name "SENTRY_REGION_CONFIG" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/conf/server.py#L692
  4. invalid-name:
    Variable name "RPC_SHARED_SECRET" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/conf/server.py#L695
  5. invalid-name:
    Variable name "SEER_RPC_SHARED_SECRET" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/conf/server.py#L702
  6. invalid-name:
    Variable name "SENTRY_MONOLITH_REGION" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/conf/server.py#L713
  7. invalid-name:
    Variable name "CELERY_SPLIT_QUEUE_TASK_ROUTES" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/conf/server.py#L1288
  8. invalid-name:
    Variable name "_LOGIN_URL" doesn't conform to snake_case naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/utils/auth.py#L32

The following messages are no longer emitted:

  1. invalid-name:
    Constant name "empty" doesn't conform to UPPER_CASE naming style
    https://github.com/getsentry/sentry/blob/c4502d06cff34abeb8f58810743fb907ee914348/src/sentry/utils/lazy_service_wrapper.py#L15

Effect on psycopg:
The following messages are now emitted:

  1. invalid-name:
    Constant name "DumperCache" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_py_transformer.py#L33
  2. invalid-name:
    Constant name "OidDumperCache" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_py_transformer.py#L34
  3. invalid-name:
    Constant name "LoaderCache" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_py_transformer.py#L35
  4. invalid-name:
    Constant name "Key" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_preparing.py#L23
  5. invalid-name:
    Constant name "ErrorInfo" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/errors.py#L35
  6. invalid-name:
    Constant name "RegistryKey" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_typeinfo.py#L29
  7. invalid-name:
    Constant name "PendingResult" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_pipeline.py#L31
  8. invalid-name:
    Constant name "AWorker" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/_acompat.py#L22
  9. invalid-name:
    Constant name "EnumDumpMap" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/enum.py#L26
  10. invalid-name:
    Constant name "EnumLoadMap" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/enum.py#L27
  11. invalid-name:
    Constant name "EnumMapping" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/enum.py#L28
  12. invalid-name:
    Constant name "_HEnumDumpMap" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/enum.py#L31
  13. invalid-name:
    Constant name "_HEnumLoadMap" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/enum.py#L32
  14. invalid-name:
    Constant name "Address" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L20
  15. invalid-name:
    Constant name "Interface" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L21
  16. invalid-name:
    Constant name "Network" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L22
  17. invalid-name:
    Constant name "ip_address" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L25
  18. invalid-name:
    Constant name "ip_interface" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L26
  19. invalid-name:
    Constant name "ip_network" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L27
  20. invalid-name:
    Constant name "IPv4Address" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L28
  21. invalid-name:
    Constant name "IPv6Address" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L29
  22. invalid-name:
    Constant name "IPv4Interface" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L30
  23. invalid-name:
    Constant name "IPv6Interface" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L31
  24. invalid-name:
    Constant name "IPv4Network" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L32
  25. invalid-name:
    Constant name "IPv6Network" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/net.py#L33
  26. invalid-name:
    Constant name "Hstore" doesn't conform to UPPER_CASE naming style
    https://github.com/psycopg/psycopg/blob/7dd94eaa0d7b57f11d0bbc98cfe0819f2a036ca2/psycopg/psycopg/types/hstore.py#L40

Effect on coverage:
The following messages are now emitted:

  1. invalid-name:
    Variable name "RELATIVE_DIR" doesn't conform to snake_case naming style
    https://github.com/nedbat/coveragepy/blob/1aecfa7ae2a81aa9c278cbb43718ae7e4bdcf5b5/coverage/files.py#L27
  2. invalid-name:
    Variable name "CANONICAL_FILENAME_CACHE" doesn't conform to snake_case naming style
    https://github.com/nedbat/coveragepy/blob/1aecfa7ae2a81aa9c278cbb43718ae7e4bdcf5b5/coverage/files.py#L28

This comment was generated for commit 4c8e046

mbyrnepr2
mbyrnepr2 previously approved these changes Mar 3, 2025
Copy link
Member

@mbyrnepr2 mbyrnepr2 left a comment

Choose a reason for hiding this comment

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

Works well/looks good. Thank you @jacobtylerwalls

@DanielNoord DanielNoord merged commit 553fd50 into main Mar 3, 2025
44 checks passed
@DanielNoord DanielNoord deleted the invalid-name-type-annotation branch March 3, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking changes for 4.0 🦀 C: invalid-name 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.

Annotated module level constant not checked for invalid-name
3 participants