I have a project to analyze which is only based on Angular framework. The main issue I have is that both source and test files are on the same directories, divided into features.
Here is an example of my structure:
+- client
| +- features
| | +- home
| | | +- home.js [source code]
| | +- home.spec.js [test code]
| +- home.html
| +- home.less
+- admin
| +- admin.js [source code]
| +- admin.spec.js [test code]
| +- admin.html
| +- admin.less
...
In my sonar-project.properties
, it seems impossible to set a pattern instead of a path (for ex. sonar.tests=client/**/*.spec.js
).
Is there a way to run an analysis with this kind of structure?
Thanks.
Use Comma-separated paths to analysis multiple modules or projects. sonar. sources= mainDir/subDir/src, mainDir/subDir/subDir/src,... Set base directory with **sonar.
The SonarScanner is the scanner to use when there is no specific scanner for your build system.
Project analysis settings can be configured in multiple places. Here is the hierarchy: Global properties, defined in the UI, apply to all projects (From the top bar, go to Administration > Configuration > General Settings)
Thanks to SonarQube mailing list, the solution is to set the following properties:
sonar.sources=client
sonar.tests=client
sonar.exclusions=**/*.spec.js
sonar.test.inclusions=**/*.spec.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With