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

G104 now raises an issue in case of reassignment err variable without checking #895

Closed
wants to merge 3 commits into from

Conversation

TimonOmsk
Copy link
Contributor

This PR is related to #891 issue

Now the G104 also checks for reassignments by checking referrers of err variable.

An issue will be raised only in case if no other expression related to the err variable exists:
Screenshot 2022-11-25 at 2 31 09

This check was made using SSA(https://pkg.go.dev/golang.org/x/tools/go/ssa)

@TimonOmsk TimonOmsk changed the title G104 now raises in case of reassignment err variable without checking G104 now raises an issue in case of reassignment err variable without checking Nov 25, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 74.37% // Head: 74.23% // Decreases project coverage by -0.13% ⚠️

Coverage data is based on head (049b036) compared to base (a0b7ebb).
Patch coverage: 57.69% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #895      +/-   ##
==========================================
- Coverage   74.37%   74.23%   -0.14%     
==========================================
  Files          51       51              
  Lines        3180     3206      +26     
==========================================
+ Hits         2365     2380      +15     
- Misses        746      757      +11     
  Partials       69       69              
Impacted Files Coverage Δ
cmd/gosec/main.go 0.00% <0.00%> (ø)
helpers.go 42.07% <0.00%> (-1.12%) ⬇️
analyzer.go 89.72% <100.00%> (+0.25%) ⬆️
rules/errors.go 96.10% <100.00%> (+0.38%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@TimonOmsk TimonOmsk closed this Nov 25, 2022
@TimonOmsk
Copy link
Contributor Author

TimonOmsk commented Nov 25, 2022

Closed because SSA requires complete program to build SSA, but gosec builds package by package and imports cannot be resolved.

Screenshot 2022-11-25 at 23 21 08

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.

2 participants