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

Fix a ruby warning when executing with bundle exec rubocop in this repository #288

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

Earlopain
Copy link
Contributor

check_commit.rake requires 'English' but when doing bundle exec rubocop this repository this file will also be evaluated.

This also happens in the rubocop repository (my main motivation here) if rubocop-ast is in the parent folder because of this line in its Gemfile: https://github.com/rubocop/rubocop/blob/66c8276b5d9e60fed1fb8d937649c3c153e5037d/Gemfile#L29-L30

$ RUBYOPT=-w bundle exec rubocop -V
.../rubocop-ast/rubocop-ast.gemspec:18: warning: global variable `$RS' not initialized
1.62.1 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 3.3.0) [x86_64-linux]
  - rubocop-performance 1.20.2
  - rubocop-rspec 2.27.1

@koic
Copy link
Member

koic commented Mar 14, 2024

Can you update to another approach that avoids using $RS in s.files= of the rubocop-ast gemspec, instead of requiring English?

@Earlopain
Copy link
Contributor Author

Yeah, sure. Updated

@bbatsov
Copy link
Contributor

bbatsov commented Oct 25, 2024

Can you update this PR so I can finally have it merged?

`check_commit.rake` requires 'English' but when doing `bundle exec rubocop` this file will also be evaluated.

```
earlopain@DESKTOP-PC rubocop-ast]$ RUBYOPT=-w bundle exec rubocop -V
/home/earlopain/Documents/rubocop-ast/rubocop-ast.gemspec:18: warning: global variable `$RS' not initialized
1.62.1 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 3.3.0) [x86_64-linux]
  - rubocop-performance 1.20.2
  - rubocop-rspec 2.27.1
```
@Earlopain
Copy link
Contributor Author

Yeah, sure. I changed the solution, can't actually use $/ since there is a cop for discouraging these constants. Instead I use lines(chomp: true) which results in the same thing, $/ is the default separator.

@bbatsov bbatsov merged commit b91da40 into rubocop:master Oct 25, 2024
19 checks passed
@bbatsov
Copy link
Contributor

bbatsov commented Oct 25, 2024

Thanks for addressing this so quickly! 🙇

@Earlopain Earlopain deleted the gemspec-warning branch October 25, 2024 14:55
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