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
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in SONARQUBE
- Sonarqube not allowing me to set policy for S3 bucket
- Jacoco Coverage in Multi-Module Gradle Project Not Including Submodules
- How to solve sonarqube issue based on bug to return a copy
- Java Code Coverage with both Jacoco & SonarQube
- Sonar qube i installed is not working and it show "...... Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED"
- SonarLint vs code error of skipping files
- Sonar qube container cannot authenticate with token
- Is there a Sonar-Elixir plugin compatible with SonarQube 10.4.1?
- Error: LinkageError occurred while loading main class org.sonarsource.scanner.cli.Main
- SonarQube: False-Positive S100 - Method names should comply with a naming convention
- Sonarcloud - Sonar warning - Accept button - "Valid issue but won't be fixed now, it's acceptable for a while."
- What refactoring should I apply on this email validation regex?
- Flutter SonarQube: "The main branch has no lines of code."
- SonarScan not recognising python code at the source directory
- How is this passing the quality gate
Related Questions in ANALYSIS
- Netflix watch history project. Need data source (title & duration of the shows/movies) to match watch history
- Finding the corresponding X-axis value from graph
- Selecting more than one variable for analysis and visualization
- How to Combine Frequency and Percentage in 1 Cell in SPSS with Frequency displayed in bracket
- DADA2 truncLen value
- Heatmap using latitude and longitude coordinates
- Persistence diagram feels wrong...?
- Dynamically assigning CSVs to objects in a for loop in R
- How can I edit my table so that all the values for each sample appear in 1 row for the sample?
- Missing values were incorrectly entered as zeroes
- Python - Writing code for probability of choosing 7 pairs in a dominoes game?
- Column chart with conditional formatting and positive or negative deviation at the top of the columns in Power BI
- Object 'x' must be of class 'meta', 'metabin',... When attempting InfluenceAnalysis of the {dmetar} package
- Dynamic Pricing based on demand and independent categorical variables
- Give filenames of files containing given date time range
Related Questions in SOURCEANALYSER
- How to recognize that TypeScript code is generated
- How to get a list of lint rules only for dart or analyser in specific version?
- How can I combine Fortify FPRs?
- What is the difference between reportgenerator and BIRTreportgenerator?
- How to solve Fortify 19.1 low memory error?
- Is reportgenerator in fortify exist some command to filter issue?
- SCA and gradle wrapper integration
- How can I extract a very simple sourceanalyzer / fortify report that only gives defect counts?
- Query analyser to find source code location
- What causes unknown property attribute 'class' with fortify xcodebuild (Objective-C)?
- Why can't BIRTReportGenerator find my source file?
- Is it possible to set the properties on the command line for sourceanalyzer?
- (PyCharm) Tool to understand python code
- Arranging objects in PowerCenter Designer
- Sonar analysis prior to code check in
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 # Hahtags
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.