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

Provide did-you-mean functionality. #818

Open
supakeen opened this issue Feb 25, 2022 · 3 comments
Open

Provide did-you-mean functionality. #818

supakeen opened this issue Feb 25, 2022 · 3 comments

Comments

@supakeen
Copy link

supakeen commented Feb 25, 2022

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.

@marxin
Copy link
Contributor

marxin commented Feb 26, 2022

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?

@supakeen
Copy link
Author

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.

@marxin
Copy link
Contributor

marxin commented Feb 26, 2022

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.

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

No branches or pull requests

2 participants