Skip to content
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

Fix #743 #748

Merged
merged 2 commits into from Jan 3, 2022
Merged

Fix #743 #748

merged 2 commits into from Jan 3, 2022

Conversation

Yiwei-Ding
Copy link
Contributor

@Yiwei-Ding Yiwei-Ding commented Dec 23, 2021

Problem

fixes #743

Details can be seen in #743.

Solution

If a nosec tag is:

  • the prefix of the comment (group)
  • or the prefix of a line in the multi-line comment (group), where the whitespaces in this line before nosec are ignored.

then nosec will work.

For example:

//#nosec
// #nosec
//#nosec G101
// #nosec G101
// Some description
// #nosec
//#nosec -- justification
//#nosec
//-- justification
//#nosec
//G101 G102

Examples that #nosec will not work:

//Some description #nosec
// Some description #nosec
// Another description

Bad practices:

// G101
//#nosec
ViolateG102() // This violation will not be reported since "G101" before "#nosec" is discarded.
//#nosec G101
//#nosec
ViolateG102() // This violation will be reported since only G101 is suppressed here.
//#nosec
//This description will not be tracked as a justification of this suppression.
Violate()

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2021

Codecov Report

Merging #748 (88e16b9) into master (63a8e78) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #748      +/-   ##
==========================================
+ Coverage   73.53%   73.57%   +0.04%     
==========================================
  Files          47       47              
  Lines        2913     2918       +5     
==========================================
+ Hits         2142     2147       +5     
  Misses        708      708              
  Partials       63       63              
Impacted Files Coverage Δ
analyzer.go 90.03% <100.00%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63a8e78...88e16b9. Read the comment docs.

@ccojocar ccojocar merged commit 72f1145 into securego:master Jan 3, 2022
@Yiwei-Ding Yiwei-Ding deleted the Fix743 branch January 4, 2022 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nosec comment below another comment breaks the nosec annotation
3 participants