summaryrefslogtreecommitdiff
path: root/pylint
diff options
context:
space:
mode:
Diffstat (limited to 'pylint')
-rw-r--r--pylint/checkers/base/basic_checker.py1
-rw-r--r--pylint/checkers/classes/class_checker.py3
-rw-r--r--pylint/checkers/format.py2
-rw-r--r--pylint/checkers/imports.py1
-rw-r--r--pylint/checkers/refactoring/refactoring_checker.py1
-rw-r--r--pylint/checkers/similar.py1
-rw-r--r--pylint/checkers/spelling.py1
-rw-r--r--pylint/checkers/stdlib.py1
-rw-r--r--pylint/checkers/strings.py3
-rw-r--r--pylint/checkers/typecheck.py5
-rw-r--r--pylint/checkers/utils.py4
-rw-r--r--pylint/checkers/variables.py6
-rw-r--r--pylint/lint/expand_modules.py1
-rw-r--r--pylint/lint/run.py1
-rw-r--r--pylint/testutils/output_line.py1
-rw-r--r--pylint/utils/ast_walker.py1
16 files changed, 28 insertions, 5 deletions
diff --git a/pylint/checkers/base/basic_checker.py b/pylint/checkers/base/basic_checker.py
index 01caa0770..fcc980d22 100644
--- a/pylint/checkers/base/basic_checker.py
+++ b/pylint/checkers/base/basic_checker.py
@@ -104,6 +104,7 @@ def report_by_type_stats(
sect.append(reporter_nodes.Table(children=lines, cols=6, rheaders=1))
+# pylint: disable-next = too-many-public-methods
class BasicChecker(_BasicChecker):
"""Basic checker.
diff --git a/pylint/checkers/classes/class_checker.py b/pylint/checkers/classes/class_checker.py
index 25fc0014d..cf2fc39e2 100644
--- a/pylint/checkers/classes/class_checker.py
+++ b/pylint/checkers/classes/class_checker.py
@@ -1150,6 +1150,7 @@ a metaclass class method.",
"attribute-defined-outside-init", args=attr, node=node
)
+ # pylint: disable = too-many-branches
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
"""Check method arguments, overriding."""
# ignore actual functions
@@ -1218,6 +1219,7 @@ a metaclass class method.",
pass
# check if the method is hidden by an attribute
+ # pylint: disable = too-many-try-statements
try:
overridden = klass.instance_attr(node.name)[0]
overridden_frame = overridden.frame(future=True)
@@ -2063,6 +2065,7 @@ a metaclass class method.",
and expr.expr.func.name == "super"
):
return
+ # pylint: disable = too-many-try-statements
try:
for klass in expr.expr.infer():
if klass is astroid.Uninferable:
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py
index 001330b2b..562c48f5d 100644
--- a/pylint/checkers/format.py
+++ b/pylint/checkers/format.py
@@ -275,7 +275,7 @@ class FormatChecker(BaseTokenChecker, BaseRawFileChecker):
def process_module(self, node: nodes.Module) -> None:
pass
- # pylint: disable-next=too-many-return-statements
+ # pylint: disable-next = too-many-return-statements, too-many-branches
def _check_keyword_parentheses(
self, tokens: list[tokenize.TokenInfo], start: int
) -> None:
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py
index 653bd85c9..a66400441 100644
--- a/pylint/checkers/imports.py
+++ b/pylint/checkers/imports.py
@@ -737,6 +737,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker):
imports = [import_node for (import_node, _) in imports]
return any(astroid.are_exclusive(import_node, node) for import_node in imports)
+ # pylint: disable = too-many-statements
def _check_imports_order(
self, _module_node: nodes.Module
) -> tuple[
diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py
index f6db3419f..0d51784ae 100644
--- a/pylint/checkers/refactoring/refactoring_checker.py
+++ b/pylint/checkers/refactoring/refactoring_checker.py
@@ -854,6 +854,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
self._check_consider_get(node)
self._check_consider_using_min_max_builtin(node)
+ # pylint: disable = too-many-branches
def _check_consider_using_min_max_builtin(self, node: nodes.If) -> None:
"""Check if the given if node can be refactored as a min/max python builtin."""
if self._is_actual_elif(node) or node.orelse:
diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py
index 69b0677bd..bc485a981 100644
--- a/pylint/checkers/similar.py
+++ b/pylint/checkers/similar.py
@@ -474,6 +474,7 @@ class Similar:
)
return report
+ # pylint: disable = too-many-locals
def _find_common(
self, lineset1: LineSet, lineset2: LineSet
) -> Generator[Commonality, None, None]:
diff --git a/pylint/checkers/spelling.py b/pylint/checkers/spelling.py
index 7b0db655f..61229ddca 100644
--- a/pylint/checkers/spelling.py
+++ b/pylint/checkers/spelling.py
@@ -340,6 +340,7 @@ class SpellingChecker(BaseTokenChecker):
)
self.initialized = True
+ # pylint: disable = too-many-statements
def _check_spelling(self, msgid: str, line: str, line_num: int) -> None:
original_line = line
try:
diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py
index 88a61a119..c9bec3823 100644
--- a/pylint/checkers/stdlib.py
+++ b/pylint/checkers/stdlib.py
@@ -605,6 +605,7 @@ class StdlibChecker(DeprecatedMixin, BaseChecker):
lru_cache_nodes: list[nodes.NodeNG] = []
for d_node in node.decorators.nodes:
+ # pylint: disable = too-many-try-statements
try:
for infered_node in d_node.infer():
q_name = infered_node.qname()
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py
index 4afe32a16..d5be5aa53 100644
--- a/pylint/checkers/strings.py
+++ b/pylint/checkers/strings.py
@@ -247,7 +247,7 @@ class StringFormatChecker(BaseChecker):
name = "string"
msgs = MSGS
- # pylint: disable=too-many-branches
+ # pylint: disable = too-many-branches, too-many-locals, too-many-statements
@only_required_for_messages(
"bad-format-character",
"truncated-format-string",
@@ -533,6 +533,7 @@ class StringFormatChecker(BaseChecker):
self._detect_vacuous_formatting(node, positional_arguments)
self._check_new_format_specifiers(node, fields, named_arguments)
+ # pylint: disable = too-many-statements
def _check_new_format_specifiers(
self,
node: nodes.Call,
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py
index c19056284..bfd415923 100644
--- a/pylint/checkers/typecheck.py
+++ b/pylint/checkers/typecheck.py
@@ -440,7 +440,7 @@ def _emit_no_member(
AttributeError, Exception or bare except.
* The node is guarded behind and `IF` or `IFExp` node
"""
- # pylint: disable=too-many-return-statements
+ # pylint: disable = too-many-return-statements, too-many-branches
if node_ignores_exception(node, AttributeError):
return False
if ignored_none and isinstance(owner, nodes.Const) and owner.value is None:
@@ -1035,6 +1035,7 @@ accessed. Python regular expressions are accepted.",
def visit_delattr(self, node: nodes.DelAttr) -> None:
self.visit_attribute(node)
+ # pylint: disable = too-many-branches
@only_required_for_messages("no-member", "c-extension-no-member")
def visit_attribute(
self, node: nodes.Attribute | nodes.AssignAttr | nodes.DelAttr
@@ -1399,7 +1400,7 @@ accessed. Python regular expressions are accepted.",
if _is_invalid_isinstance_type(second_arg):
self.add_message("isinstance-second-argument-not-valid-type", node=node)
- # pylint: disable=too-many-branches,too-many-locals
+ # pylint: disable = too-many-branches, too-many-locals, too-many-statements
def visit_call(self, node: nodes.Call) -> None:
"""Check that called functions/methods are inferred to callable objects,
and that passed arguments match the parameters in the inferred function.
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index 337e34ad6..52ef2d274 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -303,6 +303,7 @@ def is_defined_in_scope(
return defnode_in_scope(var_node, varname, scope) is not None
+# pylint: disable = too-many-branches
def defnode_in_scope(
var_node: nodes.NodeNG,
varname: str,
@@ -627,6 +628,7 @@ def collect_string_fields(format_string: str) -> Iterable[str | None]:
It handles nested fields as well.
"""
formatter = string.Formatter()
+ # pylint: disable = too-many-try-statements
try:
parseiterator = formatter.parse(format_string)
for result in parseiterator:
@@ -1374,6 +1376,7 @@ def safe_infer(
if value is not astroid.Uninferable:
inferred_types.add(_get_python_type_of_node(value))
+ # pylint: disable = too-many-try-statements
try:
for inferred in infer_gen:
inferred_type = _get_python_type_of_node(inferred)
@@ -2050,6 +2053,7 @@ def is_hashable(node: nodes.NodeNG) -> bool:
When finding ambiguity, return True.
"""
+ # pylint: disable = too-many-try-statements
try:
for inferred in node.infer():
if inferred is astroid.Uninferable or isinstance(inferred, nodes.ClassDef):
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index 0019cec7a..583f41094 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -1661,7 +1661,7 @@ class VariablesChecker(BaseChecker):
return False
- # pylint: disable=too-many-return-statements
+ # pylint: disable = too-many-return-statements, too-many-branches
def _check_consumer(
self,
node: nodes.Name,
@@ -2025,6 +2025,7 @@ class VariablesChecker(BaseChecker):
parent = parent.parent
return False
+ # pylint: disable = too-many-statements, too-many-branches
@staticmethod
def _is_variable_violation(
node: nodes.Name,
@@ -2402,6 +2403,7 @@ class VariablesChecker(BaseChecker):
and name in frame_locals
)
+ # pylint: disable = too-many-branches
def _loopvar_name(self, node: astroid.Name) -> None:
# filter variables according to node's scope
astmts = [s for s in node.lookup(node.name)[1] if hasattr(s, "assign_type")]
@@ -2546,6 +2548,7 @@ class VariablesChecker(BaseChecker):
if not elements:
self.add_message("undefined-loop-variable", args=node.name, node=node)
+ # pylint: disable = too-many-branches
def _check_is_unused(
self,
name: str,
@@ -3011,6 +3014,7 @@ class VariablesChecker(BaseChecker):
for node in node_lst:
self.add_message("unused-variable", args=(name,), node=node)
+ # pylint: disable = too-many-branches
def _check_imports(self, not_consumed: dict[str, list[nodes.NodeNG]]) -> None:
local_names = _fix_dot_imports(not_consumed)
checked = set()
diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py
index e43208dea..8259e25ad 100644
--- a/pylint/lint/expand_modules.py
+++ b/pylint/lint/expand_modules.py
@@ -61,6 +61,7 @@ def _is_ignored_file(
)
+# pylint: disable = too-many-locals, too-many-statements
def expand_modules(
files_or_modules: Sequence[str],
ignore_list: list[str],
diff --git a/pylint/lint/run.py b/pylint/lint/run.py
index 1f54670ef..a753f7868 100644
--- a/pylint/lint/run.py
+++ b/pylint/lint/run.py
@@ -115,6 +115,7 @@ group are mutually exclusive.",
Used by _PylintConfigRun to make the 'pylint-config' command work.
"""
+ # pylint: disable = too-many-statements, too-many-branches
def __init__(
self,
args: Sequence[str],
diff --git a/pylint/testutils/output_line.py b/pylint/testutils/output_line.py
index a2c417621..7465fce9d 100644
--- a/pylint/testutils/output_line.py
+++ b/pylint/testutils/output_line.py
@@ -90,6 +90,7 @@ class OutputLine(NamedTuple):
if isinstance(row, str):
row = row.split(",")
# noinspection PyBroadException
+ # pylint: disable = too-many-try-statements
try:
column = cls._get_column(row[2])
if len(row) == 5:
diff --git a/pylint/utils/ast_walker.py b/pylint/utils/ast_walker.py
index 4d552d995..cf0f13fd1 100644
--- a/pylint/utils/ast_walker.py
+++ b/pylint/utils/ast_walker.py
@@ -82,6 +82,7 @@ class ASTWalker:
visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
+ # pylint: disable = too-many-try-statements
try:
if astroid.is_statement:
self.nbstatements += 1