-
Notifications
You must be signed in to change notification settings - Fork 67
Add linter warning for empty clients #3761
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: iscai-msft <43154838+iscai-msft@users.noreply.github.com>
Co-authored-by: iscai-msft <43154838+iscai-msft@users.noreply.github.com>
commit: |
|
@copilot do the following
|
Co-authored-by: iscai-msft <43154838+iscai-msft@users.noreply.github.com>
Done!
The test cases cover:
|
tadelesh
left a comment
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.
For ARM cases, there always has a root client with no op and sub-clients from operation groups. Then this lint will always report for ARM case, which I don't think is a good lint.
| ); | ||
| // Check if the client is empty (has no methods and no children with operations) | ||
| // Only emit diagnostic if client.type is defined (client has a source TypeSpec type to attach the diagnostic to) | ||
| if (sdkClientType.methods.length === 0 && !sdkClientType.children?.length && client.type) { |
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.
| if (sdkClientType.methods.length === 0 && !sdkClientType.children?.length && client.type) { | |
| if (sdkClientType.methods.length === 0 && client.type) { |
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.
If no sub clients, this client will not exist.
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.
we should keep the diagnostic in this case though, we should have a diagnostic for an explicitly defined client with no methods and no sub-clients. That seems like unintentional behavior for users. This also won't trigger for ARM
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 mean you did not need the condition since it is filtered in caching process.
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Implementation Plan for Empty Client Linter Warning
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.