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

lib: add suggestions on invalid subsystems #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

richardlau
Copy link
Member

When an invalid subsystem is encountered, attempt to make a suggestion
based on the nearest match (if any) from the valid subsystems.

Example:

     ✔  0:0      skipping fixes-url                        fixes-url
     ✔  0:0      blank line after title                    line-after-title
     ✔  0:0      line-lengths are valid                    line-length
     ✖  0:0      Invalid subsystem: "error", did you mean "errors"? subsystem
     ✔  0:0      Title is formatted correctly.             title-format
     ✔  0:0      Title is <= 50 columns.                   title-length

When an invalid subsystem is encountered, attempt to make a suggestion
based on the nearest match (if any) from the valid subsystems.
@richardlau
Copy link
Member Author

richardlau commented Apr 16, 2019

Can we wrap this somehow? It currently breaks the table.

Updated. Now looks like this:

     ✔  0:0      skipping fixes-url                        fixes-url
     ✔  0:0      blank line after title                    line-after-title
     ✔  0:0      line-lengths are valid                    line-length
     ✖  0:0      Invalid subsystem: "error"                subsystem
                 Did you mean "errors"?
     ✔  0:0      Title is formatted correctly.             title-format
     ✔  0:0      Title is <= 50 columns.                   title-length

(Not sure why GitHub isn't aligning the Did you mean "errors"? line -- It's lined up properly on my Linux and Windows consoles. EDIT: ah it looks like the tick/cross glyphs are rendering at a different width, at least for me in Firefox on Windows).

@richardlau
Copy link
Member Author

This is how it looks in an actual console:
image

@@ -111,11 +113,16 @@ module.exports = {
for (const sub of parsed.subsystems) {
if (!~subs.indexOf(sub)) {
failed = true
let suggestion = ''
const suggestions = new FuzzySet(subs).get(sub)
Copy link
Contributor

Choose a reason for hiding this comment

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

A small suggestion. It might be better to create the FuzzySet once instead of creating it for every iteration of the for loop.

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.

3 participants