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
Recently rubocop 1.69.1 flagged an RSpec test which tested the output of a format string (ex: %.2x). However, rubocop mistook the format string evaluation using String#% as a numerical operation.
Apparently, rubocop is smart enough to detect when a local variable was previously defined and that it is a String. However, in this context number_format was defined dynamically using RSpec's let().
Expected behavior
Ignore number_format; possibly because the variable name contains format or fmt?
Actual behavior
For /data/home/postmodern/code/ronin-rb/ronin-support: configuration from /data/home/postmodern/code/ronin-rb/ronin-support/.rubocop.yml
Inheriting configuration from /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/rubocop-ronin-0.2.7/rubocop.yml
Default configuration from /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/rubocop-1.69.1/config/default.yml
Use parallel by default.
Skipping parallel inspection: only a single file needs inspection
Inspecting 1 file
Scanning /data/home/postmodern/code/ronin-rb/ronin-support/spec/binary/unhexdump/parser_spec.rb
Loading cache from /home/postmodern/.cache/rubocop_cache/d5be16cfb188840558666dc46b3e0676a580509d/6d7a3b621ca1730e04accd938619e4bdab66cfb1/7e7cbcde3e0d8a0272b4d2510a07a0ba01da99ab
spec/binary/unhexdump/parser_spec.rb:320:13: W: [Correctable] Lint/NumericOperationWithConstantResult: Numeric operation with a constant result detected.
number_format % 0x01,
^^^^^^^^^^^^^^^^^^^^
Recently rubocop 1.69.1 flagged an RSpec test which tested the output of a format string (ex:
%.2x
). However, rubocop mistook the format string evaluation usingString#%
as a numerical operation.Apparently, rubocop is smart enough to detect when a local variable was previously defined and that it is a String. However, in this context
number_format
was defined dynamically using RSpec'slet()
.Expected behavior
Ignore
number_format
; possibly because the variable name containsformat
orfmt
?Actual behavior
Steps to reproduce the problem
Gemfile
:test.rb
:bundle install
bundle exec rubocop test.rb
RuboCop version
The text was updated successfully, but these errors were encountered: