-
Notifications
You must be signed in to change notification settings - Fork 361
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
chore: make guided remediation follow revive's default lint rules #1259
Conversation
cmd/osv-scanner/fix/main.go
Outdated
Manifest string | ||
ManifestRW manifest.ManifestIO | ||
ManifestRW manifest.IO | ||
Lockfile string | ||
LockfileRW lockfile.LockfileIO | ||
LockfileRW lockfile.IO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had the tendency to name these variables rw
(for read-write).
It might make sense to rename the structs manifest.ReadWriter
and lockfile.ReadWriter
.
Any thoughts/opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have preference between the two options, both SGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone and renamed them to ReadWriter
s
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1259 +/- ##
==========================================
+ Coverage 68.29% 68.30% +0.01%
==========================================
Files 175 175
Lines 16764 16764
==========================================
+ Hits 11449 11451 +2
+ Misses 4682 4681 -1
+ Partials 633 632 -1 ☔ View full report in Codecov by Sentry. |
fwiw I've written up my thoughts on this on the issue - overall my main comment here is that I think it would be best to see if you can get the now-not-violated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Michael!
Vulnerability models.Vulnerability | ||
DevOnly bool | ||
type Vulnerability struct { | ||
OSV models.Vulnerability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we can have a better name.. but I don't have a good suggestion neither...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's not great. I settled on OSV
because it is the format of the structure.
I can't seem to work out good a way to only enable revive rules for specific files (apparently you can add an Best I can do is add something like issues:
exclude-rules:
- path-except: internal/(resolution|remediation|tui)/
linters:
- revive But that's not great, and it'll disable the I can go disable the violating rules inline everywhere else, but tbh it'd be easier to fix most of the violations instead (and I wanted to limit the scope of this PR) |
Helping with #1257
Changed the guided remediation code (
cmd/osv-scanner/fix
, andinternal/resolution
,remediation
andtui
) to fix lint errors found when usingrevive
's default settings. All of this is internal, so there's no API breakages.It was mostly
unexported-return
and stuttering complaints (e.g.resolution.ResolutionResult
->resolution.Result
), so a bunch of structs have been renamed.