license-checker-rseidelsohn icon indicating copy to clipboard operation
license-checker-rseidelsohn copied to clipboard

`--unknown` flag is not respected when license is guessed as "Undefined", "UNLICENSED", or "Public Domain"

Open mtlewis opened this issue 4 months ago • 0 comments

The --unknown flag is described as having the following effect:

report guessed licenses as unknown licenses

From reviewing the code, it looks like this works by appending a * to guessed licenses (e.g. here), and then replacing licenses that end in * with UNKNOWN.

However, in a few cases the getLicenseTitle function doesn't append a '*', which means those license strings propagate even when --unknown is passed. The ones I can spot are "Undefined", "Public Domain", "Custom: " and "UNLICENSED".

The naive solution here would be to append a '*' onto those licenses too - but I wonder if it's worth considering a refactor here. Rather than trying to detect guessed licenses, could we consider skipping the guessing functionality entirely when --unknown is passed?

mtlewis avatar Sep 30 '24 17:09 mtlewis