Include CLI flags in the auto-gen-config heading#640
Merged
Conversation
8a71156 to
a005427
Compare
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`.
a005427 to
6b31f05
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
haml-lint --auto-gen-configwith additional flags (e.g.--auto-gen-exclude-limit 1000), the generated.haml-lint_todo.ymlnow includes those flags in the heading commenthaml-lint --auto-gen-config, regardless of what flags were actually usedcommandmethodDEFAULT_EXCLUDE_LIMITconstant shared betweencli.rbandDisabledConfigReporterPartial fix for #388 — lays the groundwork for
--regenerate-todo,--[no-]auto-gen-timestamp, and--[no-]offense-counts.Before
After
Test plan
disabled_config_reporter_spec.rbtests passcli_spec.rbtests pass