Skip to content
New issue

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

undefined method `braces?' #6721

Closed
alec-c4 opened this issue Jan 31, 2019 · 8 comments
Closed

undefined method `braces?' #6721

alec-c4 opened this issue Jan 31, 2019 · 8 comments
Labels

Comments

@alec-c4
Copy link

alec-c4 commented Jan 31, 2019

rubocop crashes on run


Expected behavior

It works

Actual behavior

rubocop -a
Inspecting 160 files
........

8 files inspected, no offenses detected
undefined method `braces?' for "s(:dsym,\n  s(:str, \"name_\"),\n  s(:begin,\n    s(:lvar, :locale)))":RuboCop::AST::Node
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:91:in `braced_options'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:83:in `correct_validate_type'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:62:in `block in autocorrect'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:64:in `block (2 levels) in rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/parser-2.6.0.0/lib/parser/source/tree_rewriter.rb:220:in `transaction'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:63:in `block in rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:61:in `each'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:61:in `rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:128:in `autocorrect_all_cops'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:72:in `autocorrect'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:100:in `block in offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:117:in `investigate'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:96:in `offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:44:in `inspect_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:280:in `inspect_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:227:in `block in do_inspection_loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:259:in `block in iterate_until_no_changes'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:252:in `loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:252:in `iterate_until_no_changes'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:223:in `do_inspection_loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:126:in `block in file_offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:144:in `file_offense_cache'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:124:in `file_offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:112:in `process_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:89:in `block in each_inspected_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `each'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `reduce'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `each_inspected_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:76:in `inspect_files'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:48:in `run'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:174:in `execute_runner'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:75:in `execute_runners'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:47:in `run'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/exe/rubocop:13:in `block in <top (required)>'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/exe/rubocop:12:in `<top (required)>'
/Users/alec/.rbenv/versions/2.6.1/bin/rubocop:23:in `load'
/Users/alec/.rbenv/versions/2.6.1/bin/rubocop:23:in `<main>'

Steps to reproduce the problem

I just run rubocop on my project

RuboCop version

$ rubocop -V
0.63.1 (using Parser 2.6.0.0, running on ruby 2.6.1 x86_64-darwin18)
@alec-c4
Copy link
Author

alec-c4 commented Jan 31, 2019

UPD: I just removed my rubocop.yml file and it works fine

require: rubocop-rspec

AllCops:
  TargetRubyVersion: 2.6
  Exclude:
    - 'node_modules/**/*'
    - 'db/schema.rb'
    - 'bin/*'
    - 'db/migrate/*_init_schema.rb'

Rails:
  Enabled: true

Bundler:
  Enabled: true

Metrics/LineLength:
  Max: 100

Metrics/MethodLength:
  Exclude:
    - 'db/migrate/*'

Metrics/AbcSize:
  Exclude:
    - 'db/migrate/*'

Layout/EndOfLine:
  Enabled: false

Style/Documentation:
  Enabled: false

Style/FrozenStringLiteralComment:
  Enabled: false

RSpec/NestedGroups:
  Max: 5

RSpec/MultipleExpectations:
  Exclude:
    - 'spec/systems/**/*'
    - 'spec/requests/**/*'

RSpec/ExampleLength:
  Exclude:
    - 'spec/systems/**/*'

RSpec/AnyInstance:
  Exclude:
    - 'spec/systems/**/*'
    - 'spec/requests/**/*'
    - 'spec/controllers/**/*'

RSpec/DescribeClass:
  Exclude:
    - 'spec/systems/**/*'

Metrics/BlockLength:
  Exclude:
    - 'spec/**/*'
    - 'config/routes/*'

Style/ClassAndModuleChildren:
  EnforcedStyle: compact

@alec-c4
Copy link
Author

alec-c4 commented Jan 31, 2019

UPD2: after removing

Rails:
  Enabled: true

it works. Whats wrong with this cop?

@koic
Copy link
Member

koic commented Jan 31, 2019

Thanks for reporting. Could you please show a minimum reproduce Ruby code?

@Darhazer
Copy link
Member

@alec-c4 if you run with -d you'd be able to see on which file it crashes, then post the code that is causing the crash.

It works after removing the above from your config because this way you effectively disable the cop that crashes - which is the Rails/Validation cop

@alec-c4
Copy link
Author

alec-c4 commented Feb 5, 2019

✗ rubocop -a
Inspecting 162 files
........

8 files inspected, no offenses detected
undefined method `braces?' for "s(:dsym,\n  s(:str, \"name_\"),\n  s(:begin,\n    s(:lvar, :locale)))":RuboCop::AST::Node
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:91:in `braced_options'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:83:in `correct_validate_type'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:62:in `block in autocorrect'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:64:in `block (2 levels) in rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/parser-2.6.0.0/lib/parser/source/tree_rewriter.rb:220:in `transaction'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:63:in `block in rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:61:in `each'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:61:in `rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:128:in `autocorrect_all_cops'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:72:in `autocorrect'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:100:in `block in offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:117:in `investigate'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:96:in `offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:44:in `inspect_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:280:in `inspect_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:227:in `block in do_inspection_loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:259:in `block in iterate_until_no_changes'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:252:in `loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:252:in `iterate_until_no_changes'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:223:in `do_inspection_loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:126:in `block in file_offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:144:in `file_offense_cache'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:124:in `file_offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:112:in `process_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:89:in `block in each_inspected_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `each'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `reduce'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `each_inspected_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:76:in `inspect_files'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:48:in `run'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:174:in `execute_runner'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:75:in `execute_runners'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:47:in `run'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/exe/rubocop:13:in `block in <top (required)>'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/exe/rubocop:12:in `<top (required)>'
/Users/alec/.rbenv/versions/2.6.1/bin/rubocop:23:in `load'
/Users/alec/.rbenv/versions/2.6.1/bin/rubocop:23:in `<main>'

and with -d key

✗ rubocop -a -d
For /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo: configuration from /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/.rubocop.yml
configuration from /Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-rspec-1.32.0/config/default.yml
configuration from /Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-rspec-1.32.0/config/default.yml
Default configuration from /Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/config/default.yml
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/va/ri/variants/c81reYStMitnDn8vYQT5hFAi/7804ef63e78b15c9ba608eca59458936ad4270d153984854beaf5364e7c6f481: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/va/ri/variants/zCKmKdc9uZjurs1Bjrx1xaD3/7804ef63e78b15c9ba608eca59458936ad4270d153984854beaf5364e7c6f481: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/va/ri/variants/pzN1qi1kLsQX9L9FtTv3BaWi/7804ef63e78b15c9ba608eca59458936ad4270d153984854beaf5364e7c6f481: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/zC/Km/zCKmKdc9uZjurs1Bjrx1xaD3: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/5Z/NF/5ZNF6Dqy3NZTMLqCcgFG5P6i: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/Fq/RK/FqRKu5zdBgiqzHapVKZPkMq9: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/c8/1r/c81reYStMitnDn8vYQT5hFAi: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/pz/N1/pzN1qi1kLsQX9L9FtTv3BaWi: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/storage/NX/rN/NXrNJHLhzVDW9TzBHP57gmer: ArgumentError, invalid byte sequence in UTF-8
.......
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/tmp/cache/bootsnap-compile-cache/25/ee28b24b8adf48: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/tmp/cache/bootsnap-compile-cache/25/aa21c165da0031: ArgumentError, invalid byte sequence in UTF-8
Unprocessable file /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/tmp/cache/bootsnap-compile-cache/25/ff8b09fc8fb74e: ArgumentError, invalid byte sequence in UTF-8
Inspecting 162 files
Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/config.ru
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/Rakefile
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/Gemfile
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/Capfile
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/app/frontend/components/messenger/messenger_component.rb
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/app/mailers/application_mailer.rb
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/app/models/identity.rb
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/app/models/ad.rb
.Scanning /Users/alec/Documents/Projects/CosmoZoo/code/cosmozoo/app/models/animal_breed.rb


8 files inspected, no offenses detected
undefined method `braces?' for "s(:dsym,\n  s(:str, \"name_\"),\n  s(:begin,\n    s(:lvar, :locale)))":RuboCop::AST::Node
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:91:in `braced_options'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:83:in `correct_validate_type'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/rails/validation.rb:62:in `block in autocorrect'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:64:in `block (2 levels) in rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/parser-2.6.0.0/lib/parser/source/tree_rewriter.rb:220:in `transaction'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:63:in `block in rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:61:in `each'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/corrector.rb:61:in `rewrite'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:128:in `autocorrect_all_cops'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:72:in `autocorrect'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:100:in `block in offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:117:in `investigate'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:96:in `offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cop/team.rb:44:in `inspect_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:280:in `inspect_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:227:in `block in do_inspection_loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:259:in `block in iterate_until_no_changes'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:252:in `loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:252:in `iterate_until_no_changes'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:223:in `do_inspection_loop'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:126:in `block in file_offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:144:in `file_offense_cache'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:124:in `file_offenses'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:112:in `process_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:89:in `block in each_inspected_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `each'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `reduce'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:86:in `each_inspected_file'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:76:in `inspect_files'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/runner.rb:48:in `run'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:174:in `execute_runner'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:75:in `execute_runners'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/lib/rubocop/cli.rb:47:in `run'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/exe/rubocop:13:in `block in <top (required)>'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/Users/alec/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.63.1/exe/rubocop:12:in `<top (required)>'
/Users/alec/.rbenv/versions/2.6.1/bin/rubocop:23:in `load'
/Users/alec/.rbenv/versions/2.6.1/bin/rubocop:23:in `<main>'
Finished in 4.825761000043713 seconds

@Drenmi
Copy link
Collaborator

Drenmi commented Feb 7, 2019

From the S-expression, the offending node should correspond to an interpolated symbol:

:"name_#{locale}"

where locale is a local variable.

@Drenmi Drenmi added the bug label Feb 7, 2019
@alec-c4
Copy link
Author

alec-c4 commented Feb 7, 2019

yep, my code contains following construction

  I18n.available_locales.each do |locale|
    validates_presence_of :"name_#{locale}"
  end

@Drenmi
Copy link
Collaborator

Drenmi commented Feb 7, 2019

I was unable to reproduce the problem on latest master, and it turns out this case was fixed in #6689, so the error will go away in the next release, which will likely be this weekend.

@Drenmi Drenmi closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants