Skip to content
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

Enhance SPDX check script with ignoring mechanism and improved flexibility #4190

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

OhmSpectator
Copy link
Member

This pull request focuses on enhancing the spdx-check.sh script by introducing an ignoring mechanism. This new feature allows the script to skip specific files or patterns, providing more control over which files are subjected to SPDX license checks. Additionally, the script has been refactored to improve maintainability and support for multiple Apache-2.0 compatible SPDX license identifiers.

Extracted file type check logic into a separate function
`file_to_be_checked`.

Extracted SPDX check logic into a separate function `check_spdx`. Make
the check case insesitive.

Simplified the main loop to use the new functions for better readability
and maintainability.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
…entifiers.

Updated `spdx-check.sh` to support multiple SPDX license identifiers.
This change allows the script to check for various Apache-2.0 compatible
licenses, ensuring compliance with a broader range of open-source
licenses.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
Introduce `.spdxignore` file to list paths to be ignored during SPDX
check. Add all `vendor` directories there.

Update `spdx-check.sh` script to read `.spdxignore`. Modified
`file_to_be_checked` function to skip files and directories listed in
`.spdxignore`.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
@OhmSpectator OhmSpectator enabled auto-merge (rebase) August 30, 2024 16:54
@OhmSpectator OhmSpectator self-assigned this Aug 30, 2024
@eriknordmark
Copy link
Contributor

Does the script already ignore everything in the vendor directories?

@eriknordmark
Copy link
Contributor

Would it make sense to check for a Copyright line in the same files?

(We can separately discuss whether the Copyright should include the current year - that should be done if there are significant changes but it is a bit painful for minor changes such as changing an import path in lots of files.)

@OhmSpectator
Copy link
Member Author

Does the script already ignore everything in the vendor directories?

It does, but I changed how we set up the ignored directories. Now, it works in an extensible way.

@OhmSpectator
Copy link
Member Author

Would it make sense to check for a Copyright line in the same files?

(We can separately discuss whether the Copyright should include the current year - that should be done if there are significant changes but it is a bit painful for minor changes such as changing an import path in lots of files.)

It's a good idea. We can add this check, but I would prefer to do it in a separate PR as it requires some extra logic.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OhmSpectator OhmSpectator merged commit 7976c7a into lf-edge:master Sep 2, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants