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 reportDeclaration not reporting multiple redeclarations of the same type #93

Merged
merged 2 commits into from
Feb 18, 2024

Conversation

DetachHead
Copy link
Owner

receclarations of the same time are always a mistake, even more so than redeclarations of different types (which you may sometimes want to do)

fixes #70

…same type (which is OBVIOUSLY a mistake, even more often than redeclarations of different types)

This comment has been minimized.

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-reportRedeclaration branch from 7278535 to 9cf7f56 Compare February 18, 2024 08:34
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pyinstrument (https://github.com/joerick/pyinstrument)
+ /tmp/mypy_primer/projects/pyinstrument/pyinstrument/frame.py
+   /tmp/mypy_primer/projects/pyinstrument/pyinstrument/frame.py:58:5 - error: Declaration "attributes" is obscured by a declaration of the same name (reportRedeclaration)
- 41 errors, 5 warnings, 0 notes 
+ 42 errors, 5 warnings, 0 notes 

operator (https://github.com/canonical/operator)
+ /tmp/mypy_primer/projects/operator/ops/charm.py
+   /tmp/mypy_primer/projects/operator/ops/charm.py:1252:5 - error: Declaration "maintainers" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/ops/charm.py:1292:5 - error: Declaration "relations" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/operator/ops/main.py
+   /tmp/mypy_primer/projects/operator/ops/main.py:160:9 - error: Declaration "args" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/ops/main.py:168:9 - error: Declaration "args" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/operator/ops/model.py
+   /tmp/mypy_primer/projects/operator/ops/model.py:1451:5 - error: Declaration "app" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/ops/model.py:1457:5 - error: Declaration "units" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/ops/pebble.py:1794:17 - error: Declaration "body" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/ops/pebble.py:2256:13 - error: Declaration "source_io" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/ops/pebble.py:2258:13 - error: Declaration "source_io" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/operator/test/test_model.py:1230:5 - error: Declaration "errors" is obscured by a declaration of the same name (reportRedeclaration)
- 37 errors, 0 warnings, 0 notes 
+ 47 errors, 0 warnings, 0 notes 

steam.py (https://github.com/Gobot1234/steam.py)
+   /tmp/mypy_primer/projects/steam.py/steam/chat.py:510:5 - error: Declaration "app" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/steam.py/steam/protobufs/loyalty_rewards.py:150:5 - error: Declaration "total_points_given" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/steam.py/steam/protobufs/loyalty_rewards.py:151:5 - error: Declaration "total_points_received" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/steam.py/steam/types/manifest.py:44:5 - error: Declaration "steam_release_date" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/steam.py/steam/types/manifest.py:45:5 - error: Declaration "review_score" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/steam.py/steam/types/manifest.py:46:5 - error: Declaration "review_percentage" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/steam.py/steam/types/manifest.py:56:5 - error: Declaration "store_tags" is obscured by a declaration of the same name (reportRedeclaration)
- 8406 errors, 25 warnings, 0 notes 
+ 8413 errors, 25 warnings, 0 notes 

spack (https://github.com/spack/spack)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/report.py:39:5 - error: Declaration "specs" is obscured by a declaration of the same name (reportRedeclaration)
- 23863 errors, 78 warnings, 0 notes 
+ 23864 errors, 78 warnings, 0 notes 

pandas (https://github.com/pandas-dev/pandas)
+   /tmp/mypy_primer/projects/pandas/pandas/core/indexes/multi.py:313:5 - error: Declaration "_levels" is obscured by a declaration of the same name (reportRedeclaration)
- 1896 errors, 3 warnings, 0 notes 
+ 1897 errors, 3 warnings, 0 notes 

discord.py (https://github.com/Rapptz/discord.py)
+ /tmp/mypy_primer/projects/discord.py/discord/channel.py
+   /tmp/mypy_primer/projects/discord.py/discord/channel.py:190:14 - error: Declaration "_type" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/interactions.py:1068:13 - error: Declaration "payload" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/partial_emoji.py
+   /tmp/mypy_primer/projects/discord.py/discord/partial_emoji.py:100:9 - error: Declaration "id" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/raw_models.py
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:111:18 - error: Declaration "guild_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:139:18 - error: Declaration "guild_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:176:18 - error: Declaration "guild_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:247:18 - error: Declaration "guild_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:280:18 - error: Declaration "guild_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:310:18 - error: Declaration "guild_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/raw_models.py:337:18 - error: Declaration "application_id" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/state.py
+   /tmp/mypy_primer/projects/discord.py/discord/state.py:197:14 - error: Declaration "application_flags" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/state.py:304:18 - error: Declaration "_messages" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/state.py:306:18 - error: Declaration "_messages" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/threads.py
+   /tmp/mypy_primer/projects/discord.py/discord/threads.py:184:14 - error: Declaration "_flags" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/threads.py:186:14 - error: Declaration "_applied_tags" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/widget.py
+   /tmp/mypy_primer/projects/discord.py/discord/widget.py:170:9 - error: Declaration "activity" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/app_commands/tree.py
+   /tmp/mypy_primer/projects/discord.py/discord/app_commands/tree.py:733:13 - error: Declaration "base" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/ext/commands/help.py
+   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/help.py:1050:14 - error: Declaration "paginator" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/help.py:1340:14 - error: Declaration "paginator" is obscured by a declaration of the same name (reportRedeclaration)
+ /tmp/mypy_primer/projects/discord.py/discord/types/channel.py
+   /tmp/mypy_primer/projects/discord.py/discord/types/channel.py:108:5 - error: Declaration "owner_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/types/channel.py:110:5 - error: Declaration "last_message_id" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/discord.py/discord/types/channel.py:111:5 - error: Declaration "rate_limit_per_user" is obscured by a declaration of the same name (reportRedeclaration)
- 61 errors, 13 warnings, 0 notes 
+ 83 errors, 13 warnings, 0 notes 

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+   /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/django/utils.py:292:9 - error: Declaration "request_headers" is obscured by a declaration of the same name (reportRedeclaration)
- 7988 errors, 468 warnings, 0 notes 
+ 7989 errors, 468 warnings, 0 notes 

freqtrade (https://github.com/freqtrade/freqtrade)
+   /tmp/mypy_primer/projects/freqtrade/freqtrade/edge/edge_positioning.py:46:5 - error: Declaration "_cached_pairs" is obscured by a declaration of the same name (reportRedeclaration)
- 491 errors, 39 warnings, 0 notes 
+ 492 errors, 39 warnings, 0 notes 

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+   /tmp/mypy_primer/projects/hydra-zen/src/hydra_zen/funcs.py:55:9 - error: Declaration "unresolved_wrappers" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/hydra-zen/src/hydra_zen/structured_configs/_implementations.py:2545:13 - error: Declaration "target_has_valid_signature" is obscured by a declaration of the same name (reportRedeclaration)
- 150 errors, 0 warnings, 183 notes 
+ 152 errors, 0 warnings, 183 notes 

materialize (https://github.com/MaterializeInc/materialize)
+   /tmp/mypy_primer/projects/materialize/misc/python/materialize/scalability/plot/plot.py:230:9 - error: Declaration "plot" is obscured by a declaration of the same name (reportRedeclaration)
+   /tmp/mypy_primer/projects/materialize/misc/python/materialize/scalability/plot/plot.py:234:9 - error: Declaration "plot" is obscured by a declaration of the same name (reportRedeclaration)
- 10 errors, 311 warnings, 0 notes 
+ 12 errors, 311 warnings, 0 notes 

@DetachHead DetachHead merged commit 7a6461e into main Feb 18, 2024
10 checks passed
@DetachHead DetachHead deleted the fix-reportRedeclaration branch February 18, 2024 08:41
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.

reportRedeclaration false negative when redeclaration has the same type
1 participant