In a C# test project, I have an unparsable JavaScript file as part of the test data. The SonarQubeAnalyze@5 task in a DevOps Server 2022u1 YAML pipeline, provided by SonarQube DevOps extension 5.19.1, using SonarQube Enterprise v10.3 (build 82913), reports an error on that file, even though the literal path to the file is in sonar.exclusions:
ERROR: Failed to parse file [test/Company.Product.Component.Subcomponent.Tests/Data_builderror/Modules/OneColumnTextModule/OneColumnTextModule.js] at line 7: Unexpected token (7:20)
I tried fiddling with the sonar.exclusions pattern, but always got the same result.
This issue popped up after we upgraded from Node 12 to Node 20 and this part of the analysis started working again.
The rest of the analysis runs OK, but this error spams the pipeline run overview. How can I get rid of the error?
The unparsable file (see the missing render() { return (
above the first div):
import React, { Component } from 'react';
import "./OneColumnTextModule.scss";
export default class OneColumnTextModule extends Component {
<div className="row">
<div className="col-12">
<div className="background-wrapper">
<div className="row">
<div className="col-0 col-sm-2 col-md-3"></div>
<div className="col-12 col-sm-8 col-md-6">
<div className="body-wrapper">
<div className="title-text">{this.props.viewModel.title}</div>
<p>
{this.props.viewModel.body}
</p>
</div>
</div>
<div className="col-0 col-sm-2 col-md-3"></div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
A part of the log where the sonar.exclusions value is visibly mentioned in relation to the project:
INFO: Indexing files of module ‘Company.Product.Component.Subcomponent.Tests’
INFO: Base dir: /__w/92/s/test/Company.Product.Component.Subcomponent.Tests
INFO: Excluded sources: test/Company.Product.Component.Subcomponent.Tests/Data_builderror/Modules/OneColumnTextModule/OneColumnTextModule.js
The complete log section related to the project where the error happens:
INFO: ------------- Run sensors on module Company.Product.Component.Subcomponent.Tests
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=3ms
INFO: Sensor IaC AzureResourceManager Sensor [iac]
INFO: Sensor IaC AzureResourceManager Sensor is restricted to changed files only
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC AzureResourceManager Sensor [iac] (done) | time=2ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Roslyn version: 4.10.0.0
INFO: Language version: CSharp12
INFO: Concurrent execution: enabled
INFO: Sensor C# Analysis Log [csharp] (done) | time=0ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: Sensor TextAndSecretsSensor is restricted to changed files only
INFO: Sensor TextAndSecretsSensor [text] (done) | time=18ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=0ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
INFO: Sensor JavaScript/TypeScript analysis [javascript]
INFO: Found 0 tsconfig.json file(s): []
INFO: Creating TypeScript program
INFO: TypeScript configuration file /tmp/tmp-1333-AngGMp8IXxU0
INFO: 121 source files to be analyzed
INFO: Creating TypeScript program (done) | time=363ms
INFO: Starting analysis with current program
##[error]ERROR: Failed to parse file [test/Company.Product.Component.Subcomponent.Tests/Data_builderror/Modules/OneColumnTextModule/OneColumnTextModule.js] at line 7: Unexpected token (7:20)
ERROR: Failed to parse file [test/Company.Product.Component.Subcomponent.Tests/Data_builderror/Modules/OneColumnTextModule/OneColumnTextModule.js] at line 7: Unexpected token (7:20)
INFO: Analyzed 121 file(s) with current program
INFO: 121/121 source files have been analyzed
INFO: Hit the cache for 0 out of 121
INFO: Miss the cache for 121 out of 121: FILE_CHANGED [121/121]
INFO: Sensor JavaScript/TypeScript analysis [javascript] (done) | time=2253ms
INFO: Sensor CSS Rules [javascript]
INFO: Sensor CSS Rules is restricted to changed files only
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=1ms
INFO: Sensor CSS Metrics [javascript]
INFO: Sensor CSS Metrics is restricted to changed files only
INFO: Sensor CSS Metrics [javascript] (done) | time=0ms
INFO: Sensor EnterpriseSecretsSensor [textenterprise]
INFO: Sensor EnterpriseSecretsSensor is restricted to changed files only
INFO: Sensor EnterpriseSecretsSensor [textenterprise] (done) | time=0ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=2ms
INFO: Sensor IaC Docker Sensor [iac]
INFO: Sensor IaC Docker Sensor is restricted to changed files only
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Docker Sensor [iac] (done) | time=4ms
INFO: Sensor Serverless configuration file sensor [security]
INFO: 0 Serverless function entries were found in the project
INFO: 0 Serverless function handlers were kept as entrypoints
INFO: Sensor Serverless configuration file sensor [security] (done) | time=0ms
INFO: Sensor AWS SAM template file sensor [security]
INFO: Sensor AWS SAM template file sensor [security] (done) | time=1ms
INFO: Sensor AWS SAM Inline template file sensor [security]
INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=0ms