diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bced0703..ce6973d9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ fail_fast: true repos: - repo: git://github.com/pre-commit/pre-commit-hooks - rev: v3.1.0 + rev: v4.0.1 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -9,13 +9,13 @@ repos: - id: fix-encoding-pragma - id: check-added-large-files - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 21.7b0 hooks: - id: black args: - --exclude=/(tests)/ - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.2 + rev: 3.9.2 hooks: - id: flake8 args: diff --git a/docs/conf.py b/docs/conf.py index 76515309..a9198ba9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -151,8 +151,20 @@ # Custom sidebar templates, maps document names to template names. html_sidebars = { - "index": ["slim_searchbox.html", "sidebarintro.html", "globaltoc.html", "links.html", "sourcelink.html",], - "**": ["slim_searchbox.html", "globaltoc.html", "relations.html", "links.html", "sourcelink.html",], + "index": [ + "slim_searchbox.html", + "sidebarintro.html", + "globaltoc.html", + "links.html", + "sourcelink.html", + ], + "**": [ + "slim_searchbox.html", + "globaltoc.html", + "relations.html", + "links.html", + "sourcelink.html", + ], } # Additional templates that should be rendered to pages, maps page names to diff --git a/prospector/blender.py b/prospector/blender.py index 5c9f7e59..654255b3 100644 --- a/prospector/blender.py +++ b/prospector/blender.py @@ -54,7 +54,11 @@ def blend_line(messages, blend_combos=None): for blend_combo_idx, blend_list in enumerate(blend_lists): if len(blend_list) == 0: continue - blend_list.sort(key=lambda msg: blend_combos[blend_combo_idx].index((msg.source, msg.code),),) + blend_list.sort( + key=lambda msg: blend_combos[blend_combo_idx].index( + (msg.source, msg.code), + ), + ) if blend_list[0] not in blended: # We may have already added this message if it represents # several messages in other tools which are not being run - @@ -81,7 +85,9 @@ def blend(messages, blend_combos=None): msgs_grouped = defaultdict(lambda: defaultdict(list)) for message in messages: - msgs_grouped[message.location.path][message.location.line].append(message,) + msgs_grouped[message.location.path][message.location.line].append( + message, + ) # now blend together all messages on the same line out = [] diff --git a/prospector/config/configuration.py b/prospector/config/configuration.py index cdd3f370..37a2592c 100644 --- a/prospector/config/configuration.py +++ b/prospector/config/configuration.py @@ -28,15 +28,33 @@ def build_manager(): manager.add(soc.BooleanSetting("messages_only", default=False)) manager.add(soc.BooleanSetting("summary_only", default=False)) - manager.add(soc.ListSetting("output_format", OutputChoice(sorted(FORMATTERS.keys())), default=None,)) + manager.add( + soc.ListSetting( + "output_format", + OutputChoice(sorted(FORMATTERS.keys())), + default=None, + ) + ) manager.add(soc.BooleanSetting("absolute_paths", default=False)) - manager.add(soc.ListSetting("tools", soc.Choice(sorted(TOOLS.keys())), default=None,)) + manager.add( + soc.ListSetting( + "tools", + soc.Choice(sorted(TOOLS.keys())), + default=None, + ) + ) manager.add(soc.ListSetting("with_tools", soc.String, default=[])) manager.add(soc.ListSetting("without_tools", soc.String, default=[])) manager.add(soc.ListSetting("profiles", soc.String, default=[])) manager.add(soc.ListSetting("profile_path", soc.String, default=[])) - manager.add(soc.ChoiceSetting("strictness", ["veryhigh", "high", "medium", "low", "verylow"], default=None,)) + manager.add( + soc.ChoiceSetting( + "strictness", + ["veryhigh", "high", "medium", "low", "verylow"], + default=None, + ) + ) manager.add(soc.BooleanSetting("show_profile", default=False)) manager.add(soc.BooleanSetting("no_external_config", default=False)) @@ -58,8 +76,19 @@ def build_default_sources(): sources = [ build_command_line_source(), soc.EnvironmentVariableSource(), - soc.ConfigFileSource((".prospectorrc", "setup.cfg", "tox.ini",)), - soc.ConfigFileSource((soc.ConfigDirectory(".prospectorrc"), soc.HomeDirectory(".prospectorrc"),)), + soc.ConfigFileSource( + ( + ".prospectorrc", + "setup.cfg", + "tox.ini", + ) + ), + soc.ConfigFileSource( + ( + soc.ConfigDirectory(".prospectorrc"), + soc.HomeDirectory(".prospectorrc"), + ) + ), ] return sources @@ -102,8 +131,14 @@ def build_command_line_source(prog=None, description="Performs static analysis o " the same error. Use this option to see all unmerged" " messages.", }, - "doc_warnings": {"flags": ["-D", "--doc-warnings"], "help": "Include warnings about documentation.",}, - "test_warnings": {"flags": ["-T", "--test-warnings"], "help": "Also check test modules and packages.",}, + "doc_warnings": { + "flags": ["-D", "--doc-warnings"], + "help": "Include warnings about documentation.", + }, + "test_warnings": { + "flags": ["-T", "--test-warnings"], + "help": "Also check test modules and packages.", + }, "no_style_warnings": { "flags": ["-8", "--no-style-warnings"], "help": "Don't create any warnings about style. This disables the" @@ -148,7 +183,10 @@ def build_command_line_source(prog=None, description="Performs static analysis o "tools to run. To add extra tools to the defaults, see " "--with-tool. Possible values are: %s. By " "default, the following tools will be run: %s" - % (", ".join(sorted(TOOLS.keys())), ", ".join(sorted(DEFAULT_TOOLS)),), + % ( + ", ".join(sorted(TOOLS.keys())), + ", ".join(sorted(DEFAULT_TOOLS)), + ), }, "with_tools": { "flags": ["-w", "--with-tool"], @@ -264,5 +302,8 @@ def build_command_line_source(prog=None, description="Performs static analysis o ) return soc.CommandLineSource( - options=options, version=__version__, parser_options=parser_options, positional=positional, + options=options, + version=__version__, + parser_options=parser_options, + positional=positional, ) diff --git a/prospector/formatters/emacs.py b/prospector/formatters/emacs.py index fee47372..6d18f18a 100644 --- a/prospector/formatters/emacs.py +++ b/prospector/formatters/emacs.py @@ -7,7 +7,12 @@ class EmacsFormatter(TextFormatter): def render_message(self, message): output = [ - "%s:%s:%d:" % (message.location.path, message.location.line, (message.location.character or 0) + 1,), + "%s:%s:%d:" + % ( + message.location.path, + message.location.line, + (message.location.character or 0) + 1, + ), " L%s:%s %s: %s - %s" % ( message.location.line or "-", diff --git a/prospector/formatters/text.py b/prospector/formatters/text.py index c8a26edc..dc334f03 100644 --- a/prospector/formatters/text.py +++ b/prospector/formatters/text.py @@ -38,7 +38,13 @@ def render_summary(self): value = summary_label[2](self.summary[key]) else: value = self.summary[key] - output.append(" %s: %s" % (label.rjust(label_width), value,)) + output.append( + " %s: %s" + % ( + label.rjust(label_width), + value, + ) + ) return "\n".join(output) diff --git a/prospector/formatters/yaml.py b/prospector/formatters/yaml.py index 343359a8..fd170b95 100644 --- a/prospector/formatters/yaml.py +++ b/prospector/formatters/yaml.py @@ -21,4 +21,9 @@ def render(self, summary=True, messages=True, profile=False): if messages: output["messages"] = [m.as_dict() for m in self.messages] - return yaml.safe_dump(output, indent=2, default_flow_style=False, allow_unicode=True,) + return yaml.safe_dump( + output, + indent=2, + default_flow_style=False, + allow_unicode=True, + ) diff --git a/prospector/postfilter.py b/prospector/postfilter.py index 6c0a37b6..6f243363 100644 --- a/prospector/postfilter.py +++ b/prospector/postfilter.py @@ -30,7 +30,10 @@ def filter_messages(relative_filepaths, root, messages): # first get rid of the pylint informational messages relative_message_path = os.path.relpath(message.location.path) - if message.source == "pylint" and message.code in ("suppressed-message", "file-ignored",): + if message.source == "pylint" and message.code in ( + "suppressed-message", + "file-ignored", + ): continue # some files are skipped entirely by messages diff --git a/prospector/profiles/profile.py b/prospector/profiles/profile.py index 8372ab43..f87a89f9 100644 --- a/prospector/profiles/profile.py +++ b/prospector/profiles/profile.py @@ -15,7 +15,10 @@ def __init__(self, name, profile_path): self.profile_path = profile_path def __repr__(self): - return "Could not find profile %s; searched in %s" % (self.name, ":".join(self.profile_path),) + return "Could not find profile %s; searched in %s" % ( + self.name, + ":".join(self.profile_path), + ) class CannotParseProfile(Exception): @@ -113,7 +116,10 @@ def as_yaml(self): def load(name_or_path, profile_path, allow_shorthand=True, forced_inherits=None): # First simply load all of the profiles and those that it explicitly inherits from data, inherits = _load_and_merge( - name_or_path, profile_path, allow_shorthand, forced_inherits=forced_inherits or [], + name_or_path, + profile_path, + allow_shorthand, + forced_inherits=forced_inherits or [], ) return ProspectorProfile(name_or_path, data, inherits) @@ -301,7 +307,10 @@ def _append_profiles(name, profile_path, data, inherit_list, allow_shorthand=Fal def _load_and_merge(name_or_path, profile_path, allow_shorthand=True, forced_inherits=None): # First simply load all of the profiles and those that it explicitly inherits from data, inherit_list, shorthands_found = _load_profile( - name_or_path, profile_path, allow_shorthand=allow_shorthand, forced_inherits=forced_inherits or [], + name_or_path, + profile_path, + allow_shorthand=allow_shorthand, + forced_inherits=forced_inherits or [], ) if allow_shorthand: @@ -335,7 +344,12 @@ def _load_and_merge(name_or_path, profile_path, allow_shorthand=True, forced_inh def _load_profile( - name_or_path, profile_path, shorthands_found=None, already_loaded=None, allow_shorthand=True, forced_inherits=None, + name_or_path, + profile_path, + shorthands_found=None, + already_loaded=None, + allow_shorthand=True, + forced_inherits=None, ): # recursively get the contents of the basic profile and those it inherits from base_contents = _load_content(name_or_path, profile_path) @@ -366,7 +380,11 @@ def _load_profile( already_loaded.append(inherit_profile) new_cd, new_il, new_sh = _load_profile( - inherit_profile, profile_path, shorthands_found, already_loaded, allow_shorthand, + inherit_profile, + profile_path, + shorthands_found, + already_loaded, + allow_shorthand, ) contents_dict.update(new_cd) inherit_order += new_il diff --git a/prospector/run.py b/prospector/run.py index 9467f24d..16e8dd91 100644 --- a/prospector/run.py +++ b/prospector/run.py @@ -46,7 +46,10 @@ def execute(self): summary.update(self.config.get_summary_information()) found_files = find_python( - self.config.ignores, self.config.paths, self.config.explicit_file_mode, self.config.workdir, + self.config.ignores, + self.config.paths, + self.config.explicit_file_mode, + self.config.workdir, ) # Run the tools @@ -70,10 +73,16 @@ def execute(self): loc = Location(self.config.workdir, None, None, None, None) if capture.get_hidden_stderr(): - msg = "stderr from %s:\n%s" % (toolname, capture.get_hidden_stderr(),) + msg = "stderr from %s:\n%s" % ( + toolname, + capture.get_hidden_stderr(), + ) messages.append(Message(toolname, "hidden-output", loc, message=msg)) if capture.get_hidden_stdout(): - msg = "stdout from %s:\n%s" % (toolname, capture.get_hidden_stdout(),) + msg = "stdout from %s:\n%s" % ( + toolname, + capture.get_hidden_stdout(), + ) messages.append(Message(toolname, "hidden-output", loc, message=msg)) except FatalProspectorException as fatal: @@ -86,7 +95,12 @@ def execute(self): else: loc = Location(self.config.workdir, None, None, None, None) msg = "Tool %s failed to run (exception was raised)" % (toolname,) - message = Message(toolname, "failure", loc, message=msg,) + message = Message( + toolname, + "failure", + loc, + message=msg, + ) messages.append(message) messages = self.process_messages(found_files, messages) diff --git a/prospector/suppression.py b/prospector/suppression.py index 8e3c99a5..0c01fc64 100644 --- a/prospector/suppression.py +++ b/prospector/suppression.py @@ -54,7 +54,10 @@ def get_noqa_suppressions(file_contents): _PYLINT_EQUIVALENTS = { # TODO: blending has this info already? - "unused-import": (("pyflakes", "FL0001"), ("frosted", "E101"),) + "unused-import": ( + ("pyflakes", "FL0001"), + ("frosted", "E101"), + ) } diff --git a/prospector/tools/dodgy/__init__.py b/prospector/tools/dodgy/__init__.py index 745d431e..d0664d7a 100644 --- a/prospector/tools/dodgy/__init__.py +++ b/prospector/tools/dodgy/__init__.py @@ -36,7 +36,14 @@ def run(self, found_files): for warning in warnings: path = warning["path"] prefix = os.path.commonprefix([found_files.rootpath, path]) - loc = Location(path, module_from_path(path[len(prefix) :]), "", warning["line"], 0, absolute_path=True,) + loc = Location( + path, + module_from_path(path[len(prefix) :]), + "", + warning["line"], + 0, + absolute_path=True, + ) msg = Message("dodgy", warning["code"], loc, warning["message"]) messages.append(msg) diff --git a/prospector/tools/frosted/__init__.py b/prospector/tools/frosted/__init__.py index b88726db..eac03d13 100644 --- a/prospector/tools/frosted/__init__.py +++ b/prospector/tools/frosted/__init__.py @@ -19,13 +19,26 @@ def record_message(self, filename=None, line=None, character=None, code=None, me if code in self.ignore: return - location = Location(path=filename, module=None, function=None, line=line, character=character,) - message = Message(source="frosted", code=code, location=location, message=message,) + location = Location( + path=filename, + module=None, + function=None, + line=line, + character=character, + ) + message = Message( + source="frosted", + code=code, + location=location, + message=message, + ) self._messages.append(message) def unexpected_error(self, filename, msg): self.record_message( - filename=filename, code="U999", message=msg, + filename=filename, + code="U999", + message=msg, ) def flake(self, message): diff --git a/prospector/tools/mccabe/__init__.py b/prospector/tools/mccabe/__init__.py index 29d5fab2..b1786241 100644 --- a/prospector/tools/mccabe/__init__.py +++ b/prospector/tools/mccabe/__init__.py @@ -30,7 +30,10 @@ def run(self, found_files): for code_file in found_files.iter_module_paths(): try: contents = read_py_file(code_file) - tree = ast.parse(contents, filename=code_file,) + tree = ast.parse( + contents, + filename=code_file, + ) except CouldNotHandleEncoding as err: messages.append( make_tool_error_message( @@ -44,7 +47,12 @@ def run(self, found_files): except SyntaxError as err: messages.append( make_tool_error_message( - code_file, "mccabe", "MC0000", line=err.lineno, character=err.offset, message="Syntax Error", + code_file, + "mccabe", + "MC0000", + line=err.lineno, + character=err.offset, + message="Syntax Error", ) ) continue @@ -70,7 +78,11 @@ def run(self, found_files): source="mccabe", code="MC0001", location=location, - message="%s is too complex (%s)" % (graph.entity, complexity,), + message="%s is too complex (%s)" + % ( + graph.entity, + complexity, + ), ) messages.append(message) diff --git a/prospector/tools/mypy/__init__.py b/prospector/tools/mypy/__init__.py index 61a1c68a..7ae9e46e 100644 --- a/prospector/tools/mypy/__init__.py +++ b/prospector/tools/mypy/__init__.py @@ -16,8 +16,19 @@ def format_message(message): except ValueError: (path, line, err_type, err_msg) = message.split(":", 3) character = None - location = Location(path=path, module=None, function=None, line=int(line), character=character,) - return Message(source="mypy", code=err_type.lstrip(" "), location=location, message=err_msg.lstrip(" "),) + location = Location( + path=path, + module=None, + function=None, + line=int(line), + character=character, + ) + return Message( + source="mypy", + code=err_type.lstrip(" "), + location=location, + message=err_msg.lstrip(" "), + ) class MypyTool(ToolBase): diff --git a/prospector/tools/pep257/__init__.py b/prospector/tools/pep257/__init__.py index 26e34747..892cbb76 100644 --- a/prospector/tools/pep257/__init__.py +++ b/prospector/tools/pep257/__init__.py @@ -29,7 +29,12 @@ def run(self, found_files): for error in checker.check_source(read_py_file(code_file), code_file, None): location = Location( - path=code_file, module=None, function="", line=error.line, character=0, absolute_path=True, + path=code_file, + module=None, + function="", + line=error.line, + character=0, + absolute_path=True, ) message = Message( source="pep257", @@ -53,7 +58,14 @@ def run(self, found_files): # attempt to analyze the __all__ definition has failed. This # occurs when __all__ is too complex to be parsed. messages.append( - make_tool_error_message(code_file, "pep257", "D000", line=1, character=0, message=exc.args[0],) + make_tool_error_message( + code_file, + "pep257", + "D000", + line=1, + character=0, + message=exc.args[0], + ) ) continue diff --git a/prospector/tools/pep8/__init__.py b/prospector/tools/pep8/__init__.py index dad03871..73481396 100644 --- a/prospector/tools/pep8/__init__.py +++ b/prospector/tools/pep8/__init__.py @@ -26,7 +26,12 @@ def __init__(self, *args, **kwargs): self._prospector_messages = [] def error(self, line_number, offset, text, check): - code = super(ProspectorReport, self).error(line_number, offset, text, check,) + code = super(ProspectorReport, self).error( + line_number, + offset, + text, + check, + ) if code is None: # The error pep8 found is being ignored, let's move on. return @@ -39,8 +44,19 @@ def error(self, line_number, offset, text, check): line_number = None # Record the message using prospector's data structures. - location = Location(path=self.filename, module=None, function=None, line=line_number, character=(offset + 1),) - message = Message(source="pep8", code=code, location=location, message=text,) + location = Location( + path=self.filename, + module=None, + function=None, + line=line_number, + character=(offset + 1), + ) + message = Message( + source="pep8", + code=code, + location=location, + message=text, + ) self._prospector_messages.append(message) diff --git a/prospector/tools/profile_validator/__init__.py b/prospector/tools/profile_validator/__init__.py index 72c4b0dd..33907377 100644 --- a/prospector/tools/profile_validator/__init__.py +++ b/prospector/tools/profile_validator/__init__.py @@ -77,26 +77,34 @@ def add_message(code, message, setting): if parsed is None: # this happens if a completely empty profile is found add_message( - PROFILE_IS_EMPTY, "%s is a completely empty profile" % relative_filepath, "entire-file", + PROFILE_IS_EMPTY, + "%s is a completely empty profile" % relative_filepath, + "entire-file", ) return messages for setting in ("doc-warnings", "test-warnings", "autodetect"): if not isinstance(parsed.get(setting, False), bool): add_message( - CONFIG_SETTING_MUST_BE_BOOL, '"%s" should be true or false' % setting, setting, + CONFIG_SETTING_MUST_BE_BOOL, + '"%s" should be true or false' % setting, + setting, ) if not isinstance(parsed.get("max-line-length", 0), int): add_message( - CONFIG_SETTING_MUST_BE_INTEGER, '"max-line-length" should be an integer', "max-line-length", + CONFIG_SETTING_MUST_BE_INTEGER, + '"max-line-length" should be an integer', + "max-line-length", ) if "strictness" in parsed: possible = ("veryhigh", "high", "medium", "low", "verylow", "none") if parsed["strictness"] not in possible: add_message( - CONFIG_INVALID_VALUE, '"strictness" must be one of %s' % ", ".join(possible), "strictness", + CONFIG_INVALID_VALUE, + '"strictness" must be one of %s' % ", ".join(possible), + "strictness", ) if "uses" in parsed: @@ -145,7 +153,9 @@ def add_message(code, message, setting): for key in parsed.keys(): if key not in ProfileValidationTool.ALL_SETTINGS and key not in self.tool_names(): add_message( - CONFIG_UNKNOWN_SETTING, '"%s" is not a valid prospector setting' % key, key, + CONFIG_UNKNOWN_SETTING, + '"%s" is not a valid prospector setting' % key, + key, ) if "pyflakes" in parsed: diff --git a/prospector/tools/pyflakes/__init__.py b/prospector/tools/pyflakes/__init__.py index 9c565324..d7d7ab45 100644 --- a/prospector/tools/pyflakes/__init__.py +++ b/prospector/tools/pyflakes/__init__.py @@ -95,19 +95,36 @@ def record_message(self, filename=None, line=None, character=None, code=None, me if code in self.ignore: return - location = Location(path=filename, module=None, function=None, line=line, character=character,) - message = Message(source="pyflakes", code=code, location=location, message=message,) + location = Location( + path=filename, + module=None, + function=None, + line=line, + character=character, + ) + message = Message( + source="pyflakes", + code=code, + location=location, + message=message, + ) self._messages.append(message) def unexpectedError(self, filename, msg): # noqa self.record_message( - filename=filename, code="F999", message=msg, + filename=filename, + code="F999", + message=msg, ) # pylint: disable=too-many-arguments def syntaxError(self, filename, msg, lineno, offset, text): # noqa self.record_message( - filename=filename, line=lineno, character=offset, code="F999", message=msg, + filename=filename, + line=lineno, + character=offset, + code="F999", + message=msg, ) def flake(self, message): diff --git a/prospector/tools/pylint/indent_checker.py b/prospector/tools/pylint/indent_checker.py index 04b7cbc8..6031cad7 100644 --- a/prospector/tools/pylint/indent_checker.py +++ b/prospector/tools/pylint/indent_checker.py @@ -57,7 +57,9 @@ def process_tokens(self, tokens): if self.config.indent_strict_spaces: # we have tabs but are configured to only allow spaces self.add_message( - "incorrect-indentation", line=line_num, args=("tabs", "spaces"), + "incorrect-indentation", + line=line_num, + args=("tabs", "spaces"), ) tab_count += 1 @@ -65,7 +67,9 @@ def process_tokens(self, tokens): if self.config.indent_strict_tabs: # we have tabs but are configured to only allow spaces self.add_message( - "incorrect-indentation", line=line_num, args=("spaces", "tabs"), + "incorrect-indentation", + line=line_num, + args=("spaces", "tabs"), ) space_count += 1 diff --git a/setup.py b/setup.py index e0222603..8c639a9c 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,11 @@ ] -_PACKAGE_DATA = {"prospector": ["blender_combinations.yaml",]} +_PACKAGE_DATA = { + "prospector": [ + "blender_combinations.yaml", + ] +} profiledir = os.path.join(os.path.dirname(__file__), "prospector/profiles/profiles") _PACKAGE_DATA["prospector"] += [profile for profile in os.listdir(profiledir)] @@ -86,7 +90,11 @@ package_data=_PACKAGE_DATA, include_package_data=True, packages=_PACKAGES, - entry_points={"console_scripts": ["prospector = prospector.run:main",]}, + entry_points={ + "console_scripts": [ + "prospector = prospector.run:main", + ] + }, install_requires=_INSTALL_REQUIRES, extras_require=_OPTIONAL, ) diff --git a/tests/config/test_datatype.py b/tests/config/test_datatype.py index 6e2014ed..c20ae718 100644 --- a/tests/config/test_datatype.py +++ b/tests/config/test_datatype.py @@ -12,7 +12,8 @@ class TestOutputChoice(TestCase): def test_sanitize_rel_path_colon_posix(self): output_choice = OutputChoice(["xunit"]) self.assertEqual( - output_choice.sanitize("xunit:./test-results.xml"), ("xunit", ["./test-results.xml"]), + output_choice.sanitize("xunit:./test-results.xml"), + ("xunit", ["./test-results.xml"]), ) @patch("sys.platform", "linux") @@ -21,7 +22,8 @@ def test_sanitize_rel_path_colon_posix(self): def test_sanitize_rel_path_semicolon_posix(self): output_choice = OutputChoice(["xunit"]) self.assertEqual( - output_choice.sanitize("xunit;./test-results.xml"), ("xunit", ["./test-results.xml"]), + output_choice.sanitize("xunit;./test-results.xml"), + ("xunit", ["./test-results.xml"]), ) @patch("sys.platform", "win32") @@ -30,7 +32,8 @@ def test_sanitize_rel_path_semicolon_posix(self): def test_sanitize_rel_path_colon_windows(self): output_choice = OutputChoice(["xunit"]) self.assertEqual( - output_choice.sanitize("xunit:.\\test-results.xml"), ("xunit", [".\\test-results.xml"]), + output_choice.sanitize("xunit:.\\test-results.xml"), + ("xunit", [".\\test-results.xml"]), ) @patch("sys.platform", "win32") @@ -39,7 +42,8 @@ def test_sanitize_rel_path_colon_windows(self): def test_sanitize_rel_path_semicolon_windows(self): output_choice = OutputChoice(["xunit"]) self.assertEqual( - output_choice.sanitize("xunit;.\\test-results.xml"), ("xunit", [".\\test-results.xml"]), + output_choice.sanitize("xunit;.\\test-results.xml"), + ("xunit", [".\\test-results.xml"]), ) @patch("sys.platform", "linux") @@ -48,7 +52,8 @@ def test_sanitize_rel_path_semicolon_windows(self): def test_sanitize_abs_path_colon_posix(self): output_choice = OutputChoice(["xunit"]) self.assertEqual( - output_choice.sanitize("xunit:/home/test-results.xml"), ("xunit", ["/home/test-results.xml"]), + output_choice.sanitize("xunit:/home/test-results.xml"), + ("xunit", ["/home/test-results.xml"]), ) @patch("sys.platform", "linux") @@ -57,7 +62,8 @@ def test_sanitize_abs_path_colon_posix(self): def test_sanitize_abs_path_semicolon_posix(self): output_choice = OutputChoice(["xunit"]) self.assertEqual( - output_choice.sanitize("xunit;/home/test-results.xml"), ("xunit", ["/home/test-results.xml"]), + output_choice.sanitize("xunit;/home/test-results.xml"), + ("xunit", ["/home/test-results.xml"]), ) @patch("sys.platform", "win32") diff --git a/tests/profiles/test_profile.py b/tests/profiles/test_profile.py index 7e5dc460..5ee93e12 100644 --- a/tests/profiles/test_profile.py +++ b/tests/profiles/test_profile.py @@ -77,7 +77,8 @@ def test_strictness_equivalence(self): profile = self._load("strictness_equivalence") medium_strictness = ProspectorProfile.load("strictness_medium", self._profile_path) self.assertListEqual( - sorted(profile.pylint["disable"]), sorted(medium_strictness.pylint["disable"]), + sorted(profile.pylint["disable"]), + sorted(medium_strictness.pylint["disable"]), ) def test_shorthand_inheritance(self):