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

Sort project group order in HTML report using license keys #433

Conversation

monae
Copy link
Contributor

@monae monae commented Feb 2, 2024

Closes #409.

This PR introduces the stable order of project groups in HTML report.
It makes it less likely that changes in dependencies will result in large diffs of output.

Project groups are sorted by their respective license keys.
A real-world example will looks like this:

(no licenses)
[apache-2.0.txt, https://github.com/facebook/facebook-android-sdk/blob/main/LICENSE.txt, https://www.facebook.com/legal/audience_network_beta_sdk_terms]
[apache-2.0.txt]
[bsd-2-clause.txt]
[bsd-3-clause.txt]
[epl-2.0.txt]
[https://developer.android.com/guide/playcore/license]
[https://developer.android.com/studio/terms.html]
[https://github.com/facebook/facebook-android-sdk/blob/main/LICENSE.txt]
[mit.txt]

val sortedProjectsList =
projectsMap.entries.map { (key, projects) ->
Pair(key, projects.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name }))
}.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { (key, license) -> key })
Copy link
Owner

Choose a reason for hiding this comment

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

Possible to remove unused variable license or use _?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed 7477790

@jaredsburrows jaredsburrows merged commit 955a489 into jaredsburrows:master Feb 2, 2024
2 checks passed
@jaredsburrows
Copy link
Owner

Thanks!

@monae monae mentioned this pull request Feb 8, 2024
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.

Project group order on HTML report is unstable
2 participants