am having a class, which is giving me sonar issues. That is just a temporary class and I would ignore it in future sprints. How can I mark that particular class to be ignored from sonar analysis, as we have guidelines to commit code only if no sonar issues found.
annotation to skip sonar analysis on a class
12.3k views Asked by anurag1007 At
2
There are 2 answers
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 SONARQUBE-SCAN
- Trivy report to sonarqube
- Sonarqube not allowing me to set policy for S3 bucket
- Java Code Coverage with both Jacoco & SonarQube
- SonarLint vs code error of skipping files
- SonarQube: False-Positive S100 - Method names should comply with a naming convention
- Flutter SonarQube: "The main branch has no lines of code."
- How is this passing the quality gate
- Can SonarQube sent notification after scan to group with only email? (without password authentication)
- I am getting the error while building the pipeline in jenkins , My build is getting failed
- How to suppress duplicate code warning in php projects for Sonar Qube scans?
- Dotnet CLI SonarScanner is failing with dotnet 8.0 image
- SonarQube (Self-hosted) Scanning for Next.JS Project
- SonarQube unable to scan
- Sonar scan not the scanning project after java version updated from 11 to 17
- SonarQube 9.9 discrepancy in the scan results
Related Questions in SONAR-RUNNER
- SonarScan not recognising python code at the source directory
- SonarQube 9.9 discrepancy in the scan results
- This api (java/nio/file/Paths.get(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path; reads file whose location might be specfied by user input
- Getting this error in the quality gate of the sonarqube [ 0.0,% Coverage on New Codeis less than 80.0% ]
- Sonarqube authentication Issue
- SonarQube Test Failing Consistently
- how to upload generic test execution report in a sonarqube server?
- sonar plugin issue: The plugin [cxx] does not support Java 1.8.0_212
- Failure during analysis, Error when running: 'node -v'. Is Node.js available during analysis?
- Malformed input or input contains unmappable characters wiki/... french characters
- Is there a way to make Sonarcloud not showing me a specific code smell error?
- Process exited with exit value [ElasticSearch]: 1 (SonarQube)
- SonarQube warning: Unable to get default branch, defaulting to 'master': TypeError: Cannot read property 'defaultBranch' of null
- Making a mvc build with SonarQube token for verify project but we got error as import: Entry [ import from realm ClassRealm[maven.api, parent: null]]
- Unauthorized: Access is denied due to invalid credentials. Please check the authentication parameters in SonarQube SonarScanner.MsBuild.exe
Related Questions in SONARLINT
- How to solve sonarqube issue based on bug to return a copy
- SonarLint vs code error of skipping files
- Why SonarLint thinks this is the same result?
- Sonar showing condition always false error though it is not
- Sonar java:S3516: Methods returns should not be invariant
- Why do I have a bunch of untracked files in my source control, files that I didn't create or modify that are not supposed to exist in my project?
- SonarLint extension in VSCode for C#
- Sonar warning S6857: Correct this malformed property placeholder - is this a false positive?
- How to tell SonarLint to stop suggesting Lombok for my entity
- SonarLint failed to analyze TypeScript code - WSL WebStorm IDE (Please configure the Node.js path in the SonarLint settings)
- SonarQube 9.9 discrepancy in the scan results
- SonarLint plugin for IntelliJ IDEA suddenly stopped working - shows "No issues to display"
- Sonar issue: define a constant instead of duplicating this literal
- Trouble Integrating SonarQube in Android Studio: Need Assistance
- sonarLint: Invoke method(s) only conditionally
Related Questions in SONARQUBE5.1
- SonarLint vs code error of skipping files
- Sonarcloud scanning fails on Quality gate
- Trouble Integrating SonarQube in Android Studio: Need Assistance
- SonarQube showing 0% coverage on UI, after retried same changes showing coverage , it was working fine before not sure what is issue
- Sonarqube failed to start DEBUG - Starting WinSW in console mode
- SonarQube 10 - installation stopped in Windows 11
- SonarQube Pull Request analysis is scanning entire repo instead of changes part of the commit [Using GITHUB Actions]
- I am getting sonarqube codecoverage repot 0% I installed all recent version applications
- sonarqube error : not authorized to run analysis
- SonarQube doesn't recognize Mapper's unit test
- Error in sonarqube configuration using command prompt
- Coverity Scan for JS
- Is there a way to generate a report for the SonarQube branch new code directly and only once?
- Sonar Issue-HttpClient instances should always have socket and connect timeouts
- Sonarqube scanner - Java HotSpot(TM) 64-Bit Server VM warning The paging file is too small
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?
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)
Generally speaking you do have multiple options: (i assume you are using java, but there are equivalent solutions for other languages)
ignoring the whole class
There is a property called
sonar.exclusionwhich you can set to ignore that specific class. This needs to be set either yoursonar-project.propertiesor based on the scanner you are using. For details take a look hereignoring just some lines with issues
In the java world you can use line comments with
//NOSONAR <reason>to exclude lines from detection. There are equivalents in other languages too.ignoring just some issues on the class/method
In Java you can use the
@SuppressWarnings("<rule id>")to exclude issues from classes and methods for detection. see https://stackoverflow.com/a/30383335/3708208Define multiple ignore criteria for wildcard and rules
you can also define special settings in sonarqube, to ignore special files and folders via wildcard input, and which rules should be ignored. see https://stackoverflow.com/a/53639382/3708208