Skip to content

Commit c7ebe1e

Browse files
committed
feature: Add script to check license header to repo and CI
1 parent fb87ed9 commit c7ebe1e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.gitlab-ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ flake8:
5555
stage: check
5656
script: poetry run flake8 deepl tests
5757

58+
licenseCheck:
59+
stage: check
60+
script:
61+
- ./license_checker.sh '*.py' | tee license_check_output.txt
62+
- '[ ! -s license_check_output.txt ]'
63+
5864
# stage: build ----------------------
5965

6066
package:

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
* Add [example script](examples/mustache) to translate Mustache templates.
1111
* Add support for storing your API Key in a keyring via the `keyring` module.
12+
* Added a CI check for copyright headers.
1213
### Changed
1314
### Deprecated
1415
### Removed
1516
### Fixed
17+
* Copyright headers are updated for 2023
1618
### Security
1719
* Update `certifi` to resolve security advisory.
1820
* `certifi` is a development-only dependency; library users are unaffected.

license_checker.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# Usage: ./license_checker.sh source_code_pattern
4+
# Example: ./license_checker.sh '*.py'
5+
# This will search all .py files, ignoring anything not tracked in your git tree
6+
7+
git ls-files -z $1 | xargs -0 -I{} sh -c 'RES=$(head -n 3 "{}" | grep "Copyright 20[0-9][0-9] DeepL SE (https://www.deepl.com)"); if [ ! "${RES}" ] ; then echo "Lacking copyright header in" "{}" ; fi'

0 commit comments

Comments
 (0)