-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add checksum validation #166
Conversation
SourceCodeDir string | ||
ResultOf map[*Analyzer]interface{} | ||
Report func(string, Diagnostic) | ||
AnalyzerName string |
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.
Since we are passing more global data to the analyzers I decided to move these parameters to its own object instead of having this function positional parameters growing ever more.
This required some minor changes in other test files and the runner but the functionality remains untouched
RootDir: filepath.Join("./"), | ||
SourceCodeDir: filepath.Join("testdata", "version-match"), | ||
RootDir: filepath.Join("./"), | ||
CheckParams: &analysis.CheckParams{ |
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.
Changing this since we moved to an object instead of positional parameters
if sourceCodeDir == "" { | ||
// If no source code dir is provided, only report the result if ReportAll is set, for backwards compatibility | ||
if sourceCodeNotProvided.ReportAll { | ||
pass.ReportResult(pass.AnalyzerName, sourceCodeNotProvided, fmt.Sprintf("Source code not provided or the provided URL %s does not point to a valid source code repository", pass.SourceCodeDir), "If you are passing a Git ref or sub-directory in the URL make sure they are correct.") | ||
pass.ReportResult( |
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.
breaking down these long lines for easier reading. no changes in text.
pkg/cmd/plugincheck2/main.go
Outdated
diags, err := runner.Check(passes.Analyzers, archiveDir, sourceCodeDir, cfg) | ||
diags, err := runner.Check( | ||
passes.Analyzers, | ||
&analysis.CheckParams{ |
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.
This is the change from positional parameters to an object with global data we can pass to the analyzers.
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.
Great work! 👏 👏
I have some comments, some of those like missing context.Context
are general issues with the code of this repository, but I wanted to point them out anyways.
Apart from those, great work!! 🎉
|
||
resp, err := client.Get(url) | ||
if err != nil { | ||
logme.DebugFln("Error reading body: %s", err.Error()) |
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.
Nit: this is an error making the network request not while reading the body so I would change the logged message to something more clear
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.
LGTM! Awesome 🎉
Add checksum validator with cli parameter