Skip to content

CI: lint with RuboCop - #5

Merged
heliocosta-dev merged 1 commit into
mainfrom
ci-lint
Oct 8, 2026
Merged

heliocosta-dev merged 1 commit into
mainfrom
ci-lint

Conversation

@heliocosta-dev

Copy link
Copy Markdown
Member

What CI now runs

The existing test matrix (Ruby 3.0–3.3, rspec + gem build) is unchanged. A new lint job runs bundle exec rubocop on Ruby 3.3 for every PR and every push to main.

RuboCop 1.91.0 is pinned exactly as a gemspec development dependency, matching the repo's convention (the Gemfile is just gemspec, and Gemfile.lock stays uncommitted). That lets Dependabot's bundler updates bump it. .rubocop.yml uses TargetRubyVersion: 3.0 and NewCops: enable, and is set to the style the code already follows: double quotes, alias_method, consistent hash and argument indentation, [key, table] hash-rocket alignment, and dev deps in the gemspec. Trailing commas use diff_comma, meaning a comma whenever the closing bracket is on its own line. Run bundle exec rubocop locally (-a for safe fixes).

I picked plain RuboCop over standard. Standard hard-codes {a: 1} hash braces, which would reformat ~370 places in this { a: 1 } codebase, and it can't be configured otherwise.

Code changes

These are safe autocorrections only (rubocop -a, never -A), and every one is syntax-only:

  • lib/millionsend/contacts.rb: [:id, :email] becomes %i[id email].
  • lib/millionsend/request.rb: adds a trailing comma in the multiline TRANSPORT_ERRORS array.
  • spec/resources_spec.rb: 7 string arrays become %w[...], plus 2 trailing commas.

No public method, constant, signature or behavior changes. All 68 specs pass.

Deliberately disabled

  • Metrics, LineLength and FetchEnvVar. They would demand refactors or rewrite the intentional ENV[...] nil fallback without catching bugs.
  • HashExcept, CollectionCompact and MutableConstant. RuboCop marks their rewrites unsafe, and each changes behavior for some input:
    • except on a HashWithIndifferentAccess also drops string keys that the current reject keeps.
    • compact keeps [key, nil] pairs.
    • Freezing USER_AGENT breaks anyone appending to it, which is currently the only way to customize the UA.

🤖 Generated with Claude Code

CI now also runs `bundle exec rubocop` on Ruby 3.3 for every PR and push to
main. RuboCop 1.91.0 is pinned as a gemspec development dependency, and
.rubocop.yml (TargetRubyVersion 3.0, NewCops enabled) is set to the style the
code already follows: double quotes, trailing commas on literals whose closing
bracket sits on its own line, alias_method, consistent indentation, dev
dependencies in the gemspec.

Safe autocorrections only (rubocop -a): %w/%i for 8 literal word/symbol arrays
and 3 missing trailing commas. Cops whose rewrites would change behavior for
some inputs (HashExcept, CollectionCompact, MutableConstant) are disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@heliocosta-dev
heliocosta-dev merged commit 903db6a into main Oct 8, 2026
5 checks passed
@heliocosta-dev
heliocosta-dev deleted the ci-lint branch October 8, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant