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

Enabling RSpec IndexedLet Rubocop rule #10024

Closed
wants to merge 3 commits into from

Conversation

GarryHurleyJr
Copy link
Contributor

@GarryHurleyJr GarryHurleyJr commented Jun 17, 2024

https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecindexedlet

What are you trying to accomplish?

The RSpec IndexedLet rubocop rule has been disabled. This PR will re-enable it on the whole ecosystem.

Anything you want to highlight for special attention from reviewers?

This was essentially a renaming of variables in the rspec files. It shoud not affect anything.

How will you know you've accomplished your goal?

This cop just asks us to rename variables. The tests should run as normal.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@GarryHurleyJr GarryHurleyJr requested a review from a team as a code owner June 17, 2024 18:47
@github-actions github-actions bot added L: ruby:bundler RubyGems via bundler L: elixir:hex Elixir packages via hex L: github:actions GitHub Actions L: rust:cargo Rust crates via cargo L: javascript L: python labels Jun 17, 2024
Copy link
Member

@jurre jurre left a comment

Choose a reason for hiding this comment

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

Swapping out file1 for first_file seems not in the spirit of the rule.

It makes reading the test harder because it’s not clear what exactly is tested by this particular example.

That is not addressed by changing things in this way.

There are also a bunch of scenarios here where v1 or v2 refers to the version of the package manager. We should configure a pattern to allow that, because that is very clear and the current changes actually make those cases much harder to understand, so we'd end up in a worse situation there.

@@ -14,7 +14,7 @@
LOCKFILE
end

let(:lockfile_bundled_with_v1) do
let(:first_version_lockfile) do
Copy link
Member

Choose a reason for hiding this comment

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

v1 refers to the version of Bundler here. Not it being the first occurrence of the variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change that one to lockfile_bundle_with_version_one. It keeps the same spirit of that original name. In another fie I changed v6 to version_six for that reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

corrected with commit 4c83ce7. Please review

@jurre
Copy link
Member

jurre commented Jun 20, 2024

None of these changes seem like they are an improvement, the spirit of this linter rule is to make the tests more readable. All of the changes I see here are along the lines of changing file1 to file_one, and while that passes the linter, it does not seem like a meaningful improvement. This will not make it easier to understand the intent of the test.

If we can't think of descriptive names for these, I'd rather we disable the rule than make these changes.

@GarryHurleyJr
Copy link
Contributor Author

Instead of changing all of these files, per discussions, we are going to simply disable this rule as it does not gain us anything in the long run.

@jurre
Copy link
Member

jurre commented Jun 20, 2024

Instead of changing all of these files, per discussions, we are going to simply disable this rule as it does not gain us anything in the long run.

Not exactly how I would put it, but if all we're doing is changing file1 to file_one, we're better off disabling the rule.

@jurre jurre closed this Jun 20, 2024
@jeffwidman jeffwidman deleted the GarryHurleyJr/enableIndexedLet branch July 3, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: elixir:hex Elixir packages via hex L: github:actions GitHub Actions L: javascript L: python L: ruby:bundler RubyGems via bundler L: rust:cargo Rust crates via cargo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants