I need to run Sonar analysis on Java file before committing code to svn. Is there any mechanism to ensure that code having sonar issues doesn't gets checked into svn unless all sonar issues get resolved.
Sonar analysis prior to code check in
2.6k Views Asked by Sam At
2
There are 2 best solutions below
0
myuce
On
It can be done if the SVN supports hooks or alike.
For example, Git allows writing hooks for the commits/push/receive[server side] ;
- First download sonarscanner
- Create a git pre-push hook on the developer's machine to run sonarscanner
run sonarscanner and you will see the result on the stdout.
if sonar-scanner | grep '[ ]+[0-9]* blocker$' then
exit 1
else
exit 0
fi
Using this you can decide whether to accept or not the checkin (if there are blockers etc.)
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in SONARQUBE
- How to specify SonarQube rule description as a markdown/html resource file instead of using annotation?
- No 'Code Coverage' decorations in SonarQube 5.1+
- Upgrade H2 from sonarqube 4.5.1 to 5.1.1
- Logging error when executing Maven SonarQube plugin
- Analysis fails on PHP project with NullPointerException, fails on foreach($arrayOfArrays as list($item1, $item2)) {}
- Sonarqube ghost projects in issues
- Sonnar runner in Jenkins error in java project
- Reports missing on SonarQube dashboard after upgrade
- Exception in SonarQube.Msbuild.Runner
- How can I integrate ReSharper's Dotsettings File in SonarQube?
- Upgrade from SonarQube 4.3.2 to 4.5LTS (No Response)
- Properties file exclude multiple paths
- Technical debt on custom web rule in sonarqube 5.1
- sonar project.properties to ignore files containing a regular expression
- Sonarqube SVN Plugin fails with code E155007 'is not a working copy'
Related Questions in ANALYSIS
- quicksort, random pivot, analysis, O(nlogn)
- Can I use scikit-learn with Django framework?
- Data/Structure Validation (for R)
- automate checking of number set associations
- Data Analysis and Scatter Plot different file and different column
- Split clustered data and interpolate by a power function
- Merge multiple pandas columns into new column
- Complexity of a nested geometric sequence
- How to loop plot graph from matplotlib without having to close window?
- Using ggsurv function in R version 3.1.0
- How can I count in R how many times an occurence appears?
- How to analyze Malware when it infected all my exe files
- Run-time of a function to find the (n / 2^k)th element of a list of size n?
- SQL Server Analysis Services - using IgnoreUnrelatedDimensions
- Time Series DFT Signals Clustering
Related Questions in SOURCEANALYSER
- What is the difference between reportgenerator and BIRTreportgenerator?
- How can I extract a very simple sourceanalyzer / fortify report that only gives defect counts?
- SCA and gradle wrapper integration
- How to solve Fortify 19.1 low memory error?
- Sonar analysis prior to code check in
- How can I combine Fortify FPRs?
- Why can't BIRTReportGenerator find my source file?
- Is it possible to set the properties on the command line for sourceanalyzer?
- What causes unknown property attribute 'class' with fortify xcodebuild (Objective-C)?
- HP Fortify Android SCA build
- How to get a list of lint rules only for dart or analyser in specific version?
- How to recognize that TypeScript code is generated
- Arranging objects in PowerCenter Designer
- Query analyser to find source code location
- (PyCharm) Tool to understand python code
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The short answer is that you can't. The long answer is that you can come close.
Take a look at http://www.sonarlint.org/, for in-IDE code scanning. Then have a look at pull request analysis which should flag new issues. It's then up to the human reviewer to accept or reject the PR.