Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rubocop.govuk #5442

Merged
merged 16 commits into from
Jul 7, 2023
Merged

Update rubocop.govuk #5442

merged 16 commits into from
Jul 7, 2023

Conversation

colinbruce
Copy link
Contributor

@colinbruce colinbruce commented Jul 4, 2023

What

Update the rubocop govuk gem and then step through each update in turn addressing issues that arose

Three exemptions added to .rubocop.yml:

  • FactoryBot/FactoryAssociationWithStrategy, exclude spec/factories/legal_aid_applications.rb
    This is because there are too many traits that create objects that loop back

  • RSpec/IndexedLet, set the max number of spec variables to 2

    This will allow up to 2 number let variables e.g.

        let!(:transaction1) { create(:bank_transaction, :benefits, happened_at: 10.days.ago) }
        let!(:transaction2) { create(:bank_transaction, :benefits, happened_at: 40.days.ago) }

    But trying to create transaction3 will raise an error

    The aim is to slowly reduce the number over time to 1 as we phase out the use of large numbered blocks

  • Exclude spec/services/cfe/* from RSpec/IndexedLet as the CFE classic integration is due to be deleted soon

Checklist

Before you ask people to review this PR:

  • Tests and rubocop should be passing: bundle exec rake
  • Github should not be reporting conflicts; you should have recently run git rebase main.
  • There should be no unnecessary whitespace changes. These make diffs harder to read and conflicts more likely.
  • The PR description should say what you changed and why, with a link to the JIRA story.
  • You should have looked at the diff against main and ensured that nothing unexpected is included in your changes.
  • You should have checked that the commit messages say why the change was made.

Bumps [rubocop-govuk](https://github.com/alphagov/rubocop-govuk) from 4.10.0 to 4.11.0.
- [Changelog](https://github.com/alphagov/rubocop-govuk/blob/main/CHANGELOG.md)
- [Commits](alphagov/rubocop-govuk@v4.10.0...v4.11.0)

---
updated-dependencies:
- dependency-name: rubocop-govuk
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@colinbruce colinbruce force-pushed the update-rubocop-govuk branch 4 times, most recently from 34dd017 to eb5e294 Compare July 5, 2023 10:38
@colinbruce colinbruce force-pushed the update-rubocop-govuk branch 2 times, most recently from fd3a3e8 to 6ac3224 Compare July 5, 2023 12:00
Update factories/hmrc/responses in line with guidance
Address all infringing test harnesses
FactoryBot/FactoryAssociationWithStrategy, exclude spec/factories/legal_aid_applications.rb
This is because there are too many traits that create objects that loop back

RSpec/IndexedLet, set the max number of spec variables to 2

This will allow up to 2 number let variables e.g.
```ruby
    let!(:transaction1) { create(:bank_transaction, :benefits, happened_at: 10.days.ago) }
    let!(:transaction2) { create(:bank_transaction, :benefits, happened_at: 40.days.ago) }
```
But trying to create `transaction3` will raise an error

The aim is to slowly reduce the number over time to 1 as we phase out the use of large numbered blocks

We also exclude spec/services/cfe/* as the CFE classic integration is due to be deleted soon
@sonarcloud
Copy link

sonarcloud bot commented Jul 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
13.0% 13.0% Duplication

@colinbruce colinbruce marked this pull request as ready for review July 5, 2023 12:18
@colinbruce colinbruce requested a review from a team as a code owner July 5, 2023 12:18
Copy link
Contributor

@jsugarman jsugarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 - one comment re: contrary cops MatchArray versus ContainExactly. No blockers

@colinbruce colinbruce merged commit a3474b3 into main Jul 7, 2023
7 checks passed
@colinbruce colinbruce deleted the update-rubocop-govuk branch July 7, 2023 06:19
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.

3 participants