Commit ebbd68c
committed
refactor: improve config validation
This commit refactors the configuration validation logic in the `initConfig` function.
Previously, the validation for `short_model` and `long_model` was done within the `rootCmd.Run` function, which meant that errors would only be surfaced when the diff command was actually executed.
This change moves the validation to the `initConfig` function, ensuring that configuration errors related to empty `short_model` or `long_model`, or a negative `threshold`, are caught earlier during the initialization phase. This provides a better user experience by surfacing configuration issues immediately upon command execution, rather than during the processing of diffs.
Additionally, it simplifies the logic by removing redundant checks within the `rootCmd.Run` function. The validation for `short_model` and `long_model` is now handled solely in `initConfig`, and the `threshold` validation is also added there.
---
{"auto-commit-msg":{"language":"rust","version":"0.4.0-dev","model":"gemini-2.5-flash-lite","response_time":2.11,"execution_time":2.15}}1 parent 3e1c2bb commit ebbd68c
1 file changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 100 | | |
104 | 101 | | |
105 | 102 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | 103 | | |
110 | 104 | | |
111 | 105 | | |
| |||
229 | 223 | | |
230 | 224 | | |
231 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
232 | 241 | | |
0 commit comments