Skip to content

Conversation

@viralpraxis
Copy link
Contributor

@viralpraxis viralpraxis commented Sep 25, 2025

echo 'var.==(nil)' | bundle exec rubocop --stdin ' ' --only Style/NilComparison -A -d
Infinite loop detected in ~ and caused by Style/NilComparison
C

Offenses:

 :1:5: C: [Corrected] Style/NilComparison: Prefer the use of the nil? predicate.
var.==(nil)
    ^^

1 file inspected, 1 offense detected, 1 offense corrected

1 error occurred:
Infinite loop detected in ~  and caused by Style/NilComparison

Replace this text with a summary of the changes in your PR.
The more detailed you are, the better.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

```shell
echo 'var.==(nil)' | bundle exec rubocop --stdin ' ' --only Style/NilComparison -A -d
Infinite loop detected in ~ and caused by Style/NilComparison
C

Offenses:

 :1:5: C: [Corrected] Style/NilComparison: Prefer the use of the nil? predicate.
var.==(nil)
    ^^

1 file inspected, 1 offense detected, 1 offense corrected

1 error occurred:
Infinite loop detected in ~  and caused by Style/NilComparison
```

Co-authored-by: Koichi ITO <[email protected]>
@viralpraxis viralpraxis force-pushed the fix-an-error-for-style-nil-comparison branch from dcb6281 to bded303 Compare September 25, 2025 09:50
@bbatsov bbatsov merged commit face244 into rubocop:master Sep 25, 2025
22 checks passed
@viralpraxis viralpraxis deleted the fix-an-error-for-style-nil-comparison branch September 25, 2025 13:10
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