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

RSpec/FilePath split is disabled by default #1717

Closed
splattael opened this issue Sep 12, 2023 · 13 comments · Fixed by #1718
Closed

RSpec/FilePath split is disabled by default #1717

splattael opened this issue Sep 12, 2023 · 13 comments · Fixed by #1718

Comments

@splattael
Copy link
Contributor

The changelog reads that RSpec/FilePath is "enabled by default" but it seems it isn't anymore.

Currently, users are forced to replace RSpec/FilePath with their alternatives when upgrading a minor release from 2.23.0 to 2.24.0. Is this expected or do we consider this a breaking change? 🤔

Refs https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/195

/cc @ydah @bquorning

Originally posted by @splattael in #1698 (comment)

@splattael
Copy link
Contributor Author

From #1698 (comment):

@bquorning Sep 12, 2023

[...] I am not sure what is the preferred course of action – should we add the old cop back?

Good question! I was hoping we could turn the violation into a warning but unfortunately it's supported yet.

I see 2 options:

  1. Fix the changelog and highlight that this is a breaking change
  2. Enable FilePath by default and undo the split (in the config/obsoletion.yml) and highlight the tension of the cops in the changelog.

Later (or in the meanwhile):

  • Allow split rules to emit warnings (via severity: warning in "cop rule", see above) in RuboCop repository
  • Re-add the split configuration with severity: warning
  • Make it a violation (instead of warning) in the next major release

Depending on what we consider a "breaking change" both options are possible 😅

WDYT?

@ydah
Copy link
Member

ydah commented Sep 12, 2023

As mentioned in the following PR

How about proceeding as follows?

  1. Remove the configuration from config/obsoletion.yml once, since split would result in an error. (Next patch version release)
  2. Release a version that warns if RSpec/FilePath is used (Next and subsequent releases)
  3. Remove RSpec/FilePath in the next major version update

Later (or in the meanwhile):
Allow split rules to emit warnings (via severity: warning in "cop rule", see above) in RuboCop repository
Re-add the split configuration with severity: warning
Make it a violation (instead of warning) in the next major release

I think it looks good. Perhaps it would be better to implement it before step2.

@splattael
Copy link
Contributor Author

@ydah 👋

How about proceeding as follows?

This sounds great!

I think it looks good. Perhaps it would be better to implement it before step2.

Yes, we could! However, we'd need to wait for the RuboCop version to be released and tweak the dependency here 🤷

For now, I only see either sticking with rubocop-rspec 2.23.2 or accept the breaking change and remove RSpec/FilePath from .rubocop.yml per project.

@pirj
Copy link
Member

pirj commented Sep 12, 2023

Sounds like a plan!

Cop rules currently can only be failures, not warnings

How did it work for our extractions?

@splattael
Copy link
Contributor Author

Question for the maintainers: Since 2.24.0 has some potential for user confusion, I wonder if, after 2.24.1 was released with #1718 merged, we are considering yanking this release? 🤔

@pirj
Copy link
Member

pirj commented Sep 14, 2023

yanking this release

Quite unlikely. I see this as a regular bug fix.

We have had a dependency issue situation recently and planned to yank 2.18.0, but I think we didn’t and nobody complained.

@pirj
Copy link
Member

pirj commented Sep 14, 2023

Well, probably nobody complained because we haven’t released major versions yet.

@mockdeep
Copy link
Contributor

I'm having trouble with this. If I disable the RSpec/FilePath rule, it complains that the rule has been deprecated, but if I remove references to it, it reports a violation. This is with EnabledByDefault: true.

@pirj
Copy link
Member

pirj commented Sep 15, 2023

Hey @mockdeep ! Interesting 🤔. Does it work the same way for you with the fix from #1718?

@mockdeep
Copy link
Contributor

@pirj yeah, that fixes the issue for me. I need to handle both the FilePath and SpecFilePathFormat cops, but it doesn't cause an error preventing me from moving forward.

@bquorning
Copy link
Collaborator

v2.24.1 has been released, which I hope fixes the problem.

@edsu
Copy link

edsu commented Sep 25, 2023

I'm confused, is the plan to still deprecate RSpec/FilePath?

edsu added a commit to sul-dlss/common-accessioning that referenced this issue Sep 25, 2023
RSpec/FilePath was complaining about our spec files not matching the
module namespace. This commit pushes the specs into the directory that
RSpec/FilePath and RSpec/SpecFilePathFormat are expecting. It's not
exactly clear what is going on with the rules, but this seems like the
easiest way to not continue dancing around with the errors.

rubocop/rubocop-rspec#1717
@bquorning
Copy link
Collaborator

Yes, the RSpec/FilePath cop will be removed in v3.x (issue #1723). Since that would be a breaking change, the cop is still enabled for now. We did disable it in v2.24.0 and then re-enable it in v2.24.1, which I imagine may cause some confusion. (At least it did for me 😅)

If you upgraded to v2.24.0 and started have the new cops RSpec/SpecFilePathFormat and RSpec/SpecFilePathSuffix explicitly enabled, you probably want to explicit disable RSpec/FilePath after upgrading to v2.24.1.

edsu added a commit to sul-dlss-deprecated/dor_indexing_app that referenced this issue Sep 25, 2023
RSpec/FilePath was complaining about our spec files not matching the
module namespace. This commit pushes the specs into the directory that
RSpec/FilePath and RSpec/SpecFilePathFormat are expecting. It's not
exactly clear what is going on with the rules, but this seems like the
easiest way to not continue dancing around with the errors is to move
them.

See: rubocop/rubocop-rspec#1717
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 a pull request may close this issue.

6 participants