Skip to content

Conversation

juev
Copy link
Contributor

@juev juev commented Jul 9, 2025

This pull request introduces significant updates to the license validation logic in the pkg/linters/module/rules package. The changes enhance the ability to differentiate between Community Edition (CE) and Enterprise Edition (EE) licenses, streamline file filtering, and improve modularity by removing unused imports and redundant code.

License Validation Enhancements:

  • Added a new LicenseType enumeration to distinguish between CE and EE licenses, and implemented the getLicenseType function to determine the expected license type based on file paths. Files in directories starting with "ee" are expected to have an EE license, while others default to a CE license. (pkg/linters/module/rules/license_library.go, pkg/linters/module/rules/license_library.goL51-R80)
  • Introduced a new regular expression, EELicenseRe, to validate EE license headers. Updated the checkFileCopyright function to validate the license type based on the file path and provide detailed error messages when mismatches occur. (pkg/linters/module/rules/license_library.go, [1] [2]

Code Simplification:

Additional Improvements:

Evsyukov Denis added 3 commits July 9, 2025 15:49
- Added `getLicenseType` function to determine expected license type based on file path.
- Enhanced `checkFileCopyright` to validate files against CE and EE license requirements.
- Introduced comprehensive test cases for license detection and validation logic.
- Changed copyright year from 2021 to 2025 in various test cases and regex patterns for license validation.
- Enhanced regex for EE license to match the updated copyright format.
- Added new tests to verify the correct matching of the updated license format.
- Modified the file retrieval method in `CheckFiles` to include hidden files by changing the second parameter of `fsutils.GetFiles` from `false` to `true`.
- This change ensures that all relevant files, including hidden ones, are considered during license checks.
@juev juev self-assigned this Jul 9, 2025
Evsyukov Denis added 3 commits July 9, 2025 16:18
- Modified the regex pattern for EE license to improve matching accuracy.
- Updated test cases to reflect changes in license comment format from single-line to multi-line.
- Adjusted file permissions in test setup to enhance security by restricting access.
- Changed file permissions for the wrong license test file from 0644 to 0600 to enhance security by restricting access.
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.

1 participant