diff --git a/examples/deprecation_checker.py b/examples/deprecation_checker.py index 6fb21eedd5..228b7bdadc 100644 --- a/examples/deprecation_checker.py +++ b/examples/deprecation_checker.py @@ -52,9 +52,9 @@ class DeprecationChecker(DeprecatedMixin, BaseChecker): """Class implementing deprecation checker.""" # DeprecatedMixin class is Mixin class implementing logic for searching deprecated methods and functions. - # The list of deprecated methods/functions is defined by the implementing class via deprecated_methods callback. - # DeprecatedMixin class is overriding attributes of BaseChecker hence must be specified *before* BaseChecker - # in list of base classes. + # The list of deprecated methods/functions is defined by the implementing class via + # deprecated_methods callback. DeprecatedMixin class is overriding attributes of BaseChecker hence must + # be specified *before* BaseChecker in list of base classes. # The name defines a custom section of the config for this checker. name = "deprecated" diff --git a/pylint/checkers/base/basic_checker.py b/pylint/checkers/base/basic_checker.py index 5362416fa6..2a657af777 100644 --- a/pylint/checkers/base/basic_checker.py +++ b/pylint/checkers/base/basic_checker.py @@ -212,7 +212,8 @@ class BasicChecker(_BasicChecker): "the user intended to do.", ), "W0126": ( - "Using a conditional statement with potentially wrong function or method call due to missing parentheses", + "Using a conditional statement with potentially wrong function or method call due to " + "missing parentheses", "missing-parentheses-for-call-in-test", "Emitted when a conditional statement (If or ternary if) " "seems to wrongly call a function due to missing parentheses", diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 357cc702ef..6c35dc65fc 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -1812,7 +1812,9 @@ def get_import_name(importnode: ImportNode, modname: str | None) -> str | None: root = importnode.root() if isinstance(root, nodes.Module): try: - return root.relative_to_absolute_name(modname, level=importnode.level) # type: ignore[no-any-return] + return root.relative_to_absolute_name( # type: ignore[no-any-return] + modname, level=importnode.level + ) except TooManyLevelsError: return modname return modname diff --git a/pylint/config/arguments_provider.py b/pylint/config/arguments_provider.py index ea229e1c33..f5aac2f1dc 100644 --- a/pylint/config/arguments_provider.py +++ b/pylint/config/arguments_provider.py @@ -64,8 +64,9 @@ def level(self) -> int: def level(self, value: int) -> None: # TODO: 3.0: Remove deprecated attribute warnings.warn( - "Setting the level attribute has been deprecated. It was used to display the checker in the help or not," - " and everything is displayed in the help now. It will be removed in pylint 3.0.", + "Setting the level attribute has been deprecated. It was used to display the checker " + "in the help or not, and everything is displayed in the help now. It will be removed " + "in pylint 3.0.", DeprecationWarning, stacklevel=2, ) diff --git a/pylint/config/config_initialization.py b/pylint/config/config_initialization.py index d26f0e8c58..847501a73b 100644 --- a/pylint/config/config_initialization.py +++ b/pylint/config/config_initialization.py @@ -110,7 +110,8 @@ def _config_initialization( # load plugin specific configuration. linter.load_plugin_configuration() - # Now that plugins are loaded, get list of all fail_on messages, and enable them + # Now that plugins are loaded, get list of all fail_on messages, and + # enable them linter.enable_fail_on_messages() linter._parse_error_mode() diff --git a/pylint/extensions/confusing_elif.py b/pylint/extensions/confusing_elif.py index d16d6c60a9..ada8b5ab13 100644 --- a/pylint/extensions/confusing_elif.py +++ b/pylint/extensions/confusing_elif.py @@ -28,7 +28,8 @@ class ConfusingConsecutiveElifChecker(BaseChecker): "confusing-consecutive-elif", "Used when an elif statement follows right after an indented block which itself ends with if or elif. " "It may not be ovious if the elif statement was willingly or mistakenly unindented. " - "Extracting the indented if statement into a separate function might avoid confusion and prevent errors.", + "Extracting the indented if statement into a separate function might avoid confusion and prevent " + "errors.", ) } diff --git a/pylint/extensions/typing.py b/pylint/extensions/typing.py index 1cf7ec10cc..264d0c3830 100644 --- a/pylint/extensions/typing.py +++ b/pylint/extensions/typing.py @@ -127,7 +127,8 @@ class TypingChecker(BaseChecker): "R6006": ( "Type `%s` is used more than once in union type annotation. Remove redundant typehints.", "redundant-typehint-argument", - "Duplicated type arguments will be skipped by `mypy` tool, therefore should be removed to avoid confusion.", + "Duplicated type arguments will be skipped by `mypy` tool, therefore should be " + "removed to avoid confusion.", ), } options = ( diff --git a/pylint/lint/run.py b/pylint/lint/run.py index a753f7868c..2232c41a3e 100644 --- a/pylint/lint/run.py +++ b/pylint/lint/run.py @@ -56,7 +56,8 @@ def _query_cpu() -> int | None: ): with open("/sys/fs/cgroup/cpu/cpu.cfs_period_us", encoding="utf-8") as file: cpu_period = int(file.read().rstrip()) - # Divide quota by period and you should get num of allotted CPU to the container, rounded down if fractional. + # Divide quota by period and you should get num of allotted CPU to the container, + # rounded down if fractional. avail_cpu = int(cpu_quota / cpu_period) elif Path("/sys/fs/cgroup/cpu/cpu.shares").is_file(): with open("/sys/fs/cgroup/cpu/cpu.shares", encoding="utf-8") as file: diff --git a/pylint/reporters/text.py b/pylint/reporters/text.py index 168bb14962..c25b31f7ed 100644 --- a/pylint/reporters/text.py +++ b/pylint/reporters/text.py @@ -133,7 +133,8 @@ def colorize_ansi( # TODO: 3.0: Remove deprecated typing and only accept MessageStyle as parameter if not isinstance(msg_style, MessageStyle): warnings.warn( - "In pylint 3.0, the colorize_ansi function of Text reporters will only accept a MessageStyle parameter", + "In pylint 3.0, the colorize_ansi function of Text reporters will only accept a " + "MessageStyle parameter", DeprecationWarning, stacklevel=2, ) @@ -279,7 +280,8 @@ def __init__( list(color_mapping.values())[0], MessageStyle ): warnings.warn( - "In pylint 3.0, the ColorizedTextReporter will only accept ColorMappingDict as color_mapping parameter", + "In pylint 3.0, the ColorizedTextReporter will only accept ColorMappingDict as " + "color_mapping parameter", DeprecationWarning, stacklevel=2, ) diff --git a/pylint/testutils/_primer/primer_compare_command.py b/pylint/testutils/_primer/primer_compare_command.py index 442ffa227a..acc1c9562e 100644 --- a/pylint/testutils/_primer/primer_compare_command.py +++ b/pylint/testutils/_primer/primer_compare_command.py @@ -128,7 +128,10 @@ def _create_comment_for_package( assert not self.packages[package].url.endswith( ".git" ), "You don't need the .git at the end of the github url." - comment += f"{self.packages[package].url}/blob/{new_messages['commit']}/{filepath}#L{message['line']}\n" + comment += ( + f"{self.packages[package].url}" + f"/blob/{new_messages['commit']}/{filepath}#L{message['line']}\n" + ) count += 1 print(message) if missing_messages: diff --git a/pylint/testutils/lint_module_test.py b/pylint/testutils/lint_module_test.py index fec0074d54..e139af12bc 100644 --- a/pylint/testutils/lint_module_test.py +++ b/pylint/testutils/lint_module_test.py @@ -23,7 +23,9 @@ from pylint.lint import PyLinter from pylint.message.message import Message from pylint.testutils.constants import _EXPECTED_RE, _OPERATORS, UPDATE_OPTION -from pylint.testutils.functional.test_file import ( # need to import from functional.test_file to avoid cyclic import + +# need to import from functional.test_file to avoid cyclic import +from pylint.testutils.functional.test_file import ( FunctionalTestFile, NoFileError, parse_python_version, diff --git a/setup.cfg b/setup.cfg index 80fced5a21..1f188de83b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ ignore = B028, # Flake8 is less lenient than pylint and does not make any exceptions # (for docstrings, strings and comments in particular). -max-line-length=120 +max-line-length=115 # Required for flake8-typing-imports (v1.12.0) # The plugin doesn't yet read the value from pyproject.toml min_python_version = 3.7.2 diff --git a/tests/message/unittest_message_definition_store.py b/tests/message/unittest_message_definition_store.py index d36b1b42a9..eb323a2e6a 100644 --- a/tests/message/unittest_message_definition_store.py +++ b/tests/message/unittest_message_definition_store.py @@ -26,7 +26,8 @@ "W1234": ("message one", "msg-symbol-one", "msg description"), "W4321": ("message two", "msg-symbol-two", "msg description"), }, - r"Inconsistent checker part in message id 'W4321' (expected 'x12xx' because we already had ['W1234']).", + r"Inconsistent checker part in message id 'W4321' (expected 'x12xx' because we" + r" already had ['W1234']).", ), ( {