Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any means to run Sonar analysis on a single file?

Tags:

java

sonarqube

My project is too big, and running Sonar on the entire project is taking lots of time and memory. So I want to know if there is any means to run sonar on a single java file.

like image 320
Valath Avatar asked May 07 '14 09:05

Valath


2 Answers

Instead of installing this plugin you can alos use directly inclusions or exclusion (or both).

Within a executed pom.xml you can write pathToInclude (within the property section) and within the console you must add a property with -Dsonar.inclusions=pathToInclude

-Dsonar.inclusions=file:/path_to_my_project/MyProject.java
//only the file above will be analyzed

-Dsonar.exclusions=file:/path_to_my_project_root/another_directory/**/*
//all subfolders and files within "another_directory" are exclued / ignored. 

-Dsonar.inclusions=file:/path_to_my_project/another_directory/MyProject.java
-Dsonar.exclusions=file:/path_to_my_project/another_directory/**/*
//all subfolders and files within "another_directory" are exclued / ignored EXCEPT MyProject.java.
like image 107
Krummy Avatar answered Sep 27 '22 21:09

Krummy


Exclusion or inclusion patterns should be used. See http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-Patterns for more details.

like image 44
Simon Brandhof - SonarSource Avatar answered Sep 27 '22 21:09

Simon Brandhof - SonarSource