diff --git a/pylint/checkers/__init__.py b/pylint/checkers/__init__.py index 24ad8ca99a..95a18a329b 100644 --- a/pylint/checkers/__init__.py +++ b/pylint/checkers/__init__.py @@ -71,7 +71,7 @@ def table_lines_from_stats(stats, old_stats, columns): def initialize(linter): - """initialize linter with checkers in this package """ + """initialize linter with checkers in this package""" register_plugins(linter, __path__[0]) diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index 772a5b36cf..b939b33000 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -1502,7 +1502,7 @@ def _check_not_in_finally(self, node, node_name, breaker_classes=()): _parent = _node.parent def _check_reversed(self, node): - """ check that the argument to `reversed` is a sequence """ + """check that the argument to `reversed` is a sequence""" try: argument = utils.safe_infer(utils.get_argument_from_call(node, position=0)) except utils.NoSuchArgumentError: diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 66825d4493..5c1ae964f4 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -2145,6 +2145,6 @@ def _ancestors_to_call(klass_node, method="__init__"): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(ClassChecker(linter)) linter.register_checker(SpecialMethodsChecker(linter)) diff --git a/pylint/checkers/design_analysis.py b/pylint/checkers/design_analysis.py index bdb35437c5..da51cf70ca 100644 --- a/pylint/checkers/design_analysis.py +++ b/pylint/checkers/design_analysis.py @@ -498,5 +498,5 @@ def _inc_branch(self, node, branchesnum=1): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(MisdesignChecker(linter)) diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py index d83bc55a93..9a46626070 100644 --- a/pylint/checkers/format.py +++ b/pylint/checkers/format.py @@ -796,5 +796,5 @@ def check_indent_level(self, string, expected, line_num): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(FormatChecker(linter)) diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index a9f03545c9..03ba231cba 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -984,5 +984,5 @@ def _check_toplevel(self, node): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(ImportsChecker(linter)) diff --git a/pylint/checkers/mapreduce_checker.py b/pylint/checkers/mapreduce_checker.py index 65b12c31de..d039fcda50 100644 --- a/pylint/checkers/mapreduce_checker.py +++ b/pylint/checkers/mapreduce_checker.py @@ -7,13 +7,13 @@ class MapReduceMixin(metaclass=abc.ABCMeta): - """ A mixin design to allow multiprocess/threaded runs of a Checker """ + """A mixin design to allow multiprocess/threaded runs of a Checker""" @abc.abstractmethod def get_map_data(self): - """ Returns mergable/reducible data that will be examined """ + """Returns mergable/reducible data that will be examined""" @classmethod @abc.abstractmethod def reduce_map_data(cls, linter, data): - """ For a given Checker, receives data for all mapped runs """ + """For a given Checker, receives data for all mapped runs""" diff --git a/pylint/checkers/newstyle.py b/pylint/checkers/newstyle.py index 49eebadeb5..7ae6230479 100644 --- a/pylint/checkers/newstyle.py +++ b/pylint/checkers/newstyle.py @@ -130,5 +130,5 @@ def visit_functiondef(self, node): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(NewStyleConflictChecker(linter)) diff --git a/pylint/checkers/python3.py b/pylint/checkers/python3.py index 935a6ac972..d5dd68de34 100644 --- a/pylint/checkers/python3.py +++ b/pylint/checkers/python3.py @@ -1256,7 +1256,7 @@ def _validate_encoding(self, encoding, node): @utils.check_messages("indexing-exception") def visit_subscript(self, node): - """ Look for indexing exceptions. """ + """Look for indexing exceptions.""" try: for inferred in node.value.infer(): if not isinstance(inferred, astroid.Instance): diff --git a/pylint/checkers/raw_metrics.py b/pylint/checkers/raw_metrics.py index 5878da737a..6f8d2d9b85 100644 --- a/pylint/checkers/raw_metrics.py +++ b/pylint/checkers/raw_metrics.py @@ -117,5 +117,5 @@ def get_type(tokens, start_index): def register(linter): - """ required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(RawMetricsChecker(linter)) diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 8f6ae11a0b..a8bf609ca5 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -425,7 +425,7 @@ def close(self): stats["percent_duplicated_lines"] = total and duplicated * 100.0 / total def get_map_data(self): - """ Passthru override """ + """Passthru override""" return Similar.get_map_data(self) @classmethod @@ -440,7 +440,7 @@ def reduce_map_data(cls, linter, data): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(SimilarChecker(linter)) diff --git a/pylint/checkers/spelling.py b/pylint/checkers/spelling.py index dfa1d7738c..7bd9760452 100644 --- a/pylint/checkers/spelling.py +++ b/pylint/checkers/spelling.py @@ -467,5 +467,5 @@ def _check_docstring(self, node): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(SpellingChecker(linter)) diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index 2a2d269933..c28f62bd8c 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -512,5 +512,5 @@ def deprecated_arguments(self, method: str): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(StdlibChecker(linter)) diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py index 5268ea54bb..5026f9d74e 100644 --- a/pylint/checkers/strings.py +++ b/pylint/checkers/strings.py @@ -441,7 +441,7 @@ def _detect_vacuous_formatting(self, node, positional_arguments): ) def _check_new_format(self, node, func): - """Check the new string formatting. """ + """Check the new string formatting.""" # Skip format nodes which don't have an explicit string on the # left side of the format operation. # We do this because our inference engine can't properly handle @@ -888,7 +888,7 @@ def process_non_raw_string_token( def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(StringFormatChecker(linter)) linter.register_checker(StringConstantChecker(linter)) diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index f058921524..66bd8320f3 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -1950,6 +1950,6 @@ def visit_generatorexp(self, node): def register(linter): - """required method to auto register this checker """ + """required method to auto register this checker""" linter.register_checker(TypeChecker(linter)) linter.register_checker(IterableChecker(linter)) diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 86a65c6da0..6c11eeb9d9 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -776,7 +776,7 @@ def stringify_error(error): def decorated_with_property(node: astroid.FunctionDef) -> bool: - """Detect if the given function node is decorated with a property. """ + """Detect if the given function node is decorated with a property.""" if not node.decorators: return False for decorator in node.decorators.nodes: diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index de5075af7b..6f262925dc 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -2081,7 +2081,7 @@ def _check_imports(self, not_consumed): del self._to_consume def _check_metaclasses(self, node): - """ Update consumption analysis for metaclasses. """ + """Update consumption analysis for metaclasses.""" consumed = [] # [(scope_locals, consumed_key)] for child_node in node.get_children(): diff --git a/pylint/config/option_manager_mixin.py b/pylint/config/option_manager_mixin.py index f8625aa560..155886ed75 100644 --- a/pylint/config/option_manager_mixin.py +++ b/pylint/config/option_manager_mixin.py @@ -347,7 +347,7 @@ def load_command_line_configuration(self, args=None): return args def add_help_section(self, title, description, level=0): - """add a dummy option section for help purpose """ + """add a dummy option section for help purpose""" group = optparse.OptionGroup( self.cmdline_parser, title=title.capitalize(), description=description ) @@ -356,7 +356,7 @@ def add_help_section(self, title, description, level=0): self.cmdline_parser.add_option_group(group) def help(self, level=0): - """return the usage string for available options """ + """return the usage string for available options""" self.cmdline_parser.formatter.output_level = level with _patch_optparse(): return self.cmdline_parser.format_help() diff --git a/pylint/extensions/empty_comment.py b/pylint/extensions/empty_comment.py index ab4a039399..a6f2ede75c 100644 --- a/pylint/extensions/empty_comment.py +++ b/pylint/extensions/empty_comment.py @@ -3,7 +3,7 @@ def is_line_commented(line): - """ Checks if a `# symbol that is not part of a string was found in line""" + """Checks if a `# symbol that is not part of a string was found in line""" comment_idx = line.find(b"#") if comment_idx == -1: @@ -14,7 +14,7 @@ def is_line_commented(line): def comment_part_of_string(line, comment_idx): - """ checks if the symbol at comment_idx is part of a string """ + """checks if the symbol at comment_idx is part of a string""" if ( line[:comment_idx].count(b"'") % 2 == 1 diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py index 9b666f06ce..4433575c02 100644 --- a/pylint/lint/parallel.py +++ b/pylint/lint/parallel.py @@ -89,7 +89,7 @@ def _worker_check_single_file(file_item): def _merge_mapreduce_data(linter, all_mapreduce_data): - """ Merges map/reduce data across workers, invoking relevant APIs on checkers """ + """Merges map/reduce data across workers, invoking relevant APIs on checkers""" # First collate the data, preparing it so we can send it to the checkers for # validation. The intent here is to collect all the mapreduce data for all checker- # runs across processes - that will then be passed to a static method on the diff --git a/pylint/message/message_definition_store.py b/pylint/message/message_definition_store.py index 417c2ac4fe..7b01a0bc43 100644 --- a/pylint/message/message_definition_store.py +++ b/pylint/message/message_definition_store.py @@ -58,7 +58,7 @@ def get_message_definitions(self, msgid_or_symbol: str) -> list: ] def get_msg_display_string(self, msgid_or_symbol: str): - """Generates a user-consumable representation of a message. """ + """Generates a user-consumable representation of a message.""" message_definitions = self.get_message_definitions(msgid_or_symbol) if len(message_definitions) == 1: return repr(message_definitions[0].symbol) @@ -79,7 +79,7 @@ def help_message(self, msgids_or_symbols: list): continue def list_messages(self): - """Output full messages list documentation in ReST format. """ + """Output full messages list documentation in ReST format.""" messages = sorted(self._messages_definitions.values(), key=lambda m: m.msgid) for message in messages: if not message.may_be_emitted(): diff --git a/pylint/reporters/__init__.py b/pylint/reporters/__init__.py index 5db03d1ee3..ef20f2fec7 100644 --- a/pylint/reporters/__init__.py +++ b/pylint/reporters/__init__.py @@ -29,7 +29,7 @@ def initialize(linter): - """initialize linter with reporters in this package """ + """initialize linter with reporters in this package""" utils.register_plugins(linter, __path__[0]) diff --git a/pylint/testutils/reporter_for_tests.py b/pylint/testutils/reporter_for_tests.py index 70cb8a8432..1cb4b4a590 100644 --- a/pylint/testutils/reporter_for_tests.py +++ b/pylint/testutils/reporter_for_tests.py @@ -24,7 +24,7 @@ def reset(self): self.messages = [] def handle_message(self, msg): - """manage message of different type and in the context of path """ + """manage message of different type and in the context of path""" obj = msg.obj line = msg.line msg_id = msg.msg_id diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py index 368f376dea..df671dbf2a 100644 --- a/tests/benchmark/test_baseline_benchmarks.py +++ b/tests/benchmark/test_baseline_benchmarks.py @@ -82,7 +82,7 @@ def process_module(self, _astroid): class NoWorkChecker(BaseChecker): - """ A checker that sleeps, the wall-clock time should change as we add threads """ + """A checker that sleeps, the wall-clock time should change as we add threads""" __implements__ = (pylint.interfaces.IRawChecker,) @@ -159,7 +159,7 @@ def test_baseline_benchmark_j10(self, benchmark): ) def test_baseline_benchmark_check_parallel_j10(self, benchmark): - """ Should demonstrate times very close to `test_baseline_benchmark_j10` """ + """Should demonstrate times very close to `test_baseline_benchmark_j10`""" linter = PyLinter(reporter=Reporter()) # Create file per worker, using all workers diff --git a/tests/checkers/unittest_variables.py b/tests/checkers/unittest_variables.py index 65ab22f3ce..f294630d99 100644 --- a/tests/checkers/unittest_variables.py +++ b/tests/checkers/unittest_variables.py @@ -36,7 +36,7 @@ class TestVariablesChecker(CheckerTestCase): CHECKER_CLASS = variables.VariablesChecker def test_bitbucket_issue_78(self): - """ Issue 78 report a false positive for unused-module """ + """Issue 78 report a false positive for unused-module""" module = astroid.parse( """ from sys import path @@ -205,7 +205,7 @@ def teardown_method(self): @set_config(callbacks=("callback_", "_callback")) def test_custom_callback_string(self): - """ Test the --calbacks option works. """ + """Test the --calbacks option works.""" node = astroid.extract_node( """ def callback_one(abc): diff --git a/tests/message/unittest_message_definition_store.py b/tests/message/unittest_message_definition_store.py index bb65b3fdf8..b240af9ac9 100644 --- a/tests/message/unittest_message_definition_store.py +++ b/tests/message/unittest_message_definition_store.py @@ -237,7 +237,7 @@ def test_renamed_message_register(store): def test_multiple_child_of_old_name(store): - """ We can define multiple name with the same old name. """ + """We can define multiple name with the same old name.""" class FamillyChecker(BaseChecker): name = "famillychecker" diff --git a/tests/profile/test_profile_against_externals.py b/tests/profile/test_profile_against_externals.py index 430014abc0..42cbbf7fd9 100644 --- a/tests/profile/test_profile_against_externals.py +++ b/tests/profile/test_profile_against_externals.py @@ -40,7 +40,7 @@ def _get_py_files(scanpath): "name,git_repo", [("numpy", "https://github.com/numpy/numpy.git")] ) def test_run(tmp_path, name, git_repo): - """ Runs pylint against external sources """ + """Runs pylint against external sources""" checkoutdir = tmp_path / name checkoutdir.mkdir() os.system(f"git clone --depth=1 {git_repo} {checkoutdir}") diff --git a/tests/test_self.py b/tests/test_self.py index 59f302e9ab..7f0fa4d39e 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -287,7 +287,7 @@ def test_parallel_execution(self): ) def test_parallel_execution_bug_2674(self): - """ Tests that disabling absolute imports works the same in -j1/j2 """ + """Tests that disabling absolute imports works the same in -j1/j2""" expected_ret_code = 0 # we are disabling the check, should pass for jobs in (1, 2): self._runtest(