-
Notifications
You must be signed in to change notification settings - Fork 314
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
fix: Remove any YAML front matter from ScanCode license files #7883
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7883 +/- ##
============================================
+ Coverage 67.06% 67.07% +0.01%
Complexity 2041 2041
============================================
Files 356 356
Lines 17045 17051 +6
Branches 2438 2438
============================================
+ Hits 11431 11437 +6
Misses 4594 4594
Partials 1020 1020
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
c2d89f1
to
b0ac800
Compare
|
||
licenseLines.joinToString("\n").trim() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to extract lines 134-144 into a functions e.g. getScanCodeLicenseText(id, dir)
and add a test which calls it for a file which has such YAML in the header, to show it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I've actually improved the algorithm a bit as part of adding the test.
ScanCode 32.0.0 started to prepend its `*.LICENSE` files with YAML-encoded metadata, see [1]. This is a hot fix to remove this header, if present, from the license files. A better solution will be implemented later as part of a larger refactoring of license providers. Different ScanCode versions also differ in whether license files come with a final newline or not. Align on not having a final newline to make tests pass either way. [1]: aboutcode-org/scancode-toolkit#3100 Signed-off-by: Sebastian Schuberth <[email protected]>
b0ac800
to
2000181
Compare
ScanCode 32.0.0 started to prepend its
*.LICENSE
files with YAML-encoded metadata, see 1. This is a hot fix to remove this header, if present, from the license files. A better solution will be implemented later as part of a larger refactoring of license providers.Different ScanCode versions also differ in whether license files come with a final newline or not. Align on not having a final newline to make tests pass either way.