Skip to content

Commit 4b3bb0d

Browse files
committed
refactor: Use threshold variable consistently
The `config.Diff.Threshold` variable was being used directly in log messages and conditional statements. This commit introduces a new variable `threshold` to store the value of `config.Diff.Threshold` and uses it consistently throughout the `rootCmd` function. This improves code readability and maintainability by reducing redundant access to the configuration value. --- {"auto-commit-msg":{"language":"rust","version":"0.4.0-dev","model":"gemini-2.5-flash-lite","response_time":1.08,"execution_time":1.1}}
1 parent ebbd68c commit 4b3bb0d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

cmd/root.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ var rootCmd = &cobra.Command{
9393
}
9494

9595
totalChanges := stats.Insertions + stats.Deletions
96-
totalChangesThreshold := config.Diff.Threshold
96+
threshold := config.Diff.Threshold
9797
var model string
98-
if totalChanges < totalChangesThreshold {
98+
if totalChanges < threshold {
9999
model = config.Diff.ShortModel
100-
log.Printf("git diff total changes %d under %d threshold, using model for short diffs: %s\n", totalChanges, totalChangesThreshold, model)
100+
log.Printf("git diff total changes %d under %d threshold, using model for short diffs: %s\n", totalChanges, threshold, model)
101101
} else {
102102
model = config.Diff.LongModel
103-
log.Printf("git diff total changes %d over %d threshold, using model for long diffs: %s\n", totalChanges, totalChangesThreshold, model)
103+
log.Printf("git diff total changes %d over %d threshold, using model for long diffs: %s\n", totalChanges, threshold, model)
104104
}
105105
if config.Provider.ApiKey == "" {
106106
return errors.New("api_key environment variable name cannot be empty")

0 commit comments

Comments
 (0)