No error
Error pops up in Atom linter.
Severity Provider Description Line
spec/graph/functions/add_order_spec.rb00018:6
LF1 deprecationUTF-8RSpecmaster2+29git+2 updates
An error occurred while Layout/SpaceInsideHashLiteralBraces cop was inspecting /var/folders/ym/5bft7s0x5f58h3kr0zlhpxwh0000gs/T/d-117513-94259-44j9si.8nq7ntrzfr/rubocop.rb:5:17. To see the complete backtrace run rubocop -d.
1 error occurred: An error occurred while Layout/SpaceInsideHashLiteralBraces cop was inspecting /var/folders/ym/5bft7s0x5f58h3kr0zlhpxwh0000gs/T/d-117513-94259-44j9si.8nq7ntrzfr/rubocop.rb:5:17. Errors are usually caused by RuboCop bugs. Please, report your problems to RuboCop's issue tracker. Mention the following information in the issue report: 0.49.1 (using Parser 2.4.0.0, running on ruby 2.4.0 x86_64-darwin15)
$ rubocop -d
...
An error occurred while Layout/SpaceInsideHashLiteralBraces cop was inspecting /Users/tscott/code/rails_projects/maker_paper/spec/graph/functions/add_order_spec.rb:5:17.
undefined method `map' for "no_space":String
Did you mean? tap
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/mixin/configurable_enforced_style.rb:88:in `supported_styles'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/mixin/configurable_enforced_style.rb:66:in `style'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb:70:in `expect_space?'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb:52:in `check'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb:18:in `block in on_hash'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb:35:in `hash_literal_with_braces'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb:17:in `on_hash'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:44:in `block (2 levels) in on_hash'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:106:in `with_cop_error_handling'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:43:in `block in on_hash'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:42:in `each'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:42:in `on_hash'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/ast/traversal.rb:154:in `on_block'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:48:in `on_block'
(eval):2:in `block in on_begin'
(eval):2:in `each'
(eval):2:in `on_begin'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:48:in `on_begin'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/ast/traversal.rb:154:in `on_block'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:48:in `on_block'
(eval):2:in `block in on_begin'
(eval):2:in `each'
(eval):2:in `on_begin'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:48:in `on_begin'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/ast/traversal.rb:12:in `walk'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/commissioner.rb:60:in `investigate'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/team.rb:112:in `investigate'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/team.rb:100:in `offenses'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cop/team.rb:42:in `inspect_file'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:258:in `inspect_file'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:205:in `block in do_inspection_loop'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:237:in `block in iterate_until_no_changes'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:230:in `loop'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:230:in `iterate_until_no_changes'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:201:in `do_inspection_loop'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:111:in `block in file_offenses'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:121:in `file_offense_cache'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:109:in `file_offenses'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:100:in `process_file'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:75:in `each'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:75:in `reduce'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:75:in `each_inspected_file'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:67:in `inspect_files'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/runner.rb:39:in `run'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cli.rb:82:in `execute_runner'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/lib/rubocop/cli.rb:28:in `run'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/bin/rubocop:13:in `block in <top (required)>'
/Users/tscott/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
/Users/tscott/.rvm/gems/ruby-2.4.0/gems/rubocop-0.49.1/bin/rubocop:12:in `<top (required)>'
/Users/tscott/.rvm/gems/ruby-2.4.0/bin/rubocop:22:in `load'
/Users/tscott/.rvm/gems/ruby-2.4.0/bin/rubocop:22:in `<main>'
/Users/tscott/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/Users/tscott/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
...
$ rubocop -V
0.49.1 (using Parser 2.4.0.0, running on ruby 2.4.0 x86_64-darwin15)
@timscott can you provide more info to reproduce the error? The content of /Users/tscott/code/rails_projects/maker_paper/spec/graph/functions/add_order_spec.rb:5:17 or if you added something in the config file, etc.
@Ana06 - I cannot now reproduce it. I think closing and re-opening Atom made it go away.
This is the code (redacted) that probably triggered it:
let(:args) do
{
foo: 123,
bar: 'xxx',
items: [{
baz: foo.bar,
qux: {
fred: 999
}
}]
}
end
From the error message, it looks like it was trying to parse the SupportedStyles configuration parameter, but encountered a single value instead of an array.
If there was a problem with the configuration file, it would explain why restarting Atom (which I assume reloads the configuration file) resolved it. 馃檪
Okay, so I still get the error on several files when I run rubocop in the terminal. An example of a line that triggers the error:
foo = {errors: bar}
My config is like so:
Layout/SpaceInsideHashLiteralBraces:
SupportedStyles: no_space
SupportedStylesForEmptyBraces: no_space
Then I change it to:
Layout/SpaceInsideHashLiteralBraces:
SupportedStyles:
- no_space
SupportedStylesForEmptyBraces:
- no_space
Now I get a different error on Layout/SpaceInsideHashLiteralBraces for all the same lines:
Unknown style space selected!
The SupportedStyles shouldn't go in your configuration. These are there to tell you (and RuboCop configuration loader) which options you can use for EnforcedStyle. 馃檪
Your config should likely be this:
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle:
- no_space
EnforcedStyleForEmptyBraces:
- no_space
@Drenmi's suggestion solves the problem, I believe. Closing.