-
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
Adapt New Rules To Old Rules #32297
Adapt New Rules To Old Rules #32297
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.
The conversion to ESLint is not ready to merge to main, and is already being tracked by this PR:
I don't think it's worth the complexity of supporting both versions of the tool at the same time in main. If you'd like to add rules before the ESLint conversion is done, you can add them to the existing implementation in main, and I can convert the rules to ESLint along with the rest, when I complete 31909.
I don't think this PR should be merged for two reasons:
|
I didn't use fancy ESLint functionalities, the most important and reusable part of this PR is using the ESLint's
|
type: KeyType.EmitterOption, | ||
expectedValue: /^azure(-\w+)+$/, | ||
exampleValue: "azure-placeholder", | ||
extraExplanation: |
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.
It seems most of the rule does not have 'extraExplaination' property which describes how to fix the problem.
Is it easy for users to understand how to fix the problem for those cases?
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.
Yes, the rules without extraExplanation
already straight forward enough. extraExplanation
is used explain complex expectedValue
. Below is the output of running a rule validation:
Executing rule: tspconfig-ts-mgmt-modular-generate-metadata-true
Validation failed.
Error: 'options.@azure-tools/typespec-ts.generateMetadata' is NOT set to 'true' in tspconfig.yaml.
Action: Set 'options.@azure-tools/typespec-ts.generateMetadata' to 'true' in tspconfig.yaml.
Example:
'''
options:
"@azure-tools/typespec-ts":
generateMetadata: true
'''
Additionally, the output will contains the action to correct the option and the sample of the option.
@wanlwanl - This doesn't appear related to any ARM APIs, so I'm skipping ARM review. Removing WaitForARMFeedback to get it out of the queue. LMK, if you need anything from ARM reviewers. |
Converting to draft until ESLint conversion is ready to merge to main |
Background
Problems
Current tool/CI lacks of approaches to validate emitter's options and parameters in
tspconfig.yaml
. Sometimes, PR authors fails to add correct options for emitters. e.g. 1. SDK automation will fail 2. JS emitter has multiple types of clients (HLC/RLC/Modular), each types requires different options with specific values, if PR authors dismatch some options for another type of client, the SDK automation may generate successfully, but the generated code is incorrect and useless.We have monitored spec PRs for several weeks, and found many SDK automations are suffering from this issue. For now, we have to verify the tspconfig manually for problematic PR. Since some vacations will make a whole team OOF, and the manual answers will be unavailable in these periods, and the document to guide configure emitter options is also not ready.
When the entire team who responsible for answering questions for failed SDK automation are OOF. And only one dev from another team will help to monitor the sdk automation and answer questions. The FTE may not know all the details about the configurations. Then it's a challenge to resolve service team's sdk automation failure problems for this dev.
Use Case
The added rules is used to assist reviewers/monitoring guys making sure the tspconfig is correct before furthur troubleshooting when answering questions raised from sepc authors when SDK automation fails. Spec authors are not the audience of this PR, since the messages are warning messages. In typical PR review, spec authors don't get these messages easily (assume that few spec author will check successful checks) since the check result is success even though the validation is failed.
Solution
error
/problem
, etc. which will be used for long term, but the converted rules will only output warning messages for short term, in order to avoid blocking current review flow. The warning messages are mainly used by the FTE who is reponsible for answering questions for failed sdk automation, and provide an unique action to let service team to correcttspconfig.yaml
for each rule.