Skip to content

Commit

Permalink
ci: Add license pre-commit check
Browse files Browse the repository at this point in the history
  • Loading branch information
tore-espressif committed Feb 13, 2024
1 parent 1415c25 commit 8b6917f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ repos:
- id: codespell
args: [-w, "--ignore-words=codespell-ignore-list"]

- repo: https://github.com/espressif/check-copyright/
rev: v1.0.3
hooks:
- id: check-copyright
args: ['-r', '--config', 'check_copyright_config.yaml']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
Expand Down
43 changes: 43 additions & 0 deletions check_copyright_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
DEFAULT:
perform_check: yes # should the check be performed?
# Sections setting this to 'no' don't need to include any other options as they are ignored
# When a file is using a section with the option set to 'no', no checks are performed.

# what licenses (or license expressions) are allowed for files in this section
# when setting this option in a section, you need to list all the allowed licenses
allowed_licenses:
- Apache-2.0
license_for_new_files: Apache-2.0 # license to be used when inserting a new copyright notice
new_notice_c: | # notice for new C, CPP, H, HPP and LD files
/*
* SPDX-FileCopyrightText: {years} Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: {license}
*/
new_notice_python: | # notice for new python files
# SPDX-FileCopyrightText: {years} Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: {license}
# comment lines matching:
# SPDX-FileCopyrightText: year[-year] Espressif Systems
# or
# SPDX-FileContributor: year[-year] Espressif Systems
# are replaced with this template prefixed with the correct comment notation (# or // or *) and SPDX- notation
espressif_copyright: '{years} Espressif Systems (Shanghai) CO LTD'

# You can create your own rules for files or group of files
libuvc:
include:
- 'host/class/uvc/usb_host_uvc/**'
allowed_licenses:
- Apache-2.0
- LGPL-2.1-or-later
license_for_new_files: Apache-2.0

tinyusb:
include:
- ' device/esp_tinyusb/**'
allowed_licenses:
- Apache-2.0
- MIT
license_for_new_files: Apache-2.0

0 comments on commit 8b6917f

Please sign in to comment.