refactor: Uniform init defaults - PLUTO-1426#127
Conversation
48a6adc to
2ac9773
Compare
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 |
86fcf5b to
de355cd
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the configuration file creation logic for several tools to uniformly use provided defaults and simplify file writing. Key changes include updating the function signatures for ESLint and Lizard configuration creation to write files directly, adding helper functions for parameter handling, and streamlining config file creation in the init command.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/lizard/lizardConfigCreator.go | Updates CreateLizardConfig to accept a toolsConfigDir and write the config directly. |
| tools/eslintConfigCreator_test.go | Revises tests to use temporary directories and read back the generated ESLint config. |
| tools/eslintConfigCreator.go | Refactors ESLint config creation to use a new helper (removePlugins) and write file using a common helper. |
| cmd/init.go | Adjusts calls to config creation functions for ESLint and Lizard to accommodate their new signatures. |
Comments suppressed due to low confidence (2)
tools/eslintConfigCreator.go:115
- The new removePlugins function now skips any rule that contains an underscore based solely on its plugin check, whereas the previous implementation checked for plugin rules using '/'. Please ensure this change in behavior is intended and covers all required cases.
rule, skipRule := removePlugins(rule)
cmd/init.go:418
- The removal of the branch that retrieves default Lizard configuration when patternConfiguration is empty may lead to an empty configuration file. Confirm that this change is intended under the new uniform default behavior.
patterns := make([]domain.PatternDefinition, len(patternConfiguration))
| return fmt.Errorf("failed to create default ESLint config: %v", err) | ||
| } | ||
| fmt.Println("Default ESLint configuration created") | ||
| err := tools.CreateEslintConfig(toolsConfigDir, patternConfiguration) |
There was a problem hiding this comment.
suggestion: we could also refactor this function: we could abstract the error handling and logging, wdyt?
There was a problem hiding this comment.
we can and should, but I think we should do it for all tools and not just eslint, in the same PR
de355cd to
bab1ed5
Compare
No description provided.