Skip to content

Commit 55b3f44

Browse files
authored
Added copyright check and whitespaces check (#532)
Addressing: Open-CMSIS-Pack/cmsis-toolbox#355 ## Checklist <!-- Put an `x` in the boxes. All tasks must be completed and boxes checked before merging. --> - [ ] 🤖 This change is covered by unit tests (if applicable). - [ ] 🤹 Manual testing has been performed (if necessary). - [x] 🛡️ Security impacts have been considered (if relevant). - [ ] 📖 Documentation updates are complete (if required). - [ ] 🧠 Third-party dependencies and TPIP updated (if required).
1 parent 9a83697 commit 55b3f44

23 files changed

+176
-30
lines changed

.devcontainer/ubuntu-22.04/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Ubuntu-23.04",
33
"build": { "dockerfile": "Dockerfile" },
4-
4+
55
"customizations": {
66
"vscode": {
77
"extensions": [

.github/markdownlint.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"MD025": false,
99
"MD034": false,
1010
"MD041": false
11-
}
11+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: check copyright
2+
on:
3+
pull_request:
4+
paths:
5+
- '.github/workflows/check-copyright.yml'
6+
- '.pre-commit-config.yaml'
7+
- 'scripts/check_copyright_notice.py'
8+
- '**/*.go'
9+
- '!**/docs/**/*'
10+
- '!**/*.md'
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
copyright:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
25+
with:
26+
egress-policy: audit
27+
28+
- name: Checkout devtools
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
31+
- name: Check copyright notice
32+
run: |
33+
pip install \
34+
pre-commit \
35+
comment-parser>=1.2.3
36+
pre-commit run --all-files

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test
22

33
on:
44
workflow_dispatch:
5-
push:
5+
push:
66
branches: [main]
77
pull_request:
88
paths:
@@ -165,7 +165,7 @@ jobs:
165165
if: always()
166166
run: |
167167
go-junit-report -set-exit-code -in build/cpackgettests-${{ matrix.goos }}-amd64.txt -iocopy -out build/cpackget-testreport-${{ matrix.goos }}-amd64.xml
168-
168+
169169
- name: Publish coverage report to Code Climate
170170
if: ${{ startsWith(matrix.runs-on, 'ubuntu') && (github.workflow != 'Release') }}
171171
uses: paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
@@ -191,10 +191,10 @@ jobs:
191191
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
192192
with:
193193
egress-policy: audit
194-
194+
195195
- name: Check out repository code
196196
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
197-
197+
198198
- name: Install linux deps
199199
run: |
200200
sudo apt-get update
@@ -227,7 +227,7 @@ jobs:
227227
if: always()
228228
run: |
229229
go-junit-report -set-exit-code -in build/cpackgettests-linux-arm64.txt -iocopy -out build/cpackget-testreport-linux-arm64.xml
230-
230+
231231
- name: Archive unit test results
232232
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
233233
with:

.github/workflows/tpip-check.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: |
4747
go-licenses report . --ignore github.com/Open-CMSIS-Pack/cpackget --template ../scripts/template/tpip-license.template > ../${{ env.report_name }}
4848
working-directory: ./cmd
49-
49+
5050
- name: Archive tpip report
5151
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5252
with:
@@ -97,4 +97,3 @@ jobs:
9797
delete-branch: true
9898
labels: TPIP
9999
reviewers: soumeh01
100-

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
name: Fix end of files
7+
description: Ensures files end with a newline
8+
- id: trailing-whitespace
9+
name: Check for trailing whitespace
10+
description: Fails and fix files with trailing whitespace
11+
12+
- repo: local
13+
hooks:
14+
- id: check-copyright-notice
15+
name: Check for copyright notice
16+
description: Ensures source files include a copyright notice
17+
entry: python3 scripts/check_copyright_notice.py
18+
language: system
19+
types: [go]

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Bug fixes:
99
- If PDSC file is no longer listed in index.pidx, it shall be removed from .Web folder
1010
- touch pack.idx after init command
1111
- refined --skip-touch option
12-
12+
1313
New features:
1414

1515
- update-index: added option "-a" to download all missing PDSC files that are listed in index.pidx
@@ -32,7 +32,7 @@ Bug fixes:
3232
- cpackget add -f packlist.txt throws an error when the file is empty
3333
- Installing a local pack that does not exist triggers error message twice
3434
- add -f packs.txt: does not check if the required/dependent pack is installed already
35-
35+
3636
New features:
3737

3838
- added --skip-touch flag to not touch pack.idx

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Security
1+
# Security
22

33
For reporting security issues, please follow the official guidelines outlined in [SECURITY.md](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/SECURITY.md).

cmd/cryptography/checksum.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
/* Copyright Contributors to the cpackget project. */
3+
14
package cryptography
25

36
import (

cmd/cryptography/signature.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
/* Copyright Contributors to the cpackget project. */
3+
14
package cryptography
25

36
import (

0 commit comments

Comments
 (0)