Skip to content

Chore/rubocop ci#584

Open
nnc wants to merge 10 commits into
waynerobinson:masterfrom
skylabdoo:chore/rubocop-ci
Open

Chore/rubocop ci#584
nnc wants to merge 10 commits into
waynerobinson:masterfrom
skylabdoo:chore/rubocop-ci

Conversation

@nnc

@nnc nnc commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

This PR is staced on top of another, still open, PR, so skip the first 3 commits as I will rebase once that open PR is merged.

I'm opening this PR now to gather feedback early on. And also to check if this is what @CloCkWeRX had in mind for #537?

Best to look at this commit by commit, sans the first three, as otherwise it gets way too noisy.

I consider all of these changes to be safe, even if some were classified as unsafe by rubocop -a. There's still a few actually unsafe fixes that I would need to dig into to understand all the ramifications, so I'm stopping here for now, to see if this is even the direction you want to go in.

nnc and others added 9 commits June 10, 2026 14:28
Rename test/acceptance -> test/integration and run each test through a recorded
VCR cassette, so the external-API suite runs in CI with no credentials.

- IntegrationTestCase wraps every test in a cassette (auto-named per test) and
  builds a client from XERO_* env vars or fake fallbacks; replay matches on
  method+URI, so the token is irrelevant on playback.
- VCR_MODE drives record mode: unset replays (:none), `record` records only
  missing cassettes (:once), `all` re-records (:all). Recording aborts unless
  the four XERO_* vars are set.
- Secrets are filtered out of cassettes: the Authorization header, the rotating
  tokens in the token-endpoint response, and the org identity in the
  connections response.
- Dedicated CI job replays cassettes; `rake test` stays unit-only.

Cassettes are recorded separately against a Xero Demo Company; see
test/integration/README.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Recorded against a Xero Demo Company. Credentials, the Authorization header,
the connections response org identity, and the online-invoice share token are
filtered out; bodies are otherwise Demo Company sample data.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Now that integration tests replay cassettes with no credentials, fold them into
the default suite: `rake test` runs unit then integration in separate processes
(the unit suite's WebMock teardown would clash with VCR in one process). The CI
matrix runs both per cell, so the dedicated integration job is dropped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Incremental adoption (upstream waynerobinson#537): a regenerated .rubocop_todo.yml
grandfathers all current offenses so CI is green with no code changes,
and a `lint` job runs rubocop in CI. Kept in the Gemfile, not the
gemspec, so it stays off the appraisal matrix.
Mechanical output of `rubocop -a`: string quote style, hash syntax,
indentation, whitespace, trailing blank lines, and a few cop-specific
fixes. Slimmed `.rubocop_todo.yml` to the non-autocorrectable remainder
(`Style/Documentation`, `Metrics/*`, etc.) plus unsafe-correctable cops
deferred to a later pass.
`client.tenant_id = options[:tenant_id]` mutates an OAuth2 instance
held in a local, not `self`. The cop reads the receiver as a self-assignment
and `rubocop -A` infinite-loops on it (`UselessSetterCall` -> `Layout/LineLength` -> `Lint/Void`).
An inline `# rubocop:todo` directive silences the false positive without
losing the cop for real cases; the matching `.rubocop_todo.yml` entry for
this file is no longer needed and is removed.
Mechanical output of `rubocop -A --only Style/FrozenStringLiteralComment`.
With the pragma active, string literals are frozen at parse time; this
is the syntax-only change that enables it.
`Style/MutableConstant` adds `.freeze` to hash/array constants that are
assigned at file scope. With `# frozen_string_literal: true` active,
`Style/RedundantFreeze` removes the now-redundant `.freeze` on the
VERSION string.
Style/HashExcept, Style/HashConversion, Style/MapIntoArray,
Style/HashEachMethods, Style/StringConcatenation, Style/SymbolProc,
Style/RedundantFreeze, Lint/UselessMethodDefinition,
Lint/RedundantSafeNavigation, Style/PreferredHashMethods,
Gemspec/DevelopmentDependencies, and a few Layout cops. Slimmed
`.rubocop_todo.yml` to reflect the reduced offense count.
@nnc nnc force-pushed the chore/rubocop-ci branch 2 times, most recently from 0e2c27e to 08fa8b4 Compare June 10, 2026 16:24
@nnc nnc force-pushed the chore/rubocop-ci branch from 08fa8b4 to befb513 Compare June 10, 2026 16:27
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