We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example code:
1/2r + 3
Rubocop 0.77.0 says this:
lib/rational.rb:1:2: C: Layout/SpaceAroundOperators: Surrounding space missing for operator /. 1/2r + 3 ^
Ruby style guide linked by Rubocop says it is preferred not to have spaces around the / in a rational literal: https://rubystyle.guide/#spaces-operators
/
Rubocop should enforce the Ruby style guide with respect to rational literals. We should prefer 1/2r to 1 / 2r.
1/2r
1 / 2r
Rubocop prefers 1 / 2r over the recommended 1/2r.
Add a rational literal without spaces around / to some code, run rubocop.
0.77.0 (using Parser 2.6.5.0, running on ruby 2.6.3 x86_64-darwin18)
The text was updated successfully, but these errors were encountered:
Layout/SpaceAroundOperators
[Fix rubocop#7537] Fix a false positive for `Layout/SpaceAroundOperat…
16b75b3
…ors` Fixes rubocop#7537. This PR fixes a false positive for `Layout/SpaceAroundOperators` when using a Rational literal with `/` (e.g. `2/3r`).
[Fix #7537] Fix a false positive for Layout/SpaceAroundOperators
ff3910d
Fixes #7537. This PR fixes a false positive for `Layout/SpaceAroundOperators` when using a Rational literal with `/` (e.g. `2/3r`).
Successfully merging a pull request may close this issue.
Example code:
Rubocop 0.77.0 says this:
Ruby style guide linked by Rubocop says it is preferred not to have spaces around the
/
in a rational literal: https://rubystyle.guide/#spaces-operatorsExpected behavior
Rubocop should enforce the Ruby style guide with respect to rational literals. We should prefer
1/2r
to1 / 2r
.Actual behavior
Rubocop prefers
1 / 2r
over the recommended1/2r
.Steps to reproduce the problem
Add a rational literal without spaces around
/
to some code, run rubocop.RuboCop version
The text was updated successfully, but these errors were encountered: