Skip to content

Commit 4c61c84

Browse files
authored
PYSCAN-23: Add check to prevent missing license header (#12)
1 parent 081a32c commit 4c61c84

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/build-pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- name: Check formatting
3535
run: |
3636
hatch run tool:format
37+
- name: Check licensing
38+
run: |
39+
hatch run tool:license_check
3740
# - name: SonarCloud Scan
3841
# uses: SonarSource/sonarcloud-github-action@master
3942
# env:

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ dependencies = [
6464
]
6565

6666
[tool.hatch.envs.tool.scripts]
67-
license = 'python -m licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2023 -n "Sonar Scanner Python" -E .py'
67+
license_script = 'python -m licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2023 -n "Sonar Scanner Python" -E .py'
68+
license = ["license_script -d ./src", "license_script -d ./tests"]
69+
license_check = ["license", "git diff --name-only --exit-code ./src ./tests"]
6870
format = 'python -m black src/ tests/ --check'
6971
apply_format = 'python -m black src/ tests/'
7072
type_check = "python -m mypy src/ tests/ --ignore-missing-imports"

0 commit comments

Comments
 (0)