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 26, 2024
1 parent 3f566f8 commit 2437c66
Show file tree
Hide file tree
Showing 75 changed files with 11,080 additions and 10,482 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,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 @@ -31,14 +33,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 All @@ -62,25 +66,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 All @@ -104,17 +110,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 2437c66

Please sign in to comment.