Skip to content

Conversation

@sschuberth
Copy link
Member

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.

@codecov
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f5c5f7d) 67.06% compared to head (2000181) 67.07%.
Report is 6 commits behind head on main.

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              
Flag Coverage Δ
funTest-non-docker 34.50% <ø> (ø)
test 36.15% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sschuberth sschuberth force-pushed the scancode-yaml-front-matter-removal branch from c2d89f1 to b0ac800 Compare November 16, 2023 17:18

licenseLines.joinToString("\n").trim()
}
}
Copy link
Member

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?

Copy link
Member Author

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 <sebastian@doubleopen.org>
@sschuberth sschuberth force-pushed the scancode-yaml-front-matter-removal branch from b0ac800 to 2000181 Compare November 17, 2023 10:21
@sschuberth sschuberth requested review from a team and fviernau November 17, 2023 10:22
@sschuberth sschuberth merged commit b9c038e into main Nov 17, 2023
@sschuberth sschuberth deleted the scancode-yaml-front-matter-removal branch November 17, 2023 11:21
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