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

Style/StyleAroundBlockParameters failing #1647

Closed
jreidinger opened this issue Feb 10, 2015 · 2 comments
Closed

Style/StyleAroundBlockParameters failing #1647

jreidinger opened this issue Feb 10, 2015 · 2 comments

Comments

@jreidinger
Copy link

output of rubocop:

~/yast/yast2> rubocop.ruby2.1 -d /home/jreidinger/yast/yast2/library/control/testsuite/tests/restore.rb

Inspecting 1 file
Scanning /home/jreidinger/yast/yast2/library/control/testsuite/tests/restore.rb
For /home/jreidinger/yast/yast2/library/control/testsuite/tests: configuration from /home/jreidinger/yast/yast2/.rubocop.yml
Inheriting configuration from /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml
Default configuration from /usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/config/default.yml
Inheriting configuration from /usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/config/enabled.yml
Inheriting configuration from /usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/config/disabled.yml
An error occurred while Style/SpaceAroundBlockParameters cop was inspecting /home/jreidinger/yast/yast2/library/control/testsuite/tests/restore.rb.
undefined method `loc' for nil:NilClass
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/cop/style/space_around_block_parameters.rb:40:in `check_inside_pipes'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/cop/style/space_around_block_parameters.rb:23:in `on_block'
(eval):5:in `block (2 levels) in on_block'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/cop/commissioner.rb:92:in `with_cop_error_handling'
(eval):4:in `block in on_block'
(eval):2:in `each'
(eval):2:in `on_block'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:255:in `block in process_all'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `map'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `process_all'
/usr/lib64/ruby/gems/2.1.0/gems/parser-2.2.0.2/lib/parser/ast/processor.rb:142:in `on_send'
(eval):9:in `on_send'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:255:in `block in process_all'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `map'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `process_all'
/usr/lib64/ruby/gems/2.1.0/gems/parser-2.2.0.2/lib/parser/ast/processor.rb:9:in `process_regular_node'
(eval):9:in `on_begin'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/parser-2.2.0.2/lib/parser/ast/processor.rb:121:in `on_def'
(eval):9:in `on_def'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:255:in `block in process_all'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `map'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `process_all'
/usr/lib64/ruby/gems/2.1.0/gems/parser-2.2.0.2/lib/parser/ast/processor.rb:9:in `process_regular_node'
(eval):9:in `on_class'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:255:in `block in process_all'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `map'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `process_all'
/usr/lib64/ruby/gems/2.1.0/gems/parser-2.2.0.2/lib/parser/ast/processor.rb:9:in `process_regular_node'
(eval):9:in `on_module'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:255:in `block in process_all'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `map'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:254:in `process_all'
/usr/lib64/ruby/gems/2.1.0/gems/parser-2.2.0.2/lib/parser/ast/processor.rb:9:in `process_regular_node'
(eval):9:in `on_begin'
/usr/lib64/ruby/gems/2.1.0/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/cop/commissioner.rb:52:in `investigate'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/cop/team.rb:33:in `inspect_file'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:126:in `inspect_file'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:97:in `block in do_inspection_loop'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:91:in `loop'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:91:in `do_inspection_loop'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:69:in `process_file'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:38:in `block in run'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:36:in `each'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/runner.rb:36:in `run'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/lib/rubocop/cli.rb:24:in `run'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/bin/rubocop:13:in `block in <top (required)>'
/usr/lib64/ruby/2.1.0/benchmark.rb:294:in `realtime'
/usr/lib64/ruby/gems/2.1.0/gems/rubocop-0.29.0/bin/rubocop:12:in `<top (required)>'
/usr/bin/rubocop.ruby2.1:23:in `load'
/usr/bin/rubocop.ruby2.1:23:in `<main>'
.

1 file inspected, no offenses detected

1 error occurred:
An error occurred while Style/SpaceAroundBlockParameters cop was inspecting /home/jreidinger/yast/yast2/library/control/testsuite/tests/restore.rb.
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.29.0 (using Parser 2.2.0.2, running on ruby 2.1.5 x86_64-linux-gnu)
Finished in 0.04652044 seconds

content of file on which it failed:

module Yast
  class RestoreClient < Client
    def main
      Yast.include self, "testsuite.rb"
      Yast.import "ProductFeatures"

      @READ = {
        "product" => {
          "features" => {
            "USE_DESKTOP_SCHEDULER"           => "0",
            "ENABLE_AUTOLOGIN"                => "yes",
            "EVMS_CONFIG"                     => "0",
            "IO_SCHEDULER"                    => "cfg",
            "UI_MODE"                         => "expert",
            "INCOMPLETE_TRANSLATION_TRESHOLD" => "95"
          }
        }
      }

      TEST(->() { ProductFeatures.GetStringFeature("globals", "ui_mode") }, [
        @READ
      ], 0)
      TEST(lambda do
        ProductFeatures.GetStringFeature("globals", "enable_autologin")
      end, [
        @READ
      ], 0)
      TEST(lambda do
        ProductFeatures.GetBooleanFeature("globals", "enable_autologin")
      end, [
        @READ
      ], 0)
      TEST(lambda do
        ProductFeatures.GetIntegerFeature(
          "globals",
          "incomplete_translation_treshold"
        )
      end, [
        @READ
      ], 95)

      nil
    end
  end
end

We hit this issue on much more files, but this one is quite small

@jreidinger
Copy link
Author

if you need more information, just ask

bbatsov added a commit that referenced this issue Feb 11, 2015
…ers_when_no_args

[Fix #1647] Skip Style/SpaceAroundBlockParameters when lambda has no argument
@jreidinger
Copy link
Author

thanks for quick fix

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

No branches or pull requests

1 participant