rpmlint icon indicating copy to clipboard operation
rpmlint copied to clipboard

Provide did-you-mean functionality.

Open supakeen opened this issue 2 years ago • 3 comments

Hey there, just gauging interest as this is something I might want to add to rpmlint. As a starting packager some of the warnings such as the following:

python-token_bucket.src: W: invalid-license Apache 2

make it hard to find the list of valid licenses that should be used. I propose a few solutions for this to see which you'd prefer:

  1. Provide the list of valid licenses (or the location of where to find this list).
  2. Perform a quick spellcheck on the licenses, and list those with the shortest edit distance.
  3. Allow for common-mistakes (perhaps hard to define) that would directly show the substitute. e.g. a regular expression on license-name that matches Apache would directly suggest ASL 2.

My personal preference would go towards 1, and perhaps 2. Option 3 seems too cumbersome to maintain.

supakeen avatar Feb 25 '22 21:02 supakeen

make it hard to find the list of valid licenses that should be used. I propose a few solutions for this to see which you'd prefer:

  1. Provide the list of valid licenses (or the location of where to find this list).

Sure, please use --expain option for for that.

  1. Perform a quick spellcheck on the licenses, and list those with the shortest edit distance.

Feel free to come up with a pull request, python provides pretty nice functionality for it: https://docs.python.org/3/library/difflib.html

Anyway, thanks for the report and tell me please if my suggestion helps?

marxin avatar Feb 26 '22 09:02 marxin

Yea that helps, the --explain functionality I hadn't seen yet and that pretty much negates the first suggestion.

For the second one I'm on track to get you a PR, just minor tidbits to do. I'm a bit worried that adding informational output might break builds?

python-token_bucket.src: I: invalid-license-spellcheck BSD, DSL, 0BSD
python-token_bucket.src: W: invalid-license BDS

Just some edge case handling and the order of the messages to do there.

supakeen avatar Feb 26 '22 10:02 supakeen

Yea that helps, the --explain functionality I hadn't seen yet and that pretty much negates the first suggestion.

Great!

For the second one I'm on track to get you a PR, just minor tidbits to do. I'm a bit worried that adding informational output might break builds?

How would it break builds?

python-token_bucket.src: I: invalid-license-spellcheck BSD, DSL, 0BSD
python-token_bucket.src: W: invalid-license BDS

I can also imagine something like python-token_bucket.src: W: invalid-license BDS (did you mean BSD or DSL) or something like that?


Just some edge case handling and the order of the messages to do there.

marxin avatar Feb 26 '22 12:02 marxin