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

Fix checkstyle version drift and API change #88283

Merged
merged 3 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -32,9 +32,9 @@
import com.puppycrawl.tools.checkstyle.utils.ScopeUtil;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
* This is a copy of Checkstyle's {@link com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck},
Expand All @@ -59,10 +59,10 @@ public class MissingJavadocTypeCheck extends AbstractCheck {
private Pattern ignorePattern = Pattern.compile("^$");

/**
* Specify the list of annotations that allow missed documentation.
* Specify the set of annotations that allow missed documentation.
* Only short names are allowed, e.g. {@code Generated}.
*/
private List<String> skipAnnotations = Collections.singletonList("Generated");
private Set<String> skipAnnotations = Set.of("Generated");

/**
* Setter to specify the visibility scope where Javadoc comments are checked.
Expand All @@ -89,7 +89,7 @@ public void setExcludeScope(Scope excludeScope) {
* @param userAnnotations user's value.
*/
public void setSkipAnnotations(String... userAnnotations) {
skipAnnotations = Arrays.asList(userAnnotations);
skipAnnotations = Arrays.stream(userAnnotations).collect(Collectors.toSet());
}

/**
Expand Down Expand Up @@ -149,10 +149,7 @@ private boolean shouldCheck(final DetailAST ast) {

return customScope.isIn(scope)
&& (surroundingScope == null || surroundingScope.isIn(scope))
&& (excludeScope == null
|| !customScope.isIn(excludeScope)
|| surroundingScope != null
&& !surroundingScope.isIn(excludeScope))
&& (excludeScope == null || !customScope.isIn(excludeScope) || surroundingScope != null && !surroundingScope.isIn(excludeScope))
&& !AnnotationUtil.containsAnnotation(ast, skipAnnotations)
&& ignorePattern.matcher(outerTypeName).find() == false;
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/build.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apache-rat = "org.apache.rat:apache-rat:0.11"
asm = { group = "org.ow2.asm", name="asm", version.ref="asm" }
asm-tree = { group = "org.ow2.asm", name="asm-tree", version.ref="asm" }
bytebuddy = "net.bytebuddy:byte-buddy:1.12.10"
checkstyle = "com.puppycrawl.tools:checkstyle:10.1"
checkstyle = "com.puppycrawl.tools:checkstyle:10.3"
commons-codec = "commons-codec:commons-codec:1.11"
commmons-io = "commons-io:commons-io:2.2"
docker-compose = "com.avast.gradle:gradle-docker-compose-plugin:0.14.13"
Expand Down