Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow selective disabling of rules per query #3620

Merged

Conversation

rhodeon
Copy link
Contributor

@rhodeon rhodeon commented Sep 29, 2024

This resolves #3619 and has some minor refactor in regards to reusable constants.

As mentioned there, the @sqlc-vet-disable query annotation now accepts a list of rules to skip:

/* @sqlc-vet-disable sqlc/db-prepare no-pg */

Providing just /* @sqlc-vet-disable */ without any parameters retains the previous behaviour of skipping all rules for a query.

@rhodeon rhodeon force-pushed the selectively-disable-rules-per-query branch from 90c4935 to 7a16c28 Compare September 29, 2024 03:02
@rhodeon
Copy link
Contributor Author

rhodeon commented Oct 17, 2024

@kyleconroy, can you please confirm if this is something worth having?
We have quite a few queries which benefit from it.

…ided rules.

This is an update to the original behaviour which had an "all-or-nothing" behaviour, either running all the rules on a query or skipping them all.
Specified rules which aren't declared in the sqlc config file get rejected.
…tFlags()` in order to be more generic as it now returns the rule skip list and could potentially return more data in the future.
@kyleconroy kyleconroy force-pushed the selectively-disable-rules-per-query branch from 09308a8 to 474ee13 Compare November 25, 2024 06:37
@rhodeon
Copy link
Contributor Author

rhodeon commented Dec 1, 2024

Hey, @kyleconroy. 🫡
I noticed you made a push for this about a week ago.
Is there something else I need to do for it to be merged into main?

@kyleconroy kyleconroy merged commit 5ee2c0b into sqlc-dev:main Dec 2, 2024
8 checks passed
@kyleconroy
Copy link
Collaborator

@rhodeon thanks for the updated push. The docs and tests are great! This will go out with the next release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow selective disabling of rules per query
2 participants