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
After upgrading rubocop to 1.11.0 I started getting
C: Style/UnlessLogicalOperators: Do not usemixedlogicaloperatorsinanunless.
on a line that reads
unlessvalues[:client][:insurance_company] == 999
I don't think there's a logical operator in this condition (equality operator is a boolean operator, but not a logical one AFAIK) and they definitely aren't mixed.
Expected behavior
No offense reported.
Actual behavior
When running rubocop --debug I get the following output (filtered out lines starting with "Scanning" and "Loading cache"):
For /home/jakub/Projects/spital/covid-form-backend: configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-performance-1.10.0/config/default.yml
configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-performance-1.10.0/config/default.yml
Default configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-1.11.0/config/default.yml
configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-rake-0.5.1/config/default.yml
configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-rake-0.5.1/config/default.yml
configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-rspec-2.2.0/config/default.yml
configuration from /home/jakub/.rbenv/versions/2.7.2/gemsets/covid/gems/rubocop-rspec-2.2.0/config/default.yml
Inspecting 89 files
For /home/jakub/Projects/spital/covid-form-backend/app/persistence/migrations: configuration from /home/jakub/Projects/spital/covid-form-backend/app/persistence/migrations/.rubocop.yml
Inheriting configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
AllCops/Exclude configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
For /home/jakub/Projects/spital/covid-form-backend/spec: configuration from /home/jakub/Projects/spital/covid-form-backend/spec/.rubocop.yml
Inheriting configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
AllCops/Exclude configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
For /home/jakub/Projects/spital/covid-form-backend/spec/helpers: configuration from /home/jakub/Projects/spital/covid-form-backend/spec/helpers/.rubocop.yml
Inheriting configuration from /home/jakub/Projects/spital/covid-form-backend/spec/.rubocop.yml
Inheriting configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
AllCops/Exclude configuration from /home/jakub/Projects/spital/covid-form-backend/.rubocop.yml
.
Offenses:
app/web/validation/contracts.rb:64:13: C: Style/UnlessLogicalOperators: Do not use mixed logical operators in an unless.
unless values[:client][:insurance_company] == 999 ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89 files inspected, 1 offense detected
Finished in 0.4577370000188239 seconds
and run rubocop on it with the rule enabled. The code is actually pretty nonsensical as I tried to get a minimal failing example while also avoiding triggering other offenses. The original code is here. The interesting thing here is that if I remove any of the nested blocks, rubocop stops reporting this offense. On the other hand, if I just commend something out, the offense persists.
…tors`
Fixesrubocop#9551.
This PR fixes a false positive for `Style/UnlessLogicalOperators`
when using `||` operator and invoked method name includes "or"
in the conditional branch.
This is an issue due to string matching of source code instead of AST.
Fixes#9551.
This PR fixes a false positive for `Style/UnlessLogicalOperators`
when using `||` operator and invoked method name includes "or"
in the conditional branch.
This is an issue due to string matching of source code instead of AST.
After upgrading rubocop to 1.11.0 I started getting
on a line that reads
I don't think there's a logical operator in this condition (equality operator is a boolean operator, but not a logical one AFAIK) and they definitely aren't mixed.
Expected behavior
No offense reported.
Actual behavior
When running
rubocop --debug
I get the following output (filtered out lines starting with "Scanning" and "Loading cache"):Steps to reproduce the problem
Create a file with the following contents:
and run
rubocop
on it with the rule enabled. The code is actually pretty nonsensical as I tried to get a minimal failing example while also avoiding triggering other offenses. The original code is here. The interesting thing here is that if I remove any of the nested blocks, rubocop stops reporting this offense. On the other hand, if I just commend something out, the offense persists.RuboCop version
The text was updated successfully, but these errors were encountered: