-
Notifications
You must be signed in to change notification settings - Fork 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
Custom CheckStyle: Batch 2, Rule #5 and #10; Batch 3, Rule #1 and #6 #4712
Conversation
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Show resolved
Hide resolved
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.
asking just for a few code enhacements
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
@@ -168,7 +187,8 @@ private void checkClassField(DetailAST objBlockToken) { | |||
// VARIABLE_DEF token will always MODIFIERS token. If there is no modifier at the variable, no child under | |||
// MODIFIERS token. Also the previous sibling of OBJBLOCK will always be class name IDENT node. | |||
if (!modifiersToken.branchContains(TokenTypes.FINAL)) { | |||
log(modifiersToken, String.format("The variable field ''%s'' of class ''%s'' should be final. Classes annotated with @ServiceClient are supposed to be immutable.", |
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.
update this for to use TokenUtil.forEachChild(token, condition, predicate -> ….)
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.
not sure why to use forEachChild here.
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
...reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java
Outdated
Show resolved
Hide resolved
…into CS-Service-Method
…into CS-Service-Method
…into CS-Service-Method
eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
Show resolved
Hide resolved
...code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java
Outdated
Show resolved
Hide resolved
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.
Some feedback to address. Should be easy.
Batch 2
Rule # 5
Service client methods: All methods that are in a class annotated with @ServiceClient, where the method has a @ServiceMethod annotation, should follow these rules:
Rule # 10
'withResponse' naming pattern: All methods annotated with @ServiceMethod that return a Response (or Mono) must have their method name end with 'withResponse'. If the service method does not return a Response or Mono, it must not end with 'withResponse'.
Batch 3
Rule # 1
Context in all the right places: Context should be passed in as an argument to all public methods annotated with @ServiceMethod that return Response in sync clients.
Rule # 6
Async client should have
async = true
property set in @ServiceClient annotationChange class Context to be final