Skip to content
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

Fixes on Check on checkstyle #5003

Merged
merged 12 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.tools.checkstyle.checks;

Expand All @@ -19,8 +19,8 @@
*/
public class OnlyFinalFieldsForImmutableClassCheck extends AbstractCheck {
private static final String IMMUTABLE_NOTATION = "Immutable";
private static final String ERROR_MSG = "The variable field ''%s'' should be final." +
"Classes annotated with @Immutable are supposed to be immutable.";
private static final String ERROR_MSG = "The variable field ''%s'' should be final."
+ "Classes annotated with @Immutable are supposed to be immutable.";

private boolean hasImmutableAnnotation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void visitToken(DetailAST token) {
// method name has prefix 'build' but not 'build*Client' or 'build*AsyncClient'
if (!methodName.endsWith("Client")) {
log(token, String.format(
"@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''." , methodName));
"@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''.", methodName));
}
break;
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.tools.checkstyle.checks;

import com.puppycrawl.tools.checkstyle.api.DetailAST;
Expand Down Expand Up @@ -39,7 +42,7 @@ protected static boolean hasIllegalCombination(DetailAST modifiers) {
Optional<DetailAST> illegalCombination = TokenUtil.findFirstTokenByPredicate(modifiers, (node) -> {
final int type = node.getType();
return INVALID_FINAL_COMBINATION.contains(node.getType()) || (TokenTypes.ANNOTATION == type
&& INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText()));
&& INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText()));
});

return illegalCombination.isPresent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck" files=".*[/\\]samples[/\\].*\.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.HttpPipelinePolicyCheck" files=".*[/\\]samples[/\\].*\.java"/>

<!-- Custom checkstyle rules that don't apply to files under checkstyle package -->
mssfang marked this conversation as resolved.
Show resolved Hide resolved
<suppress checks="com\.azure\.tools\.checkstyle\.checks\..+" files=".*[/\\]tools[/\\]checkstyle[/\\].*"/>

<!-- JavaPackage suppression -->
<suppress checks="JavadocPackage" files=".*[/\\]samples[/\\].*\.java"/>

Expand Down