Skip to content

Include CLI flags in the auto-gen-config heading#640

Merged
sds merged 2 commits intosds:mainfrom
mattmenefee:fix-auto-gen-config-command-flags
Apr 13, 2026
Merged

Include CLI flags in the auto-gen-config heading#640
sds merged 2 commits intosds:mainfrom
mattmenefee:fix-auto-gen-config-command-flags

Conversation

@mattmenefee
Copy link
Copy Markdown
Contributor

@mattmenefee mattmenefee commented Apr 8, 2026

Summary

  • When running haml-lint --auto-gen-config with additional flags (e.g. --auto-gen-exclude-limit 1000), the generated .haml-lint_todo.yml now includes those flags in the heading comment
  • Previously the heading was hardcoded to always say haml-lint --auto-gen-config, regardless of what flags were actually used
  • Follows the same pattern RuboCop uses: reconstruct the command from parsed options via a command method
  • Also fixes the heading timestamp to reflect actual generation time rather than class load time
  • Extracts the default exclude limit of 15 into a DEFAULT_EXCLUDE_LIMIT constant shared between cli.rb and DisabledConfigReporter

Partial fix for #388 — lays the groundwork for --regenerate-todo, --[no-]auto-gen-timestamp, and --[no-]offense-counts.

Before

# This configuration was generated by
# `haml-lint --auto-gen-config`

After

# This configuration was generated by
# `haml-lint --auto-gen-config --auto-gen-exclude-limit 1000`

Test plan

  • All 12 disabled_config_reporter_spec.rb tests pass
  • All 34 cli_spec.rb tests pass
  • Full suite passes

@mattmenefee mattmenefee force-pushed the fix-auto-gen-config-command-flags branch from 8a71156 to a005427 Compare April 8, 2026 20:08
When running `haml-lint --auto-gen-config` with additional flags like
`--auto-gen-exclude-limit`, the generated `.haml-lint_todo.yml` heading
now reflects the actual command used, rather than always showing just
`haml-lint --auto-gen-config`.

This follows the same approach RuboCop uses: reconstruct the command
from parsed options rather than hardcoding it. As a bonus, the
timestamp is now captured at generation time rather than class load
time.

Partial fix for sds#388 — lays the groundwork for `--regenerate-todo`,
`--[no-]auto-gen-timestamp`, and `--[no-]offense-counts`.
@mattmenefee mattmenefee force-pushed the fix-auto-gen-config-command-flags branch from a005427 to 6b31f05 Compare April 8, 2026 20:09
@mattmenefee mattmenefee changed the title Include CLI flags in auto-gen-config heading Include CLI flags in the auto-gen-config heading Apr 8, 2026
The default auto-gen-exclude-limit of 15 was duplicated as a magic
number in both cli.rb and disabled_config_reporter.rb. Extract it
to a single constant on DisabledConfigReporter so the two call sites
stay in sync.
@sds sds merged commit b68d6a9 into sds:main Apr 13, 2026
51 checks passed
@mattmenefee mattmenefee deleted the fix-auto-gen-config-command-flags branch April 13, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants