-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Support Sub Rule Suppression in TypeSpec Validation Tool #32811
base: main
Are you sure you want to change the base?
Conversation
Next Steps to MergeNext steps that must be taken to merge this PR:
|
PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
Hi @mikeharder , please note that I didn't add the wild card support sub-rules, because I don't want to encourage customer to suppress the whole emitter's options, I don't want to make it too easy at least, since our goal is to make all RPs configure all the options for all languages. |
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 added rules and sub-rules to suppressions in this PR:
Please adjust this PR accordingly. I reverted changes to the core rules engine and the rules other than sdk-tspconfig-validation
, because they should only need minimal changes in this PR. Most of the changes should be contained to your rule. We may need to tweak the code in index.ts
to distinguish between suppressions for "all of TSV" and "suppressions for rules and/or sub-rules".
Your rule can decide how to interpret the sub-rule strings in the suppression. Exact match, regex, etc. |
|
Currently, the only rule in TSV that supports suppressions (rule or sub-rule) is
I don't understand your objection to the name
I want to make the core |
Confirmed that this is what the reviewer wants, and I will continue the implementation based on the existing design. |
@mikeharder updated, please review it |
@wanlwanl: I updated the PR to only suppress SdkTspConfigValidation, and simplify the implementation and tests. I removed the code in But, this might actually be what you want, if spec authors should never disable your entire rule (only sub-rules). |
Background
Validation rules for
tspconfig.yaml
are already added to TypeSpec validation tool to verify all parameters and options intspconfig.yaml
. But some RP may not want to add the some options for some emitter to get a special result, or just leave options for some emitters.Intrduction
This PR adds the supports for sub-rule suppression in the TypeSpec validation tool.
Add
sub-rules
field to support suppress sub rules in some rule to gain finer control.Sample
suppressions.yaml
:TODO
Add doc for how to configure the
suppressions.yaml
in next PR.