diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28a8a22..a94b870 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,13 +3,13 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.2 + rev: v0.13.3 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.13.0 + rev: v1.18.2 hooks: - id: mypy diff --git a/src/pytestarch/eval_structure/module_name_converter.py b/src/pytestarch/eval_structure/module_name_converter.py index 0709688..9a115f1 100644 --- a/src/pytestarch/eval_structure/module_name_converter.py +++ b/src/pytestarch/eval_structure/module_name_converter.py @@ -73,7 +73,7 @@ def convert( if never_matched: raise ImpossibleMatch( - f'No modules found that match: {", ".join(never_matched)}' + f"No modules found that match: {', '.join(never_matched)}" ) all_converted_modules = list(converted_module_filters) + other_modules # type: ignore diff --git a/src/pytestarch/query_language/layered_architecture_rule.py b/src/pytestarch/query_language/layered_architecture_rule.py index 179ee3c..74d2e52 100644 --- a/src/pytestarch/query_language/layered_architecture_rule.py +++ b/src/pytestarch/query_language/layered_architecture_rule.py @@ -54,7 +54,7 @@ def layer(self, name: str) -> LayerDefinition: if underspecified_layers: raise ImproperlyConfigured( - f'Specify the modules of layer(s) {", ".join(underspecified_layers)} first.' + f"Specify the modules of layer(s) {', '.join(underspecified_layers)} first." ) if name in self._modules_by_layer_name: @@ -94,7 +94,7 @@ def containing_modules(self, modules: str | list[str]) -> LayeredArchitecture: if duplicates: raise ImproperlyConfigured( - f'Module(s) {", ".join(duplicates)} already assigned to a layer.' + f"Module(s) {', '.join(duplicates)} already assigned to a layer." ) self._modules_by_layer_name[layers_without_modules[0]] = ( @@ -124,7 +124,7 @@ def __str__(self) -> str: f"Layer {layer}: [{', '.join(map(lambda m: m.identifier, modules))}]" for layer, modules in self._modules_by_layer_name.items() ] - return f'Layered Architecture: {"; ".join(layers)}' + return f"Layered Architecture: {'; '.join(layers)}" def __getitem__(self, layer: str) -> Sequence[ModuleFilter]: return self._modules_by_layer_name[layer] diff --git a/src/pytestarch/query_language/rule.py b/src/pytestarch/query_language/rule.py index ed2f049..6e15a0b 100644 --- a/src/pytestarch/query_language/rule.py +++ b/src/pytestarch/query_language/rule.py @@ -241,7 +241,7 @@ def _prepare_rule_matcher(self) -> RuleMatcher: def __str__(self) -> str: self._assert_required_configuration_present() - method_name = f'{"should" if self._configuration.should else "should only" if self._configuration.should_only else "should not"}' + method_name = f"{'should' if self._configuration.should else 'should only' if self._configuration.should_only else 'should not'}" subject_prefix = ( "Sub modules of " @@ -251,7 +251,7 @@ def __str__(self) -> str: if self._configuration.rule_object_anything: object_message = "anything " else: - object_message = f'modules that are {"sub modules of" if self._configuration.modules_to_check_against[0].identifier_is_parent_module else "named"} ' # type: ignore + object_message = f"modules that are {'sub modules of' if self._configuration.modules_to_check_against[0].identifier_is_parent_module else 'named'} " # type: ignore combined_rule_subjects = self._combine_names( self._configuration.modules_to_check # type: ignore @@ -262,8 +262,8 @@ def __str__(self) -> str: return ( f'{subject_prefix}"{combined_rule_subjects}" ' f"{method_name} " - f'{"import" if self._configuration.import_ else "be imported by"} ' - f'{"modules except " if self._configuration.except_present else ""}' + f"{'import' if self._configuration.import_ else 'be imported by'} " + f"{'modules except ' if self._configuration.except_present else ''}" f"{object_message}" f'"{combined_rule_objects}".' ) diff --git a/tests/eval_structure_generation/test_module_graph.py b/tests/eval_structure_generation/test_module_graph.py index 1e4cffc..44d9e6f 100644 --- a/tests/eval_structure_generation/test_module_graph.py +++ b/tests/eval_structure_generation/test_module_graph.py @@ -132,8 +132,7 @@ def test_edges_between_parent_and_child_modules_as_expected( "pytestarch.tests.resources.importer.level0.level1.level2.level3.level4.level5", ) in module_graph assert ( - "pytestarch.tests.resources.importer.level0.level1.level2." - "level3.level4.level5", + "pytestarch.tests.resources.importer.level0.level1.level2.level3.level4.level5", "pytestarch.tests.resources.importer.level0.level1.level2." "level3.level4.level5.module_level_5", ) in module_graph diff --git a/tests/integration/interesting_rules_for_tests.py b/tests/integration/interesting_rules_for_tests.py index 1dc838c..33be067 100644 --- a/tests/integration/interesting_rules_for_tests.py +++ b/tests/integration/interesting_rules_for_tests.py @@ -1388,7 +1388,7 @@ .should() .import_modules_that() .are_named([B]), - f'"{C}" does not import "{B}".\n' f'"{FILE_C}" does not import "{B}".', + f'"{C}" does not import "{B}".\n"{FILE_C}" does not import "{B}".', id="two subjects violate should rule", ), pytest.param( @@ -1398,7 +1398,7 @@ .should_not() .import_modules_that() .are_named([C]), - f'"{FILE_A}" imports "{FILE_C}".\n' f'"{FILE_A2}" imports "{FILE_C}".', + f'"{FILE_A}" imports "{FILE_C}".\n"{FILE_A2}" imports "{FILE_C}".', id="one subject violates should_not rule", ), pytest.param( @@ -1485,7 +1485,7 @@ .should_not() .import_modules_except_modules_that() .are_named([C]), - f'"{FILE_A11}" imports "{FILE_B1}".\n' f'"{FILE_B2}" imports "{FILE_A11}".', + f'"{FILE_A11}" imports "{FILE_B1}".\n"{FILE_B2}" imports "{FILE_A11}".', id="two subjects violate should_not except rule", ), pytest.param( @@ -1515,7 +1515,7 @@ .should() .be_imported_by_modules_that() .are_named([C]), - f'"{A}" is not imported by "{C}".\n' f'"{B}" is not imported by "{C}".', + f'"{A}" is not imported by "{C}".\n"{B}" is not imported by "{C}".', id="two subjects violate should be imported rule", ), pytest.param(