Skip to content

Commit 86fca8c

Browse files
committed
fix repo path and comment out hook until it is available on master (#456)
we're in a bit of a circular dependency here, in that the hook fails because the commit isn't available in the main repo yet. To get around this, we need to split it up in two commits closes #456
1 parent e46d183 commit 86fca8c

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ repos:
1818
hooks:
1919
- id: flake8
2020
exclude: elasticapm\/utils\/wrapt|build|src|tests|dist|conftest.py|setup.py
21+
#- repo: https://github.com/elastic/apm-agent-python
22+
# rev: cdfb9f18e0ef405
23+
# hooks:
24+
# - id: license-header-check

.pre-commit-hooks.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- id: license-header-check
2+
name: License header check
3+
description: Checks the existance of license headers in all Python files
4+
entry: ./tests/scripts/license_headers_check.sh
5+
exclude: "(elasticapm\/utils\/wrapt\/.*|tests\/utils\/stacks\/linenos.py)"
6+
language: script
7+
types: [python]

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* fixed an issue with Celery and the prefork worker pool (#444)
66
* fixed an issue when running uwsgi without a master process (#446)
77
* introduced `IntervalTimer` and use it instead of `threading.Timer` (#452)
8+
* added license header check as pre-commit hook (#456)
89

910
## v4.2.1
1011
[Check the diff](https://github.com/elastic/apm-agent-python/compare/v4.2.0...v4.2.1)

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ Once your changes are ready to submit for review:
4040
* the automatic code formatter [black](https://black.readthedocs.io/en/stable/)
4141
* sorting of imports via [isort](https://isort.readthedocs.io/en/latest/)
4242
* [flake8](http://flake8.pycqa.org/en/latest/)
43+
* License header check via custom script
4344

4445
The easiest way to make sure your pull request adheres to the the code style
4546
is to install [pre-commit](https://pre-commit.com/).
47+
48+
pip install pre-commit # or "brew install pre-commit" if you use Homebrew
49+
50+
pre-commit install
4651

4752
1. Test your changes
4853

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pipeline {
7272
./tests/scripts/docker/cleanup.sh
7373
./tests/scripts/docker/black.sh
7474
""", label: "Black code formatting"
75-
sh script: 'find . -iname "*.py" -not -path "./elasticapm/utils/wrapt/*" -not -path "./dist/*" -not -path "./build/*" -not -path "./tests/utils/stacks/linenos.py" -print0 | xargs -0 -n 1 grep --files-without-match "Copyright (c) [0-9]..., Elastic"', label: "Copyright notice"
75+
sh script: './tests/scripts/license_headers_check.sh', label: "Copyright notice"
7676
}
7777
}
7878
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
if [[ $# -eq 0 ]]
3+
then
4+
FILES=$(find . -iname "*.py" -not -path "./elasticapm/utils/wrapt/*" -not -path "./dist/*" -not -path "./build/*" -not -path "./tests/utils/stacks/linenos.py")
5+
else
6+
FILES=$@
7+
fi
8+
9+
echo ${FILES} | xargs -n 1 grep --files-without-match "Copyright (c) [0-9]..., Elastic"

0 commit comments

Comments
 (0)