Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/pytestarch/eval_structure/module_name_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/pytestarch/query_language/layered_architecture_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]] = (
Expand Down Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions src/pytestarch/query_language/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand All @@ -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
Expand All @@ -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}".'
)
Expand Down
3 changes: 1 addition & 2 deletions tests/eval_structure_generation/test_module_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/interesting_rules_for_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down