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

chore: Update Rubocop and pull in recommended plugins #72

Closed
wants to merge 2 commits into from
Closed

chore: Update Rubocop and pull in recommended plugins #72

wants to merge 2 commits into from

Conversation

maxveldink
Copy link
Member

This PR

While working on some specification work, I noticed that the version of Rubocop was far behind. Further, Rubocop recommended two extensions when running locally that we should consider including.

  • Updates rubocop and pulls in rubocop-rake and rubocop-rspec. I pessimistically locked to the minor version, as Rubocop is generally safe to have a looser versioning constraint in favor of benefiting from new rules sooner.
  • Corrected Rubocop violations, either through configuration or minor code changes

Notes

I'll do my best to annotate this PR with the reason behind configuration or code changes; I'm open to discussing any fix here.

One thought I had while working on this is if the project would entertain moving to Standardrb instead of using stock Rubocop. I can add an issue for more discussion, but I am curious about any initial thoughts. Not maintaining an RSpec configuration is nice.

Follow-up Tasks

How to test

Clean Rubocop CI run

@@ -20,9 +24,27 @@ Metrics/BlockLength:
- 'spec/**/*.rb'
- 'openfeature-sdk.gemspec'

Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec
Copy link
Member Author

Choose a reason for hiding this comment

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

I typically don't use the development_dependency style and favor using Gemfile, but I opted to use what the project already uses.

Comment on lines +37 to +38
RSpec/ContextWording:
Enabled: false
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we're using the OpenFeature specification language, disabling this rule as it will constantly be violated.

Enabled: false

RSpec/MultipleExpectations:
Max: 2
Copy link
Member Author

Choose a reason for hiding this comment

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

I always find the single default expecation max as overly punitive; I think 2 is a much more reasonable default.

Max: 2

RSpec/NestedGroups:
Enabled: false
Copy link
Member Author

Choose a reason for hiding this comment

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

Again, since we're using the specification language and nesting, I think having a maximum here is overly restrictive.

Enabled: false

RSpec/SpecFilePathFormat:
Enabled: false
Copy link
Member Author

Choose a reason for hiding this comment

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

Discussion around this started in #71

Enabled: false

RSpec/PendingWithoutReason:
Enabled: false
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the pending output is readable enough without a reason.

Copy link
Collaborator

@technicalpickles technicalpickles left a comment

Choose a reason for hiding this comment

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

Thanks for this ✨ I have seen the suggestions, and keep forgetting to do something about them.

One thought I had while working on this is if the project would entertain moving to Standardrb instead of using stock Rubocop. I can add an issue for more discussion, but I am curious about any initial thoughts. Not maintaining an RSpec configuration is nice.

Totally would entertain it. I generally adopt that on new projects because we don't have to talk about rubocop config, except new additive things 😁

Comment on lines +37 to +39
spec.add_development_dependency "rubocop", "~> 1.56"
spec.add_development_dependency "rubocop-rake", "~> 0.6"
spec.add_development_dependency "rubocop-rspec", "~> 2.24"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Honestly, I think we can remove the versioning. Since we use a Gemfile.lock in the repo, they won't update until they are explicitly bundle update'd.

That makes it a touch easier to update w/o needing to update the gemspec.

@technicalpickles
Copy link
Collaborator

@toddbaert hmm, it is the same error as #64 (comment) when trying to report, even with #67

debug - 2023-09-14 00:53:24,761 -- Starting create commit process --- {"commit_sha": "c24ea2244b3606b23931171c81d93bbe9137744c", "parent_sha": null, "pr": "72", "branch": "mveldink/update-rubocop", "slug": "open-feature/ruby-sdk", "token": null, "service": "github", "enterprise_url": null}
Error: Codecov token not found. Please provide Codecov token with -t flag.
Error: Codecov: Failed to properly create commit: The process '/home/runner/work/_actions/codecov/codecov-action/845c445181131d954f0198d3d0f26242acc0376e/dist/codecov' failed with exit code 1

@maxveldink
Copy link
Member Author

@technicalpickles Great, I added codecov/codecov-action#74 and will take a stab at switching over to see how much work/reformatting would be involved.

@toddbaert
Copy link
Member

@technicalpickles the codecov thing ended up being a big can of worms: codecov/feedback#112.

I'm reverting to an older version for now: #75

@maxveldink
Copy link
Member Author

Closing this since codecov/codecov-action#76 was accepted

@maxveldink maxveldink closed this Sep 21, 2023
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