Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 246dcb0

Browse files
committedJan 28, 2025··
feat: introduce import linter
Goal: The different file formats should not depend on each other
1 parent fd3a285 commit 246dcb0

File tree

4 files changed

+65
-5
lines changed

4 files changed

+65
-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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[importlinter]
2+
root_package = opossum_lib
3+
# Optional:
4+
include_external_packages = True
5+
exclude_type_checking_imports = True
6+
7+
[importlinter:contract:file-formats-independent]
8+
name = The different file formats should be independent
9+
type = independence
10+
modules =
11+
opossum_lib.opossum
12+
opossum_lib.scancode
13+
ignore_imports =
14+
** -> 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)
Please sign in to comment.