Skip to content

Commit

Permalink
Automatically check for SPDX headers (#29)
Browse files Browse the repository at this point in the history
* check for SPDX headers

Signed-off-by: Matthias J. Kannwischer <[email protected]>

* add missing SPDX headers

Signed-off-by: Matthias J. Kannwischer <[email protected]>

* license wildcard

Signed-off-by: Matthias J. Kannwischer <[email protected]>

---------

Signed-off-by: Matthias J. Kannwischer <[email protected]>
  • Loading branch information
mkannwischer authored Apr 24, 2024
1 parent 914d15e commit 9bde5c5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .astylerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
--style=google
--indent=spaces
--indent-preproc-define
Expand Down
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
if ! has nix_direnv_version || ! nix_direnv_version 3.0.3; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.3/direnvrc" "sha256-0EVQVNSRQWsln+rgPW3mXVmnF5sfcmKEYOmOSfLYxHg="
fi
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[//]: # (SPDX-License-Identifier: CC-BY-4.0)
---
name: Bug report
about: Create a report to help us improve
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[//]: # (SPDX-License-Identifier: CC-BY-4.0)
---
name: Feature request
about: Suggest an idea for this project
Expand Down
13 changes: 13 additions & 0 deletions scripts/ci/lint
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ echo "::group::Checking eol"
checkerr "$(check-eol-dry-run)"
echo "::endgroup::"

check-spdx()
{
for file in $(git ls-files -- ":/" ":/!:libopencm3" ":/!:*LICENSE*" ":/!:.git*" ":/!:flake.lock"); do
if [[ $(grep "SPDX-License-Identifier:" $file | wc -l) == 0 ]]; then
echo "$file is missing SPDX License header"
SUCCESS=false
fi
done
}
echo "::group::Checking SPDX headers"
check-spdx
echo "::endgroup::"

#
if ! $SUCCESS; then
exit 1
Expand Down

0 comments on commit 9bde5c5

Please sign in to comment.