-
Notifications
You must be signed in to change notification settings - Fork 19
License banner check config files #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cb5cf4e
ccf6195
fe7b34a
1c4ce52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,68 +1,68 @@ | ||
| # These are some examples of commonly ignored file patterns. | ||
| # You should customize this list as applicable to your project. | ||
| # Learn more about .gitignore: | ||
| # https://www.atlassian.com/git/tutorials/saving-changes/gitignore | ||
| # Zephyr build folder | ||
| build/ | ||
| # Zephyr native_sim/POSIX simulated flash | ||
| *.bin | ||
| # Generated files | ||
| *.g | ||
| # Node artifact files | ||
| node_modules/ | ||
| dist/ | ||
| # Compiled Java class files | ||
| *.class | ||
| # Compiled Python bytecode | ||
| *.py[cod] | ||
| # Log files | ||
| *.log | ||
| # Package files | ||
| *.jar | ||
| # Maven | ||
| target/ | ||
| dist/ | ||
| # Unit test reports | ||
| TEST*.xml | ||
| # Generated by Windows | ||
| Thumbs.db | ||
| # Applications | ||
| *.app | ||
| *.exe | ||
| *.war | ||
| # Large media files | ||
| *.mp4 | ||
| *.tiff | ||
| *.avi | ||
| *.flv | ||
| *.mov | ||
| *.wmv | ||
| # Generated by VS | ||
| settings.json | ||
| src/common/include/ocre/commit_id.h | ||
| **/.DS_Store | ||
| # hidden files | ||
| .* | ||
| !.git | ||
| !.gitignore | ||
| !/.gitmodules | ||
| !/.github | ||
| !.devcontainer | ||
| !.clang-format | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Zephyr build folder | ||
| build/ | ||
|
|
||
| # Zephyr native_sim/POSIX simulated flash | ||
| *.bin | ||
|
|
||
| # Generated files | ||
| *.g | ||
|
|
||
| # Node artifact files | ||
| node_modules/ | ||
| dist/ | ||
|
|
||
| # Compiled Java class files | ||
| *.class | ||
|
|
||
| # Compiled Python bytecode | ||
| *.py[cod] | ||
|
|
||
| # Log files | ||
| *.log | ||
|
|
||
| # Package files | ||
| *.jar | ||
|
|
||
| # Maven | ||
| target/ | ||
| dist/ | ||
|
|
||
| # Unit test reports | ||
| TEST*.xml | ||
|
|
||
| # Generated by Windows | ||
| Thumbs.db | ||
|
|
||
| # Applications | ||
| *.app | ||
| *.exe | ||
| *.war | ||
|
|
||
| # Large media files | ||
| *.mp4 | ||
| *.tiff | ||
| *.avi | ||
| *.flv | ||
| *.mov | ||
| *.wmv | ||
|
|
||
| # Generated by VS | ||
| settings.json | ||
|
|
||
| src/common/include/ocre/commit_id.h | ||
|
|
||
| **/.DS_Store | ||
|
|
||
| # hidden files | ||
| .* | ||
| !.git | ||
| !.gitignore | ||
| !/.gitmodules | ||
| !/.github | ||
| !.devcontainer | ||
| !.clang-format |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,65 @@ | ||||
| #!/bin/sh | ||||
| # @copyright Copyright (c) contributors to Project Ocre, | ||||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||||
| # | ||||
| # SPDX-License-Identifier: Apache-2.0 | ||||
|
|
||||
| # Checks all C/C++ files for license banner | ||||
|
|
||||
| set -e | ||||
|
|
||||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||||
| ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" | ||||
| SRC_DIR="$ROOT_DIR/src" | ||||
|
|
||||
| check_license_banner() { | ||||
| local file="$1" | ||||
| local file_header | ||||
| local start_line=1 | ||||
|
|
||||
| # Check first line and skip if it's a shebang line(only for .sh scripts) | ||||
| local first_line | ||||
| first_line=$(head -n 1 "$file") | ||||
| if [ "${first_line#\#\!/bin}" != "$first_line" ]; then | ||||
| start_line=2 | ||||
| fi | ||||
|
|
||||
| file_header=$(tail -n +$start_line "$file" | head -n 4) | ||||
|
|
||||
| # Expected license banner | ||||
| local expected_banner="# @copyright Copyright (c) contributors to Project Ocre, | ||||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||||
| # | ||||
| # SPDX-License-Identifier: Apache-2.0" | ||||
|
|
||||
| if [ "$file_header" != "$expected_banner" ]; then | ||||
| echo "ERROR: Missing or incorrect license banner in $file" | ||||
| return 1 | ||||
| fi | ||||
|
|
||||
| return 0 | ||||
| } | ||||
|
|
||||
| echo "Checking license banners." | ||||
| ERROR_FOUND=0 | ||||
| for file in $(find . -type f \( -name 'CMakeLists.txt' -o -name '*.yaml' \ | ||||
| -o -name '*.yml' -o -name '*.awk' -o -name '*.conf' -o -name 'Kconfig*' \ | ||||
| -o -name '.gitignore' -o -name '.gitmodules' -o -name '*.sh' -o -name '*.cmake' \) \ | ||||
| ! -name 'utlist.h' \ | ||||
| ! -path './tests/Unity/*' \ | ||||
| ! -path './build/*' \ | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be no build folder. What if the build folder is somewhere else? |
||||
| ! -path './wasm-micro-runtime/*' \ | ||||
| ! -path './ocre-sdk/*' \ | ||||
| ! -path './src/shell/sha256/*' \ | ||||
| ! -path './src/runtime/wamr-wasip1/ocre_api/utils/*' \ | ||||
| | sort); do | ||||
|
|
||||
| if ! check_license_banner "$file"; then | ||||
| ERROR_FOUND=1 | ||||
| fi | ||||
casaroli marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| done | ||||
|
|
||||
| if [ $ERROR_FOUND -ne 0 ]; then | ||||
| echo "License check failed." | ||||
| exit 1 | ||||
| fi | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config SHIELD_ENC28J60 | ||
| def_bool $(shields_list_contains,enc28j60) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config SHIELD_WIZNET_W5500 | ||
| def_bool $(shields_list_contains,wiznet_w5500) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| echo "Cleanup is complete" | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| echo "Cleanup is complete" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| echo "Setup is complete" | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| echo "Setup is complete" |

Uh oh!
There was an error while loading. Please reload this page.