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/FileName raises if filename contains a space #2850

Closed
emil-rb opened this issue Feb 16, 2016 · 3 comments
Closed

Style/FileName raises if filename contains a space #2850

emil-rb opened this issue Feb 16, 2016 · 3 comments

Comments

@emil-rb
Copy link

emil-rb commented Feb 16, 2016

When inspecting an file with a space in the name Rubocop raises.

$ rubocop git-hooks/file\ r.rb -d
For /home/user/workspaces/rb/services: configuration from /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/config/default.yml
Inheriting configuration from /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/config/enabled.yml
Inheriting configuration from /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/config/disabled.yml
Inspecting 1 file
Scanning /home/user/workspaces/rb/services/git-hooks/file r.rb
An error occurred while Style/FileName cop was inspecting /home/user/workspaces/rb/services/git-hooks/file r.rb.
undefined method `start_with?' for nil:NilClass
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/style/file_name.rb:52:in `shebang?'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/style/file_name.rb:36:in `investigate'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/commissioner.rb:91:in `block (2 levels) in invoke_custom_processing'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/commissioner.rb:97:in `with_cop_error_handling'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/commissioner.rb:90:in `block in invoke_custom_processing'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/commissioner.rb:87:in `each'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/commissioner.rb:87:in `invoke_custom_processing'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/commissioner.rb:57:in `investigate'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cop/team.rb:65:in `inspect_file'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:194:in `inspect_file'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:164:in `block in do_inspection_loop'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:158:in `loop'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:158:in `do_inspection_loop'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:87:in `process_file'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:59:in `block in inspect_files'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:57:in `each'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:57:in `inspect_files'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:35:in `run'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/lib/rubocop/cli.rb:30:in `run'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/bin/rubocop:14:in `block in <top (required)>'
/home/user/.rbenv/versions/2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rubocop-0.37.2/bin/rubocop:13:in `<top (required)>'
/home/user/.rbenv/versions/2.3.0/bin/rubocop:23:in `load'
/home/user/.rbenv/versions/2.3.0/bin/rubocop:23:in `<main>'
.

1 file inspected, no offenses detected

1 error occurred:
An error occurred while Style/FileName cop was inspecting /home/user/workspaces/rb/services/git-hooks/file r.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.37.2 (using Parser 2.3.0.6, running on ruby 2.3.0 x86_64-linux)
Finished in 0.07673738700032118 seconds
$ rubocop -V
0.37.2 (using Parser 2.3.0.6, running on ruby 2.3.0 x86_64-linux)

The same thing happens with Ruby 2.1, but not with 2.2. The file in question is empty.

@alexdowad
Copy link
Contributor

The problem is that the file is empty, not that the name contains a space.

@alexdowad
Copy link
Contributor

Uh... I guess it's the combination.

@alexdowad
Copy link
Contributor

Just pushing a fix to my open PR.

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

2 participants