Skip to content

Commit

Permalink
Use text blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Dec 17, 2023
1 parent 13a1cd2 commit 7ccf3e6
Show file tree
Hide file tree
Showing 61 changed files with 9,402 additions and 8,930 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ void noBugPattern(@TempDir Path outputDirectory) {
Compilation.compileWithDocumentationGenerator(
outputDirectory,
"TestCheckerWithoutAnnotation.java",
"import com.google.errorprone.bugpatterns.BugChecker;",
"",
"public final class TestCheckerWithoutAnnotation extends BugChecker {}");
"""
import com.google.errorprone.bugpatterns.BugChecker;
public final class TestCheckerWithoutAnnotation extends BugChecker {}
""");

assertThat(outputDirectory.toAbsolutePath()).isEmptyDirectory();
}
Expand All @@ -25,14 +27,16 @@ void minimalBugPattern(@TempDir Path outputDirectory) {
Compilation.compileWithDocumentationGenerator(
outputDirectory,
"MinimalBugChecker.java",
"package pkg;",
"",
"import com.google.errorprone.BugPattern;",
"import com.google.errorprone.BugPattern.SeverityLevel;",
"import com.google.errorprone.bugpatterns.BugChecker;",
"",
"@BugPattern(summary = \"MinimalBugChecker summary\", severity = SeverityLevel.ERROR)",
"public final class MinimalBugChecker extends BugChecker {}");
"""
package pkg;
import com.google.errorprone.BugPattern;
import com.google.errorprone.BugPattern.SeverityLevel;
import com.google.errorprone.bugpatterns.BugChecker;
@BugPattern(summary = "MinimalBugChecker summary", severity = SeverityLevel.ERROR)
public final class MinimalBugChecker extends BugChecker {}
""");

verifyGeneratedFileContent(
outputDirectory,
Expand Down Expand Up @@ -60,25 +64,27 @@ void completeBugPattern(@TempDir Path outputDirectory) {
Compilation.compileWithDocumentationGenerator(
outputDirectory,
"CompleteBugChecker.java",
"package pkg;",
"",
"import com.google.errorprone.BugPattern;",
"import com.google.errorprone.BugPattern.SeverityLevel;",
"import com.google.errorprone.bugpatterns.BugChecker;",
"import org.junit.jupiter.api.Test;",
"",
"@BugPattern(",
" name = \"OtherName\",",
" summary = \"CompleteBugChecker summary\",",
" linkType = BugPattern.LinkType.CUSTOM,",
" link = \"https://error-prone.picnic.tech\",",
" explanation = \"Example explanation\",",
" severity = SeverityLevel.SUGGESTION,",
" altNames = \"Check\",",
" tags = BugPattern.StandardTags.SIMPLIFICATION,",
" disableable = false,",
" suppressionAnnotations = {BugPattern.class, Test.class})",
"public final class CompleteBugChecker extends BugChecker {}");
"""
package pkg;
import com.google.errorprone.BugPattern;
import com.google.errorprone.BugPattern.SeverityLevel;
import com.google.errorprone.bugpatterns.BugChecker;
import org.junit.jupiter.api.Test;
@BugPattern(
name = "OtherName",
summary = "CompleteBugChecker summary",
linkType = BugPattern.LinkType.CUSTOM,
link = "https://error-prone.picnic.tech",
explanation = "Example explanation",
severity = SeverityLevel.SUGGESTION,
altNames = "Check",
tags = BugPattern.StandardTags.SIMPLIFICATION,
disableable = false,
suppressionAnnotations = {BugPattern.class, Test.class})
public final class CompleteBugChecker extends BugChecker {}
""");

verifyGeneratedFileContent(
outputDirectory,
Expand Down Expand Up @@ -111,17 +117,19 @@ void undocumentedSuppressionBugPattern(@TempDir Path outputDirectory) {
Compilation.compileWithDocumentationGenerator(
outputDirectory,
"UndocumentedSuppressionBugPattern.java",
"package pkg;",
"",
"import com.google.errorprone.BugPattern;",
"import com.google.errorprone.BugPattern.SeverityLevel;",
"import com.google.errorprone.bugpatterns.BugChecker;",
"",
"@BugPattern(",
" summary = \"UndocumentedSuppressionBugPattern summary\",",
" severity = SeverityLevel.WARNING,",
" documentSuppression = false)",
"public final class UndocumentedSuppressionBugPattern extends BugChecker {}");
"""
package pkg;
import com.google.errorprone.BugPattern;
import com.google.errorprone.BugPattern.SeverityLevel;
import com.google.errorprone.bugpatterns.BugChecker;
@BugPattern(
summary = "UndocumentedSuppressionBugPattern summary",
severity = SeverityLevel.WARNING,
documentSuppression = false)
public final class UndocumentedSuppressionBugPattern extends BugChecker {}
""");

verifyGeneratedFileContent(
outputDirectory,
Expand Down
Loading

0 comments on commit 7ccf3e6

Please sign in to comment.