Skip to content

Further .rubocop_todo.yml reduction in spec files #183

Open

Description

@eitoball

Summary

Follow-up to #169. After #182, the spec suite's .rubocop_todo.yml exclusions are down to Lint/ConstantDefinitionInBlock (removed) and Style/StringConcatenation (relocated). Several more spec-scoped exclusions remain and are candidates for incremental reduction.

Problem

.rubocop_todo.yml still carries these spec-touching exclusions (offense counts as of #182 merge):

Cop Files Offenses Autocorrect
Style/BlockDelimiters comma_spec.rb, data_extractor_spec.rb, header_extractor_spec.rb 14 safe
Lint/EmptyBlock comma_spec.rb, data_mapper_collection_spec.rb 4 -
Layout/EmptyLinesAroundAttributeAccessor comma_spec.rb 4 safe
Naming/VariableName comma_spec.rb 2 -
Style/StringConcatenation comma_spec.rb, spec_helper.rb remaining 2 of 6 (1 already moved to active_record_models.rb in #182) unsafe
Lint/MissingSuper comma_spec.rb 1 -
Lint/NonDeterministicRequireOrder spec_helper.rb 1 unsafe
Style/RedundantBegin spec_helper.rb 1 safe
Layout/SpaceAroundMethodCallOperator users_controller_spec.rb 1 safe
Layout/EmptyLineBetweenDefs spec/rails_app/rails_app.rb 1 safe

Style/Documentation also excludes spec/**/*, but that's likely an intentional, permanent exclusion (spec/test classes don't need doc comments) rather than a hygiene debt — evaluate case by case, don't treat as a required target.

Proposed approach

Same incremental rule as #169: when touching a spec file for other reasons, fix or narrow its exclusions instead of leaving them. Where a cop is safely autocorrectable, rubocop -A scoped to the specific file plus a spec-suite run to confirm no behavior change is enough; where it's unsafe or non-autocorrectable (Lint/EmptyBlock, Naming/VariableName, Lint/MissingSuper, Style/StringConcatenation, Lint/NonDeterministicRequireOrder), each needs a manual look at whether the flagged code is intentional (e.g. an empty after(:all) do end block, or old-style should == variable naming) before changing it.

Acceptance criteria

  • At least one additional entry removed or narrowed from .rubocop_todo.yml
  • No spec behavior changes (same examples, same expectations)
  • bundle exec rubocop and bundle exec rspec stay green

Depends on

#169, #182 (this list was captured after #182 merged)

Out of scope

  • Style/Documentation's blanket spec/**/* exclusion (likely permanent)
  • Non-spec exclusions (Gemspec/*, lib/**/*)

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions