Chore/rubocop ci#584
Open
nnc wants to merge 10 commits into
Open
Conversation
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.
0e2c27e to
08fa8b4
Compare
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.
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.