Skip to content

Fix false negative dangerous-default-value for typing.NamedTuple (#3716)#10989

Open
hamza-mobeen wants to merge 2 commits intopylint-dev:mainfrom
hamza-mobeen:fix/issue-3716-namedtuple-dangerous-default
Open

Fix false negative dangerous-default-value for typing.NamedTuple (#3716)#10989
hamza-mobeen wants to merge 2 commits intopylint-dev:mainfrom
hamza-mobeen:fix/issue-3716-namedtuple-dangerous-default

Conversation

@hamza-mobeen
Copy link
Copy Markdown

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
📜 Docs

Description

Right now, pylint's dangerous-default-value (W0102) only catches mutable defaults on regular function and method arguments. But the exact same bug can happen with typing.NamedTuple field defaults and pylint stays silent about it.

from typing import List, NamedTuple

class LibStats(NamedTuple):
    avgs: List[float] = []   # mutable default shared across all instances
    stds: List[float] = []   # same problem

lib_a = LibStats()
lib_b = LibStats()
lib_a.avgs.append(1.0)
assert lib_a.avgs != lib_b.avgs  # FAILS — list is shared

Root cause

The existing _check_dangerous_default method is only triggered via visit_functiondef, which inspects node.args.defaults. When a class inherits from typing.NamedTuple, the field defaults are AnnAssign nodes inside a ClassDef body — the checker never sees them.

What this PR does

Adds a new _check_namedtuple_dangerous_defaults method to BasicChecker that:

  1. Detects classes inheriting from typing.NamedTuple (using the same ancestor.qname() pattern already used in variables.py and design_analysis.py)
  2. Iterates over AnnAssign nodes in the class body
  3. Infers the default value and checks it against the existing DEFAULT_ARGUMENT_SYMBOLS map
  4. Emits dangerous-default-value on the specific field line

The check is called from visit_classdef, which was updated with the @utils.only_required_for_messages("dangerous-default-value") decorator.

Code change

In pylint/checkers/base/basic_checker.py:

-    def visit_classdef(self, _: nodes.ClassDef) -> None:
+    @utils.only_required_for_messages("dangerous-default-value")
+    def visit_classdef(self, node: nodes.ClassDef) -> None:
         """Check module name, docstring and redefinition
         increment branch counter.
         """
         self.linter.stats.node_count["klass"] += 1
+        self._check_namedtuple_dangerous_defaults(node)

The new _check_namedtuple_dangerous_defaults method reuses the same mutable-default detection logic from _check_dangerous_default, applied to AnnAssign.value nodes instead of function argument defaults.

Tests

Added a new functional test dangerous_default_value_namedtuple.py covering:

  • [], {}, set(), {1, 2} (set literal), list(), dict(), collections.deque() defaults → all emit W0102
  • Safe defaults (str, int, bool, tuple, frozenset) → no warning
  • Mixed classes (some safe, some mutable fields)
  • Classes with no defaults at all

Closes #3716

Checklist

  • Document your change, if it is a non-trivial one.
    • A maintainer might label the issue skip-news if the change does not need to be in the changelog.
    • Otherwise, create a news fragment with towncrier create <IssueNumber>.<type> which will be
      included in the changelog. <type> can be one of the types defined in ./towncrier.toml.
      If necessary you can write details or offer examples on how the new change is supposed to work.
    • Generating the doc is done with tox -e docs
  • Relate your change to an issue in the tracker if such an issue exists (Refs incorrect analysing of etree #1234, Closes incorrect analysing of etree #1234)
  • Write comprehensive commit messages and/or a good description of what the PR does.
  • Keep the change small, separate the consensual changes from the opinionated one.
    Don't hesitate to open multiple PRs if the change requires it. If your review is so
    big it requires to actually plan and allocate time to review, it's more likely
    that it's going to go stale.
  • If you used multiple emails or multiple names when contributing, add your mails
    and preferred name in script/.contributors_aliases.json

Copy link
Copy Markdown
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.

Cool!

self.linter.stats.node_count["module"] += 1

def visit_classdef(self, _: nodes.ClassDef) -> None:
@utils.only_required_for_messages("dangerous-default-value")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This feels incorrect, considering we're also updating statistics here.

continue
default = child.value
try:
value = next(default.infer())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we use safe_infer here?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

🤖 Effect of this PR on checked open source code: 🤖

Effect on astropy:

The following messages are now emitted:

Details
  1. too-many-lines:
    Too many lines in module (1050/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/kernels.py#L1
  2. too-many-lines:
    Too many lines in module (1077/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/convolve.py#L1
  3. too-many-lines:
    Too many lines in module (1001/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/tests/test_convolve_fft.py#L1
  4. too-many-lines:
    Too many lines in module (1295/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/tests/test_convolve.py#L1
  5. too-many-lines:
    Too many lines in module (1225/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/nduncertainty.py#L1
  6. too-many-lines:
    Too many lines in module (1063/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/covariance.py#L1
  7. too-many-lines:
    Too many lines in module (1236/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/tests/test_ccddata.py#L1
  8. too-many-lines:
    Too many lines in module (1592/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/mixins/tests/test_ndarithmetic.py#L1
  9. too-many-lines:
    Too many lines in module (3001/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/docstrings.py#L1
  10. too-many-lines:
    Too many lines in module (1362/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/utils.py#L1
  11. too-many-lines:
    Too many lines in module (3952/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/wcs.py#L1
  12. too-many-lines:
    Too many lines in module (2612/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/tests/test_wcs.py#L1
  13. too-many-lines:
    Too many lines in module (1783/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/tests/test_utils.py#L1
  14. too-many-lines:
    Too many lines in module (1249/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/tests/test_wcsprm.py#L1
  15. too-many-lines:
    Too many lines in module (1654/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/wcsapi/tests/test_fitswcs.py#L1
  16. too-many-lines:
    Too many lines in module (1090/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py#L1
  17. too-many-lines:
    Too many lines in module (1101/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/console.py#L1
  18. too-many-lines:
    Too many lines in module (1273/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/decorators.py#L1
  19. too-many-lines:
    Too many lines in module (2299/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/data.py#L1
  20. too-many-lines:
    Too many lines in module (2408/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/tests/test_data.py#L1
  21. too-many-lines:
    Too many lines in module (1457/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/function_helpers.py#L1
  22. too-many-lines:
    Too many lines in module (1461/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/core.py#L1
  23. too-many-lines:
    Too many lines in module (1626/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/tests/test_masked.py#L1
  24. too-many-lines:
    Too many lines in module (1742/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/tests/test_function_helpers.py#L1
  25. too-many-lines:
    Too many lines in module (1364/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/iers/iers.py#L1
  26. too-many-lines:
    Too many lines in module (1314/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/registry/tests/test_registries.py#L1
  27. too-many-lines:
    Too many lines in module (4706/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/tree.py#L1
  28. too-many-lines:
    Too many lines in module (1504/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/converters.py#L1
  29. too-many-lines:
    Too many lines in module (1612/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/exceptions.py#L1
  30. too-many-lines:
    Too many lines in module (1234/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/tests/test_vo.py#L1
  31. too-many-lines:
    Too many lines in module (1121/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/ui.py#L1
  32. too-many-lines:
    Too many lines in module (1861/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/core.py#L1
  33. too-many-lines:
    Too many lines in module (1381/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_ecsv.py#L1
  34. too-many-lines:
    Too many lines in module (1748/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_c_reader.py#L1
  35. too-many-lines:
    Too many lines in module (2203/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_read.py#L1
  36. too-many-lines:
    Too many lines in module (1004/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_write.py#L1
  37. too-many-lines:
    Too many lines in module (1187/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/convenience.py#L1
  38. too-many-lines:
    Too many lines in module (2277/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/header.py#L1
  39. too-many-lines:
    Too many lines in module (1332/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/card.py#L1
  40. too-many-lines:
    Too many lines in module (2771/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/column.py#L1
  41. too-many-lines:
    Too many lines in module (1574/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/diff.py#L1
  42. too-many-lines:
    Too many lines in module (1419/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/fitsrec.py#L1
  43. too-many-lines:
    Too many lines in module (3307/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_header.py#L1
  44. too-many-lines:
    Too many lines in module (1214/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_image.py#L1
  45. too-many-lines:
    Too many lines in module (1202/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_connect.py#L1
  46. too-many-lines:
    Too many lines in module (1664/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_core.py#L1
  47. too-many-lines:
    Too many lines in module (4036/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_table.py#L1
  48. too-many-lines:
    Too many lines in module (1270/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_hdulist.py#L1
  49. too-many-lines:
    Too many lines in module (1599/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/base.py#L1
  50. too-many-lines:
    Too many lines in module (1296/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/image.py#L1
  51. too-many-lines:
    Too many lines in module (1526/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/table.py#L1
  52. too-many-lines:
    Too many lines in module (1622/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/hdulist.py#L1
  53. too-many-lines:
    Too many lines in module (1511/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/compressed/tests/test_compressed.py#L1
  54. too-many-lines:
    Too many lines in module (1283/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/misc/ecsv.py#L1
  55. too-many-lines:
    Too many lines in module (1002/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/misc/tests/test_parquet.py#L1
  56. too-many-lines:
    Too many lines in module (1506/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/samp/hub.py#L1
  57. too-many-lines:
    Too many lines in module (2755/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/core.py#L1
  58. too-many-lines:
    Too many lines in module (2294/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/quantity.py#L1
  59. too-many-lines:
    Too many lines in module (1025/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_equivalencies.py#L1
  60. too-many-lines:
    Too many lines in module (1051/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_logarithmic.py#L1
  61. too-many-lines:
    Too many lines in module (1662/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_quantity_ufuncs.py#L1
  62. too-many-lines:
    Too many lines in module (1299/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_units.py#L1
  63. too-many-lines:
    Too many lines in module (2137/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_quantity.py#L1
  64. too-many-lines:
    Too many lines in module (2891/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_quantity_non_ufuncs.py#L1
  65. too-many-lines:
    Too many lines in module (1213/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_format.py#L1
  66. too-many-lines:
    Too many lines in module (1628/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/quantity_helper/function_helpers.py#L1
  67. too-many-lines:
    Too many lines in module (1098/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/ply/lex.py#L1
  68. too-many-lines:
    Too many lines in module (3502/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/ply/yacc.py#L1
  69. attribute-defined-outside-init:
    Attribute 'lineno' defined outside init
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/ply/yacc.py#L676
  70. attribute-defined-outside-init:
    Attribute 'lexpos' defined outside init
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/ply/yacc.py#L677
  71. too-many-lines:
    Too many lines in module (2472/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/configobj/configobj.py#L1
  72. too-many-lines:
    Too many lines in module (1472/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/configobj/validate.py#L1
  73. too-many-lines:
    Too many lines in module (2371/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/modeling/fitting.py#L4
  74. too-many-lines:
    Too many lines in module (4816/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/modeling/core.py#L4
  75. too-many-lines:
    Too many lines in module (1955/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/modeling/polynomial.py#L4
  76. invalid-name:
    Method name "test_init_Tcmb0_zeroing" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L92
  77. invalid-name:
    Method name "test_Odm0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L112
  78. invalid-name:
    Method name "test_Ok0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L120
  79. invalid-name:
    Method name "test_Tnu0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L140
  80. invalid-name:
    Method name "test_Ogamma0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L196
  81. invalid-name:
    Method name "test_Onu0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L209
  82. invalid-name:
    Method name "test_Otot0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L233
  83. invalid-name:
    Method name "test_Otot" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L270
  84. too-many-ancestors:
    Too many ancestors (25/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py#L109
  85. unused-argument:
    Unused argument 'cosmo_cls'
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py#L147
  86. too-many-ancestors:
    Too many ancestors (30/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py#L207
  87. too-many-ancestors:
    Too many ancestors (28/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_w0cdm.py#L138
  88. too-many-ancestors:
    Too many ancestors (24/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_lambdacdm.py#L41
  89. too-many-ancestors:
    Too many ancestors (28/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_lambdacdm.py#L121
  90. too-many-ancestors:
    Too many ancestors (23/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_w0wzcdm.py#L70
  91. too-many-ancestors:
    Too many ancestors (27/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_w0wzcdm.py#L190

The following messages are no longer emitted:

Details
  1. too-many-lines:
    Too many lines in module (4816/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/modeling/core.py#L1
  2. too-many-lines:
    Too many lines in module (1955/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/modeling/polynomial.py#L1
  3. too-many-lines:
    Too many lines in module (2371/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/modeling/fitting.py#L5
  4. too-many-lines:
    Too many lines in module (2755/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/core.py#L5
  5. too-many-lines:
    Too many lines in module (2294/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/quantity.py#L5
  6. too-many-lines:
    Too many lines in module (1025/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_equivalencies.py#L5
  7. too-many-lines:
    Too many lines in module (2137/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_quantity.py#L5
  8. too-many-lines:
    Too many lines in module (1051/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_logarithmic.py#L5
  9. too-many-lines:
    Too many lines in module (1213/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_format.py#L5
  10. too-many-lines:
    Too many lines in module (1299/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_units.py#L5
  11. too-many-lines:
    Too many lines in module (2891/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_quantity_non_ufuncs.py#L5
  12. too-many-lines:
    Too many lines in module (1662/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/tests/test_quantity_ufuncs.py#L5
  13. too-many-lines:
    Too many lines in module (1628/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/units/quantity_helper/function_helpers.py#L5
  14. too-many-lines:
    Too many lines in module (1187/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/convenience.py#L5
  15. too-many-lines:
    Too many lines in module (1332/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/card.py#L5
  16. too-many-lines:
    Too many lines in module (1574/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/diff.py#L5
  17. too-many-lines:
    Too many lines in module (1419/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/fitsrec.py#L5
  18. too-many-lines:
    Too many lines in module (2277/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/header.py#L5
  19. too-many-lines:
    Too many lines in module (2771/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/column.py#L5
  20. too-many-lines:
    Too many lines in module (1270/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_hdulist.py#L5
  21. too-many-lines:
    Too many lines in module (3307/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_header.py#L5
  22. too-many-lines:
    Too many lines in module (1202/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_connect.py#L5
  23. too-many-lines:
    Too many lines in module (1214/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_image.py#L5
  24. too-many-lines:
    Too many lines in module (4036/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_table.py#L5
  25. too-many-lines:
    Too many lines in module (1664/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/tests/test_core.py#L5
  26. too-many-lines:
    Too many lines in module (1622/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/hdulist.py#L5
  27. too-many-lines:
    Too many lines in module (1599/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/base.py#L5
  28. too-many-lines:
    Too many lines in module (1296/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/image.py#L5
  29. too-many-lines:
    Too many lines in module (1526/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/table.py#L5
  30. too-many-lines:
    Too many lines in module (1511/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/fits/hdu/compressed/tests/test_compressed.py#L5
  31. too-many-lines:
    Too many lines in module (1314/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/registry/tests/test_registries.py#L5
  32. too-many-lines:
    Too many lines in module (1283/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/misc/ecsv.py#L5
  33. too-many-lines:
    Too many lines in module (1002/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/misc/tests/test_parquet.py#L5
  34. too-many-lines:
    Too many lines in module (1861/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/core.py#L5
  35. too-many-lines:
    Too many lines in module (1121/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/ui.py#L5
  36. too-many-lines:
    Too many lines in module (1748/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_c_reader.py#L5
  37. too-many-lines:
    Too many lines in module (1004/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_write.py#L5
  38. too-many-lines:
    Too many lines in module (2203/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_read.py#L5
  39. too-many-lines:
    Too many lines in module (1381/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tests/test_ecsv.py#L5
  40. too-many-lines:
    Too many lines in module (1612/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/exceptions.py#L5
  41. too-many-lines:
    Too many lines in module (1504/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/converters.py#L5
  42. too-many-lines:
    Too many lines in module (4706/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/tree.py#L5
  43. too-many-lines:
    Too many lines in module (1234/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/votable/tests/test_vo.py#L5
  44. too-many-lines:
    Too many lines in module (3001/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/docstrings.py#L5
  45. too-many-lines:
    Too many lines in module (3952/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/wcs.py#L5
  46. too-many-lines:
    Too many lines in module (1362/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/utils.py#L5
  47. too-many-lines:
    Too many lines in module (2612/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/tests/test_wcs.py#L5
  48. too-many-lines:
    Too many lines in module (1249/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/tests/test_wcsprm.py#L5
  49. too-many-lines:
    Too many lines in module (1783/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/tests/test_utils.py#L5
  50. too-many-lines:
    Too many lines in module (1090/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py#L5
  51. too-many-lines:
    Too many lines in module (1654/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/wcs/wcsapi/tests/test_fitswcs.py#L5
  52. too-many-lines:
    Too many lines in module (1063/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/covariance.py#L5
  53. too-many-lines:
    Too many lines in module (1225/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/nduncertainty.py#L5
  54. too-many-lines:
    Too many lines in module (1236/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/tests/test_ccddata.py#L5
  55. too-many-lines:
    Too many lines in module (1592/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/nddata/mixins/tests/test_ndarithmetic.py#L5
  56. too-many-lines:
    Too many lines in module (1472/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/configobj/validate.py#L5
  57. too-many-lines:
    Too many lines in module (2472/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/configobj/configobj.py#L5
  58. too-many-lines:
    Too many lines in module (3502/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/ply/yacc.py#L5
  59. too-many-lines:
    Too many lines in module (1098/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/extern/ply/lex.py#L5
  60. too-many-ancestors:
    Too many ancestors (30/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py#L109
  61. unused-argument:
    Unused argument 'cosmo_cls'
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py#L147
  62. too-many-ancestors:
    Too many ancestors (34/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py#L207
  63. invalid-name:
    Method name "test_init_Tcmb0_zeroing" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L92
  64. invalid-name:
    Method name "test_Odm0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L112
  65. invalid-name:
    Method name "test_Ok0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L120
  66. invalid-name:
    Method name "test_Tnu0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L140
  67. invalid-name:
    Method name "test_Ogamma0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L196
  68. invalid-name:
    Method name "test_Onu0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L209
  69. invalid-name:
    Method name "test_Otot0" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L233
  70. invalid-name:
    Method name "test_Otot" doesn't conform to snake_case naming style
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_base.py#L270
  71. too-many-ancestors:
    Too many ancestors (22/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_lambdacdm.py#L41
  72. too-many-ancestors:
    Too many ancestors (27/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_lambdacdm.py#L121
  73. too-many-ancestors:
    Too many ancestors (27/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_w0cdm.py#L138
  74. too-many-ancestors:
    Too many ancestors (24/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_w0wzcdm.py#L70
  75. too-many-ancestors:
    Too many ancestors (28/7)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/cosmology/_src/tests/flrw/test_w0wzcdm.py#L190
  76. too-many-lines:
    Too many lines in module (1506/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/samp/hub.py#L5
  77. no-name-in-module:
    No name 'client' in module 'xmlrpc.client'
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/samp/utils.py#L9
  78. too-many-lines:
    Too many lines in module (1273/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/decorators.py#L5
  79. too-many-lines:
    Too many lines in module (2299/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/data.py#L5
  80. too-many-lines:
    Too many lines in module (1101/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/console.py#L5
  81. too-many-lines:
    Too many lines in module (2408/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/tests/test_data.py#L5
  82. too-many-lines:
    Too many lines in module (1364/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/iers/iers.py#L5
  83. too-many-lines:
    Too many lines in module (1461/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/core.py#L5
  84. too-many-lines:
    Too many lines in module (1457/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/function_helpers.py#L5
  85. too-many-lines:
    Too many lines in module (1742/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/tests/test_function_helpers.py#L5
  86. too-many-lines:
    Too many lines in module (1626/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/masked/tests/test_masked.py#L5
  87. too-many-lines:
    Too many lines in module (1050/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/kernels.py#L5
  88. too-many-lines:
    Too many lines in module (1077/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/convolve.py#L5
  89. too-many-lines:
    Too many lines in module (1295/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/tests/test_convolve.py#L5
  90. too-many-lines:
    Too many lines in module (1001/1000)
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/convolution/tests/test_convolve_fft.py#L5

Effect on sentry:

The following messages are now emitted:

Details
  1. dangerous-default-value:
    Dangerous default value set() (builtins.set) as argument
    https://github.com/getsentry/sentry/blob/7a701584e61d8a093132eb37c45fd0359c1652ee/src/sentry/snuba/metrics/extraction.py#L61
  2. dangerous-default-value:
    Dangerous default value [] as argument
    https://github.com/getsentry/sentry/blob/7a701584e61d8a093132eb37c45fd0359c1652ee/src/sentry/spans/buffer.py#L145

Effect on home-assistant:

The following messages are no longer emitted:

Details
  1. import-private-name:
    Imported private module (_collections_abc)
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/components/smlight/binary_sensor.py#L5

This comment was generated for commit 448bb34

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.

False negative dangerous-default-value when typing.NamedTuple uses mutable defaults incorrect analysing of etree

2 participants