Skip to content

Commit

Permalink
Use text blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Mar 17, 2024
1 parent bc11baf commit 167f021
Show file tree
Hide file tree
Showing 68 changed files with 10,263 additions and 9,720 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 167f021

Please sign in to comment.