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

Add rule names to CLI outputs #4400

Merged
merged 12 commits into from
Feb 20, 2023
Merged

Add rule names to CLI outputs #4400

merged 12 commits into from
Feb 20, 2023

Conversation

alanmcruickshank
Copy link
Member

@alanmcruickshank alanmcruickshank commented Feb 17, 2023

This sets completes the CLI elements of #4031. It builds on the work done in #4399 (and I'm assuming we'll agree and merge that before moving on to this). I'll keep this PR in draft until that one is done, but I thought I'd open in early so people can feedback on the output (and also so I can make sure that tests pass 😺 ).

Specifically this PR adds out two CLI improvements to support named rules. To allow testing of those, it adds names, groups, and aliases (in the form of their future new code for now) - although I anticipate that we will do the actual recoding as a final separate PR.

sqlfluff rules

Firstly this adds names, groups and aliases (where present) to the sqlfluff rules command. The new output looks like this:

image

NOTE: The codes are still the existing codes rather than the proposed codes (as I've said above), but see that the new proposed codes are currently in as aliases.

This makes the CLI output much more verbose, but I thought it a good idea to be explicit on names, codes, groups and aliases in this CLI command to promote their use.

linting output

Secondly it adds the rule name to the linting output. The new output looks like this:

image

NOTE: I haven't added a name for L065 yet (so it shows no name - and that would also be true for a rule plugin which doesn't yet define a name), and for L001 there is a name, but it's only on a new line because there isn't space on the existing line. If there is space, then it should be on the same line.

Rather than trying to build the name into a table format as suggested in the original issue, this simply add the rule name to the end of the output which is closer to the pylint format. The main reason for that is that the current output conforms to an 80 character line width limit. If we try and fit another column within that 80 char limit there really isn't much space left for the description itself.

@coveralls
Copy link

coveralls commented Feb 17, 2023

Pull Request Test Coverage Report for Build 4222244003

  • 66 of 66 (100.0%) changed or added relevant lines in 19 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 4218160788: 0.0%
Covered Lines: 17267
Relevant Lines: 17267

💛 - Coveralls

@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (6f00ea3) compared to base (cae95d8).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4400   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          201       201           
  Lines        15409     15451   +42     
=========================================
+ Hits         15409     15451   +42     
Impacted Files Coverage Δ
src/sqlfluff/cli/formatters.py 100.00% <100.00%> (ø)
src/sqlfluff/cli/helpers.py 100.00% <100.00%> (ø)
src/sqlfluff/core/linter/common.py 100.00% <100.00%> (ø)
src/sqlfluff/core/linter/linter.py 100.00% <100.00%> (ø)
src/sqlfluff/core/rules/base.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L001.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L002.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L003.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L004.py 100.00% <100.00%> (ø)
src/sqlfluff/rules/L005.py 100.00% <100.00%> (ø)
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@pwildenhain pwildenhain left a comment

Choose a reason for hiding this comment

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

We're getting so close! Great work 👏🏻👏🏻

@alanmcruickshank alanmcruickshank enabled auto-merge (squash) February 20, 2023 10:07
@alanmcruickshank alanmcruickshank merged commit 19305b7 into main Feb 20, 2023
@alanmcruickshank alanmcruickshank deleted the ac/rules_names branch February 20, 2023 10:26
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