#1064 Provide a switch to turn off CheckStyle on generated test sources

This commit is contained in:
Oliver Erhart 2023-12-27 13:40:04 +01:00 committed by GitHub
parent 6d99f7b8f3
commit 7e6fee8714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,11 +182,15 @@ abstract class CompilingExtension implements BeforeEachCallback {
assertDiagnostics( actualResult.getDiagnostics(), expectedResult.getDiagnostics() );
assertNotes( actualResult.getNotes(), expectedResult.getNotes() );
if ( !findAnnotation( testClass, DisableCheckstyle.class ).isPresent() ) {
if ( !findAnnotation( testClass, DisableCheckstyle.class ).isPresent() && !skipCheckstyleBySystemProperty() ) {
assertCheckstyleRules();
}
}
private static boolean skipCheckstyleBySystemProperty() {
return Boolean.parseBoolean( System.getProperty( "checkstyle.skip" ) );
}
private void assertCheckstyleRules() throws Exception {
if ( sourceOutputDir != null ) {
Properties properties = new Properties();