Skip to content

Commit 3e7db7c

Browse files
committed
Enable design complexity checks
1 parent 62c5bad commit 3e7db7c

11 files changed

+17
-5
lines changed

astroid/arguments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def infer_argument(
142142
self, funcnode: InferenceResult, name: str, context: InferenceContext
143143
): # noqa: C901
144144
"""Infer a function argument value according to the call context."""
145+
# pylint: disable = too-many-branches
146+
145147
if not isinstance(funcnode, (nodes.FunctionDef, nodes.Lambda)):
146148
raise InferenceError(
147149
f"Can not infer function argument value for non-function node {funcnode!r}.",

astroid/brain/brain_builtin_inference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def on_bootstrap():
176176

177177

178178
def _builtin_filter_predicate(node, builtin_name) -> bool:
179+
# pylint: disable = too-many-boolean-expressions
179180
if (
180181
builtin_name == "type"
181182
and node.root().name == "re"

astroid/brain/brain_dataclasses.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,12 @@ def _get_previous_field_default(node: nodes.ClassDef, name: str) -> nodes.NodeNG
238238
return None
239239

240240

241-
def _generate_dataclass_init( # pylint: disable=too-many-locals
241+
def _generate_dataclass_init(
242242
node: nodes.ClassDef, assigns: list[nodes.AnnAssign], kw_only_decorated: bool
243243
) -> str:
244244
"""Return an init method for a dataclass given the targets."""
245+
# pylint: disable = too-many-locals, too-many-branches, too-many-statements
246+
245247
params: list[str] = []
246248
kw_only_params: list[str] = []
247249
assignments: list[str] = []

astroid/brain/brain_gi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def _gi_build_stub(parent): # noqa: C901
5959
Inspect the passed module recursively and build stubs for functions,
6060
classes, etc.
6161
"""
62+
# pylint: disable = too-many-branches, too-many-statements
63+
6264
classes = {}
6365
functions = {}
6466
constants = {}

astroid/brain/brain_namedtuple_enum.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ def _get_renamed_namedtuple_attributes(field_names):
268268
names = list(field_names)
269269
seen = set()
270270
for i, name in enumerate(field_names):
271+
# pylint: disable = too-many-boolean-expressions
271272
if (
272273
not all(c.isalnum() or c == "_" for c in name)
273274
or keyword.iskeyword(name)

astroid/decorators.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
137137
raise ValueError(
138138
f"Can't find argument '{arg}' for '{args[0].__class__.__qualname__}'"
139139
) from None
140+
# pylint: disable = too-many-boolean-expressions
140141
if (
141142
# Check kwargs
142143
# - if found, check it's not None

astroid/filter_statements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def _filter_stmts(
6767
6868
:returns: The filtered statements.
6969
"""
70+
# pylint: disable = too-many-branches, too-many-statements
71+
7072
# if offset == -1, my actual frame is not the inner frame but its parent
7173
#
7274
# class A(B): pass

astroid/nodes/_base_nodes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ def _get_binop_flow(
603603
),
604604
]
605605

606+
# pylint: disable = too-many-boolean-expressions
606607
if (
607608
PY310_PLUS
608609
and op == "|"

astroid/nodes/node_ng.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,8 @@ def repr_tree(
656656
:rtype: str
657657
"""
658658

659+
# pylint: disable = too-many-statements
660+
659661
@_singledispatch
660662
def _repr_tree(node, result, done, cur_indent="", depth=1):
661663
"""Outputs a representation of a non-tuple/list, non-node that's

astroid/protocols.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ def starred_assigned_stmts( # noqa: C901
691691
the inference results.
692692
"""
693693

694-
# pylint: disable=too-many-locals,too-many-statements
694+
# pylint: disable = too-many-locals, too-many-statements, too-many-branches
695+
695696
def _determine_starred_iteration_lookups(
696697
starred: nodes.Starred, target: nodes.Tuple, lookups: list[tuple[int, int]]
697698
) -> None:

pylintrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ disable=fixme,
9292
missing-docstring,
9393
too-few-public-methods,
9494
too-many-public-methods,
95-
too-many-boolean-expressions,
96-
too-many-branches,
97-
too-many-statements,
9895
# We know about it and we're doing our best to remove it in 2.0 (oups)
9996
cyclic-import,
10097
# Requires major redesign for fixing this (and private

0 commit comments

Comments
 (0)