-
Notifications
You must be signed in to change notification settings - Fork 1
#585: Added instructions how to ignore sonar issues to the User Guide #685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a372027
#585: Added instructions how to ignore sonar issues to the User Guide
ckunki 954e653
Updated first paragraph
ckunki 7785038
Updated phrasign
ckunki f5cfcb1
renamed image file
ckunki 0b7a02e
Fixed review finding
ckunki 1febf17
Updated phrasing
ckunki 812d964
Removed comma
ckunki b9138ba
Added separate section "Troubleshooting"
ckunki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| # Unreleased | ||
|
|
||
| ## Summary | ||
|
|
||
| ## Documentation | ||
|
|
||
| * #585: Added instructions how to ignore sonar issues to the User Guide |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| .. _ignore_findings: | ||
|
|
||
| Ignoring Sonar Findings | ||
| ======================= | ||
|
|
||
| In rare cases, Sonar might report a finding, you cannot fix or on which you | ||
| can agree with your reviewers to accept or ignore it. Please only choose this | ||
| approach as a last resort. | ||
|
|
||
| As Sonar reports only findings generated by other tools there are often | ||
| multiple IDs you can use for referring to a particular issue. E.g. security | ||
| findings can be reported by ``bandit`` and hence for such a finding there is a | ||
| bandit ID as well as a Sonar ID. | ||
|
|
||
| Example | ||
| ------- | ||
|
|
||
| For ``subprocess.run(args)``, Sonar could for example report *subprocess | ||
| call - check for execution of untrusted input*. In the Sonar UI, when clicking | ||
| on "Why is this an issue?", you will find references like | ||
|
|
||
| * *B603: Test for use of subprocess with shell equals true | ||
| external_bandit:B603* | ||
| * *See description of Bandit rule B603 at the* | ||
| `Bandit <https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html>`__ | ||
| *website*. | ||
|
|
||
| In this case, the bandit error code is ``B603``, which you can ignore via a | ||
| comment in the source code or, alternatively, accept in the Sonar UI. | ||
|
|
||
|
|
||
| Ignoring a Finding Via a Source Code Comment | ||
| -------------------------------------------- | ||
|
|
||
| The recommended way of ignoring such a finding is to append a comment to the | ||
| relevant line of code: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| subprocess.run(args) # nosec: B603 - risk of untrusted input is accepted | ||
|
|
||
|
|
||
| Alternatively, you could also accept a finding in the Sonar UI: | ||
|
|
||
| .. image:: accept_finding_in_sonar_ui.png | ||
| :width: 400px | ||
| :alt: Accepting a Finding Via Sonar UI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| .. _ptb_troubleshooting: | ||
|
|
||
| Troubleshooting | ||
| =============== | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 1 | ||
|
|
||
| features/metrics/ignore_findings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,5 +10,6 @@ | |
| getting_started | ||
| configuration | ||
| features/index | ||
| troubleshooting | ||
| customization | ||
| migrating | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.