Skip to content

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.

alfonsodev pushed a commit to ExponentiaTeam/sqlc that referenced this pull request Oct 13, 2025
* Extended the `@sqlc-vet-disable` flag to support the skipping of provided 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.

* Updated tests to cover new vet disabling behaviour.

* Relocated constants for query flags to a dedicated package to allow for safer reuse.

* Renamed the metadata `ParseParamsAndFlags()` function to `ParseCommentFlags()` in order to be more generic as it now returns the rule skip list and could potentially return more data in the future.

* Updated docs to reflect the support of rule names for the vet disable annotation.

* Slight term change in vet docs.

* Renamed test function for query rule skiplist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants