-
Notifications
You must be signed in to change notification settings - Fork 0
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
[NOREF] Add SQLFluff linter #2904
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
UNION | ||
SELECT modified_by AS username | ||
FROM trb_request_system_intakes | ||
) AS combined_usernames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: good lord what is this? Unions pulling data from every table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mynar7 , yeah this was for migrating to the user account table. We needed to get the usernames that might not have a user account representation.
For some reason this PR is now failing the I might need to make another PR to address that https://github.com/CMS-Enterprise/easi-app/actions/runs/12031770967/job/33545711634#step:8:169 |
- id: sqlfluff-fix | ||
exclude: ^migrations/ | ||
- id: sqlfluff-lint | ||
exclude: ^migrations/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've addressed ignoring old migrations if you want to lint any new ones
CMS-Enterprise/mint-app#1538.
Note, anytime we upgrade linter versions, we likely would want to update the regex to not change indentation etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna merge this PR as-is and we can loop back on enabling this for migrations later, if that's alright!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's great with me!
NOREF
Description
This will lint all
.sql
files that don't live in the/migrations
folder (since we can't edit old migrations, running this linter on that folder would result in that)Note
We're using the SQLFluff core rules by default, but feel free to look at all the rules to see if anything else would be useful!
How to test this change
.sql
file (somewhere in/pkg
would be easiest) to update something like indentation, casing, or formatpre-commit run --all sqlfluff-fix
Important
There's a lot of files touched in this PR - exhaustively going over each one in detail probably isn't reasonable, but I recommend looking over each generally to make sure the types of changes are what we're comfortable with (spacing? formatting? indentation? capitalization?)
PR Author Checklist
PR Reviewer Guidelines