Skip to content

Commit

Permalink
feat: introduce import linter
Browse files Browse the repository at this point in the history
Goal: The different file formats should not depend on each other
  • Loading branch information
Hellgartner committed Jan 28, 2025
1 parent fd3a285 commit b1d0e2d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint_and_run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
- name: Run mypy
run: uv run python -m mypy src/ tests/

- name: Run import linter
run: uv run lint-imports

test:
runs-on: ${{ matrix.os }}
if: |
Expand Down
18 changes: 18 additions & 0 deletions .importlinter
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
#
# SPDX-License-Identifier: Apache-2.0

[importlinter]
root_package = opossum_lib
# Optional:
include_external_packages = True
exclude_type_checking_imports = True

[importlinter:contract:file-formats-independent]
name = The different file formats should be independent
type = independence
modules =
opossum_lib.opossum
opossum_lib.scancode
ignore_imports =
** -> opossum_lib.core.opossum_model
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies = [
"click>=8.1.8,<9",
"pydantic>=2.10.6",
"pyinstaller>=6.11.1",
"faker>=35.0.0",
]

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

[dependency-groups]
test = ["pytest>=8.3.4,<9"]
test = ["pytest>=8.3.4,<9", "faker>=35.0.0",]
dev = [
"mypy>=1.14.1,<2",
"pre-commit>=4.1.0,<5",
"ruff>=0.9.3",
"import-linter>=2.1",
]

[tool.uv]
Expand Down
49 changes: 46 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1d0e2d

Please sign in to comment.