Hi Guys,
I am using scalaStyle maven plugin for my scala project. And I am using checkstyle-report for my bitbucket pipeline. The problem is, pipeline is not able to parse the scalaStyle xml. And I see no result in report.
pom.xml
<plugin>
<groupId>org.scalastyle</groupId>
<artifactId>scalastyle-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<verbose>false</verbose>
<failOnViolation>false</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<failOnWarning>false</failOnWarning>
<sourceDirectory>${project.basedir}/src/main/scala</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/scala</testSourceDirectory>
<configLocation>${project.basedir}/scalastyle_config.xml</configLocation>
<outputFile>${project.basedir}/checkstyle-result.xml</outputFile>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
bitbucket-pipelines.yml
I tried both 0.2.0 and 0.3.0 version and same error.
pipelines:
default:
- parallel:
- step:
name: CheckStyle
script:
- mvn scalastyle:check
after-script:
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
- pipe: atlassian/checkstyle-report:0.3.0
variables:
DEBUG: 'true' # please document this flag
- step:
name: Build and Test
script:
- mvn clean compile test
Error
<span>java.lang.RuntimeException: "line" not found in "<error severity="error" message="Expected identifier, but got Token(RPAREN,),1282,))"/>"</span>
<span>at se.bjurr.violations.lib.util.ViolationParserUtils.getAttribute(<a href="http://violationparserutils.java:81/" rel="noopener nofollow noreferrer" target="_blank">ViolationParserUtils.java:81</a>)</span>
<span>at se.bjurr.violations.lib.util.ViolationParserUtils.getIntegerAttribute(<a href="http://violationparserutils.java:128/" rel="noopener nofollow noreferrer" target="_blank">ViolationParserUtils.java:128</a>)</span>
<span>at se.bjurr.violations.lib.parsers.CheckStyleParser.parseReportOutput(<a href="http://checkstyleparser.java:32/" rel="noopener nofollow noreferrer" target="_blank">CheckStyleParser.java:32</a>)</span>
<span>at se.bjurr.violations.lib.reports.Parser.findViolations(<a href="http://parser.java:117/" rel="noopener nofollow noreferrer" target="_blank">Parser.java:117</a>)</span>
<span>at se.bjurr.violations.lib.ViolationsApi.violations(<a href="http://violationsapi.java:58/" rel="noopener nofollow noreferrer" target="_blank">ViolationsApi.java:58</a>)</span>
<span>at com.atlassian.bitbucket.pipelines.checkstyle.report.Main.main(<a href="http://main.java:89/" rel="noopener nofollow noreferrer" target="_blank">Main.java:89</a>)</span>
<span>Submitted report. Response:200 OK</span>
<span>Request URI:<a href="http://api.bitbucket.org/2.0/repositories/economical/batch-file-ingestion-framework/commit/95f439405b1d4a9b5ade704b11fce8c953cab725/reports/checkstyle-1" rel="noopener nofollow noreferrer" target="_blank">http://api.bitbucket.org/2.0/repositories/economical/batch-file-ingestion-framework/commit/95f439405b1d4a9b5ade704b11fce8c953cab725/reports/checkstyle-1</a></span>
<span>Request Body -------</span>
<span>{"title":"Checkstyle","details":"Checkstyle report","external_id":"checkstyle-1","report_type":"BUG","result":"PASSED","data":[{"title":"Violations","type":"NUMBER","value":0},{"title":"Low Severity","type":"NUMBER","value":0},{"title":"Medium Severity","type":"NUMBER","value":0},{"title":"High Severity","type":"NUMBER","value":0}]}</span>
<span>--------------------</span>
<span>Response Body ------</span>
<span>{"result": "PASSED", "uuid": "{63fd9f91-08fd-5562-b3ee-97a0aca2b598}", "title": "Checkstyle", "remote_link_enabled": false, "type": "report", "created_by": {"type": "user", "uuid": "{415499a5-0b72-4b70-a07b-4e2a63577cee}"}, "created_on": "2021-12-02T18:43:41.591297Z", "details": "Checkstyle report", "report_type": "BUG", "updated_on": "2021-12-02T18:43:41.591297Z", "data": [{"title": "Violations", "type": "NUMBER", "value": 0}, {"title": "Low Severity", "type": "NUMBER", "value": 0}, {"title": "Medium Severity", "type": "NUMBER", "value": 0}, {"title": "High Severity", "type": "NUMBER", "value": 0}], "external_id": "checkstyle-1"}</span>
<span>--------------------</span><span>SEVERE: Error when parsing /opt/atlassian/pipelines/agent/build/checkstyle-result.xml as CHECKSTYLE</span>

