You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspecting 1 file
W
Offenses:
rubocop.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
until [stdout, stderr].all?(&:eof?)
^
rubocop.rb:3:3: C: [Corrected] Style/Next: Use next to skip iteration.
if readable
^^^^^^^^^^^
rubocop.rb:3:3: C: [Corrected] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
if readable ...
^^^^^^^^^^^
rubocop.rb:4:3: W: Lint/UselessAssignment: Useless assignment to variable - readable. Did you mean readablereadable?
readable = IO.select([stdout, stderr])
^^^^^^^^
1 file inspected, 4 offenses detected, 3 offenses corrected
…`Style/SafeNavigation`
Fixesrubocop#6738
Solves problem like below:
```ruby
until x
if foo
foo.some_method do
y
end
end
end
```
auto-corrects badly;
```ruby
# frozen_string_literal: true
until x
next unless foofoo&.some_method do
y
end
end
```
…SafeNavigation` (#7006)
Fixes#6738
Solves problem like below:
```ruby
until x
if foo
foo.some_method do
y
end
end
end
```
auto-corrects badly;
```ruby
# frozen_string_literal: true
until x
next unless foofoo&.some_method do
y
end
end
```
Steps to reproduce the problem
Create a file containing:
Run
rubocop -a
on itExpected behavior
Expected the result to be error free
Actual behavior
Rubocop broke the file between cops:
The autocorrected file now looks like:
RuboCop version
0.63.1 (using Parser 2.6.0.0, running on ruby 2.6.1 x86_64-darwin18)
The text was updated successfully, but these errors were encountered: