Skip to content

Commit b1d0e2d

Browse files
committed
feat: introduce import linter
Goal: The different file formats should not depend on each other
1 parent fd3a285 commit b1d0e2d

File tree

4 files changed

+69
-5
lines changed

4 files changed

+69
-5
lines changed

.github/workflows/lint_and_run_tests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848
- name: Run mypy
4949
run: uv run python -m mypy src/ tests/
5050

51+
- name: Run import linter
52+
run: uv run lint-imports
53+
5154
test:
5255
runs-on: ${{ matrix.os }}
5356
if: |

.importlinter

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
[importlinter]
6+
root_package = opossum_lib
7+
# Optional:
8+
include_external_packages = True
9+
exclude_type_checking_imports = True
10+
11+
[importlinter:contract:file-formats-independent]
12+
name = The different file formats should be independent
13+
type = independence
14+
modules =
15+
opossum_lib.opossum
16+
opossum_lib.scancode
17+
ignore_imports =
18+
** -> opossum_lib.core.opossum_model

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies = [
1212
"click>=8.1.8,<9",
1313
"pydantic>=2.10.6",
1414
"pyinstaller>=6.11.1",
15-
"faker>=35.0.0",
1615
]
1716

1817
[project.urls]
@@ -22,11 +21,12 @@ Repository = "https://github.com/opossum-tool/opossum-file"
2221
opossum-file = "opossum_lib.cli:opossum_file"
2322

2423
[dependency-groups]
25-
test = ["pytest>=8.3.4,<9"]
24+
test = ["pytest>=8.3.4,<9", "faker>=35.0.0",]
2625
dev = [
2726
"mypy>=1.14.1,<2",
2827
"pre-commit>=4.1.0,<5",
2928
"ruff>=0.9.3",
29+
"import-linter>=2.1",
3030
]
3131

3232
[tool.uv]

uv.lock

+46-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)