checkstyle-report.xml
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/AbstractSchemaGenerator.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/SchemaBuilder.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/SchemaBuilder.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/DelimitedSchemaGenerator.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/DelimitedSchemaGenerator.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/JsonSchemaGenerator.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/JsonSchemaGenerator.scala message=Avoid using null line=9 column=4
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/schema/JsonSchemaGenerator.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/BigQueryIngestion.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/BigQueryIngestion.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/HiveIngestion.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/HiveIngestion.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/RedshiftIngestion.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/RedshiftIngestion.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/AbstractIngestion.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/ingestionprocess/AbstractIngestion.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/SparkSessionTrait.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/SparkSessionTrait.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/CloudStorageService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/CloudStorageService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/HdfsService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/HdfsService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/S3Service.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/S3Service.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/FileOperationService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/FileOperationService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/LocalFileService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/file/LocalFileService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/NotificationService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/NotificationService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/AlertNotificationService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/AlertNotificationService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/NotificationServiceTrait.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/NotificationServiceTrait.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/WarningNotificationService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/WarningNotificationService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/OkNotificationService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/notification/OkNotificationService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/rdbms/RdsService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/rdbms/RdsService.scala message=Public method must have explicit type line=4 column=6
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/rdbms/RdsService.scala message=Public method must have explicit type line=6 column=6
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/rdbms/RdsService.scala message=Public method must have explicit type line=8 column=6
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/rdbms/RdsService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/keyvalue/VaultService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/keyvalue/VaultService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/keyvalue/KeyValueReaderTrait.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/keyvalue/KeyValueReaderTrait.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/keyvalue/SsmService.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/keyvalue/SsmService.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/configparser/YamlParser.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/configparser/YamlParser.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/services/configparser/YamlParser.scala message=Avoid wildcard imports line=3 column=0
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/audit/Audit.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/audit/Audit.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/XMLParser.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/XMLParser.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/AbstractParser.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/AbstractParser.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/JSONParser.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/JSONParser.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/DelimitedParser.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/parser/DelimitedParser.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/package.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/package.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/config/IngestionConfig.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/config/IngestionConfig.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/config/DatabaseConfig.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/config/DatabaseConfig.scala message=File must end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/config/NotificationConfig.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/config/NotificationConfig.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/db/IntakeTable.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/db/IntakeTable.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/db/Table.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/db/Table.scala message=Public method must have explicit type line=5 column=6
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/db/Table.scala message=Public method must have explicit type line=7 column=6
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/db/Table.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/IngestionContext.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/IngestionContext.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/Schema.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/Schema.scala message=Magic Number line=42 column=78
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/Schema.scala message=File must end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/Schema.scala message=Avoid wildcard imports line=3 column=0
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/Schema.scala message=Avoid wildcard imports line=6 column=0
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/package.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/package.scala message=File must end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/domain/metadata/package.scala message=Avoid wildcard imports line=4 column=0
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/Main.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/Main.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/NotNullValidation.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/NotNullValidation.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/PrimaryUniqueKeyValidation.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/PrimaryUniqueKeyValidation.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/Validation.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/Validation.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/ThresholdValidation.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/ThresholdValidation.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/TraitValidation.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/main/scala/com/batchingestion/validation/TraitValidation.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/TestingSparkSessionTrait.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/TestingSparkSessionTrait.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/SampleTest.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/SampleTest.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/services/configparser/YamlParserTest.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/services/configparser/YamlParserTest.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/parser/DelimitedParserTest.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/parser/DelimitedParserTest.scala message=File must not end with newline character
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/domain/metadata/SchemaTest.scala message=Header does not match expected text line=1
warning file=/opt/atlassian/pipelines/agent/build/src/test/scala/com/batchingestion/domain/metadata/SchemaTest.scala message=File must not end with newline character
Saving to outputFile=/opt/atlassian/pipelines/agent/build/checkstyle-result.xml
Processed 50 file(s)
Found 0 errors
Found 112 warnings
Found 0 infos
Finished in 1036 ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.101 s
[INFO] Finished at: 2021-12-16T16:12:10Z
[INFO] ------------------------------------------------------------------------