summaryrefslogtreecommitdiff
path: root/pylint/checkers
diff options
context:
space:
mode:
authorOllie <46904826+ollie-iterators@users.noreply.github.com>2023-02-25 16:12:29 -0500
committerGitHub <noreply@github.com>2023-02-25 22:12:29 +0100
commit02030cf52dbbed3a8bb7c14c4d6158427635cee5 (patch)
tree5c1006b9695be3a05870070c30f55784172e068a /pylint/checkers
parentc785e3edb82683e50d5d370c1c4e992ebda036a0 (diff)
downloadpylint-git-02030cf52dbbed3a8bb7c14c4d6158427635cee5.tar.gz
Fixing some too long lines (#8339)
* Changing flake8 max-line-length to 120 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/checkers')
-rw-r--r--pylint/checkers/base/name_checker/naming_style.py5
-rw-r--r--pylint/checkers/classes/class_checker.py6
-rw-r--r--pylint/checkers/refactoring/refactoring_checker.py26
-rw-r--r--pylint/checkers/similar.py6
-rw-r--r--pylint/checkers/unicode.py5
5 files changed, 31 insertions, 17 deletions
diff --git a/pylint/checkers/base/name_checker/naming_style.py b/pylint/checkers/base/name_checker/naming_style.py
index 3b7833049..bfe6f77d3 100644
--- a/pylint/checkers/base/name_checker/naming_style.py
+++ b/pylint/checkers/base/name_checker/naming_style.py
@@ -149,7 +149,10 @@ def _create_naming_options() -> Options:
help_msg = f"Regular expression matching correct {human_readable_name} names. "
if name_type in KNOWN_NAME_TYPES_WITH_STYLE:
help_msg += f"Overrides {name_type_hyphened}-naming-style. "
- help_msg += f"If left empty, {human_readable_name} names will be checked with the set naming style."
+ help_msg += (
+ f"If left empty, {human_readable_name} names will be checked "
+ "with the set naming style."
+ )
# Add style option for names that support it
if name_type in KNOWN_NAME_TYPES_WITH_STYLE:
diff --git a/pylint/checkers/classes/class_checker.py b/pylint/checkers/classes/class_checker.py
index e66e543f2..fe29c9d60 100644
--- a/pylint/checkers/classes/class_checker.py
+++ b/pylint/checkers/classes/class_checker.py
@@ -958,7 +958,8 @@ a metaclass class method.",
):
continue
for child in node.nodes_of_class((nodes.Name, nodes.Attribute)):
- # Check for cases where the functions are used as a variable instead of as a method call
+ # Check for cases where the functions are used as a variable instead of as a
+ # method call
if isinstance(child, nodes.Name) and child.name == function_def.name:
break
if isinstance(child, nodes.Attribute):
@@ -1951,7 +1952,8 @@ a metaclass class method.",
return
self._first_attrs[-1] = None
elif "builtins.staticmethod" in node.decoratornames():
- # Check if there is a decorator which is not named `staticmethod` but is assigned to one.
+ # Check if there is a decorator which is not named `staticmethod`
+ # but is assigned to one.
return
# class / regular method with no args
elif not (
diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py
index 5aaedf794..b3e48f31e 100644
--- a/pylint/checkers/refactoring/refactoring_checker.py
+++ b/pylint/checkers/refactoring/refactoring_checker.py
@@ -460,8 +460,9 @@ class RefactoringChecker(checkers.BaseTokenChecker):
"R1732": (
"Consider using 'with' for resource-allocating operations",
"consider-using-with",
- "Emitted if a resource-allocating assignment or call may be replaced by a 'with' block. "
- "By using 'with' the release of the allocated resources is ensured even in the case of an exception.",
+ "Emitted if a resource-allocating assignment or call may be replaced by a 'with' block."
+ "By using 'with' the release of the allocated resources is ensured even in the case "
+ "of an exception.",
),
"R1733": (
"Unnecessary dictionary index lookup, use '%s' instead",
@@ -713,8 +714,9 @@ class RefactoringChecker(checkers.BaseTokenChecker):
for var, names in node.items:
if isinstance(var, nodes.Name):
for stack in self._consider_using_with_stack:
- # We don't need to restrict the stacks we search to the current scope and outer scopes,
- # as e.g. the function_scope stack will be empty when we check a ``with`` on the class level.
+ # We don't need to restrict the stacks we search to the current scope and
+ # outer scopes, as e.g. the function_scope stack will be empty when we
+ # check a ``with`` on the class level.
if var.name in stack:
del stack[var.name]
break
@@ -1118,7 +1120,8 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _check_quit_exit_call(self, node: nodes.Call) -> None:
if isinstance(node.func, nodes.Name) and node.func.name in BUILTIN_EXIT_FUNCS:
- # If we have `exit` imported from `sys` in the current or global scope, exempt this instance.
+ # If we have `exit` imported from `sys` in the current or global scope,
+ # exempt this instance.
local_scope = node.scope()
if self._has_exit_in_scope(local_scope) or self._has_exit_in_scope(
node.root()
@@ -1553,7 +1556,8 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _append_context_managers_to_stack(self, node: nodes.Assign) -> None:
if _is_inside_context_manager(node):
- # if we are inside a context manager itself, we assume that it will handle the resource management itself.
+ # if we are inside a context manager itself, we assume that it will handle
+ # the resource management itself.
return
if isinstance(node.targets[0], (nodes.Tuple, nodes.List, nodes.Set)):
assignees = node.targets[0].elts
@@ -1600,9 +1604,10 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _check_consider_using_with(self, node: nodes.Call) -> None:
if _is_inside_context_manager(node) or _is_a_return_statement(node):
- # If we are inside a context manager itself, we assume that it will handle the resource management itself.
- # If the node is a child of a return, we assume that the caller knows he is getting a context manager
- # he should use properly (i.e. in a ``with``).
+ # If we are inside a context manager itself, we assume that it will handle the
+ # resource management itself.
+ # If the node is a child of a return, we assume that the caller knows he is getting
+ # a context manager he should use properly (i.e. in a ``with``).
return
if (
node
@@ -1610,7 +1615,8 @@ class RefactoringChecker(checkers.BaseTokenChecker):
node.frame(future=True)
).values()
):
- # the result of this call was already assigned to a variable and will be checked when leaving the scope.
+ # the result of this call was already assigned to a variable and will be
+ # checked when leaving the scope.
return
inferred = utils.safe_infer(node.func)
if not inferred or not isinstance(
diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py
index bc485a981..2cfba16bf 100644
--- a/pylint/checkers/similar.py
+++ b/pylint/checkers/similar.py
@@ -377,7 +377,8 @@ class Similar:
raise ValueError
readlines = decoding_stream(stream, encoding).readlines
else:
- readlines = stream.readlines # type: ignore[assignment] # hint parameter is incorrectly typed as non-optional
+ # hint parameter is incorrectly typed as non-optional
+ readlines = stream.readlines # type: ignore[assignment]
try:
lines = readlines()
@@ -590,7 +591,8 @@ def stripped_lines(
:param ignore_docstrings: if true, any line that is a docstring is removed from the result
:param ignore_imports: if true, any line that is an import is removed from the result
:param ignore_signatures: if true, any line that is part of a function signature is removed from the result
- :param line_enabled_callback: If called with "R0801" and a line number, a return value of False will disregard the line
+ :param line_enabled_callback: If called with "R0801" and a line number, a return value of False will disregard
+ the line
:return: the collection of line/line number/line type tuples
"""
if ignore_imports or ignore_signatures:
diff --git a/pylint/checkers/unicode.py b/pylint/checkers/unicode.py
index 6d7b25395..3e2bccfa5 100644
--- a/pylint/checkers/unicode.py
+++ b/pylint/checkers/unicode.py
@@ -330,7 +330,7 @@ class UnicodeChecker(checkers.BaseRawFileChecker):
"For compatibility use UTF-8 instead of UTF-16/UTF-32. "
"See also https://bugs.python.org/issue1503789 for a history "
"of this issue. And "
- "https://softwareengineering.stackexchange.com/questions/102205/should-utf-16-be-considered-harmful "
+ "https://softwareengineering.stackexchange.com/questions/102205/"
"for some possible problems when using UTF-16 for instance."
),
),
@@ -347,7 +347,8 @@ class UnicodeChecker(checkers.BaseRawFileChecker):
"So can you trust this code? "
"Are you sure it displayed correctly in all editors? "
"If you did not write it or your language is not RTL,"
- " remove the special characters, as they could be used to trick you into executing code, "
+ " remove the special characters, as they could be used to trick you into "
+ "executing code, "
"that does something else than what it looks like.\n"
"More Information:\n"
"https://en.wikipedia.org/wiki/Bidirectional_text\n"