Skip to content

fix(freemarker): Remove uncategorized licenses from category filter #10231

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MarcelBochtler
Copy link
Member

Before, filterForCategory() returned all licenses that were uncategorized. While this behavior is documented, the behavior is not expected for a function with this name, and it seems like this was an unintentional change in 1.

Before, `filterForCategory()` returned all licenses that were
uncategorized. While this behavior is documented, the behavior is not
expected for a function with this name, and it seems like this was an
unintentional change in [1].

[1]: ab43f69

Signed-off-by: Marcel Bochtler <[email protected]>
@MarcelBochtler MarcelBochtler requested a review from a team as a code owner April 28, 2025 12:38
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.57%. Comparing base (03f7e54) to head (cbe956b).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #10231   +/-   ##
=========================================
  Coverage     56.57%   56.57%           
  Complexity     1610     1610           
=========================================
  Files           330      330           
  Lines         12388    12388           
  Branches       1172     1172           
=========================================
  Hits           7008     7008           
  Misses         4910     4910           
  Partials        470      470           
Flag Coverage Δ
funTest-docker 68.96% <ø> (ø)
test-ubuntu-24.04 39.39% <ø> (ø)
test-windows-2022 39.37% <ø> (ø)

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MarcelBochtler
Copy link
Member Author

MarcelBochtler commented Apr 28, 2025

I will fix the failing test after a reviewer agrees with me that this is the way this function should handle uncategorized licenses.

*/
@Suppress("UNUSED") // This function is used in the templates.
fun filterForCategory(licenses: Collection<ResolvedLicense>, category: String): List<ResolvedLicense> =
licenses.filter { resolvedLicense ->
input.licenseClassifications[resolvedLicense.license]?.contains(category) != false
input.licenseClassifications[resolvedLicense.license]?.contains(category) ?: false
Copy link
Member

Choose a reason for hiding this comment

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

The notice templates still uses filterForCategory(), and IIUC these intends to include exactly the licenses which are either / or:

  1. uncategorized
  2. categorized with the (provided) include-in-notice category.

I suppose that this behavior shall stay as is. So, I think this PR should account for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if I understand you correctly.
Is your proposal

  1. Create a new function that returns the uncategorized licenses in addition to the proposed change? And additionally adjust the notice template?
    Or is it
  2. Closing this PR and keeping the functionality as-is?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if I understand you correctly.

ORT has the files NOTICE_DEFAULT.ftl and NOTICE_SUMMARY.ftl.
I believe that the output should of these templates should remain unaffected by this PR.
This could be achieved with option #1 above IIUC.

@MarcelBochtler
Copy link
Member Author

Question:
As this change may remove certain licenses shown in the produced reports, should we consider this as breaking change?

@fviernau
Copy link
Member

As this change may remove certain licenses shown in the produced reports, should we consider this as breaking change?

I believe it should be marked breaking. But still there is a risk that it goes unnoticed.
As inclusion of licenses is a bit critical area, we can consider even renaming the function, so that existing templates fail hard. What do you think @oss-review-toolkit/core-devs ?

@sschuberth
Copy link
Member

As inclusion of licenses is a bit critical area, we can consider even renaming the function, so that existing templates fail hard. What do you think @oss-review-toolkit/core-devs ?

Maybe add a mandatory includeUncategorized boolean parameter to the function to force users to make a decision?

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