-
Notifications
You must be signed in to change notification settings - Fork 10
Improve lizard config behaviour #122
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
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
| if err != nil { | ||
| return fmt.Errorf("failed to fetch default patterns: %v", err) | ||
| } | ||
| patterns = []domain.PatternDefinition{} |
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 understand this change. On the analysis standpoint, the tool should just rely on the patterns file and that is that.
I would leave this as it was or update this tool to actually use the tools.ConfigFileExists( as the other tools use. As this at most should be a failsafe anyway.
tools.ConfigFileExists check for configuration file both generated from the API during init, or if it exists on the root of the repo. So if we initialize from the UI with no patterns, we should have a file created with no rules, and don't even hit this path
| patterns := make([]domain.PatternDefinition, len(patternConfiguration)) | ||
| for i, pattern := range patternConfiguration { | ||
| patterns[i] = pattern.PatternDefinition | ||
|
|
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.
These changes are a bit strange for me, if we check the ifs for other tools, there are things like
case DartAnalyzer:
if len(patternConfiguration) > 0 {
err := createDartAnalyzerConfigFile(patternConfiguration, toolsConfigDir)
if err != nil {
return fmt.Errorf("failed to create Dart Analyzer config: %v", err)
}
fmt.Println("Dart configuration created based on Codacy settings")
}
case Semgrep:
if len(patternConfiguration) > 0 {
err := createSemgrepConfigFile(patternConfiguration, toolsConfigDir)
if err != nil {
return fmt.Errorf("failed to create Semgrep config: %v", err)
}
fmt.Println("Semgrep configuration created based on Codacy settings")
}
case Lizard:
createLizardConfigFile(toolsConfigDir, patternConfiguration)
}
But for Lizard you only call this method, but then you remove the if?
1b58153 to
9b41044
Compare
…f fetching codacy default
77d1012 to
97f16ab
Compare
|
#127 approached here |
|
#127 fixed this. |
based on #119
we were fetching codacy default patterns when no patterns existed we should just keep as it is defined in the repo.