go-enry / go-license-detector

Reliable project licenses detector.
Other
127 stars 36 forks source link

Stable result order for entries with equal confidence #37

Open rockdaboot opened 3 months ago

rockdaboot commented 3 months ago

In case of two result entries with equal confidence level, the order of these entries is randomized. This makes comparing two result sets non-trivial.

This PR orders the result entries by confidence first and by license name second to achieve a stable output.

Example: The two top entries have the same confidence level and thus appear either as

$ ./license-detector https://github.com/gogo/protobuf | head -3
https://github.com/gogo/protobuf
        100%    BSD-2-Clause
        100%    0BSD

or as

https://github.com/gogo/protobuf
        100%    0BSD
        100%    BSD-2-Clause