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

Not finish to search files when there is a directory named "," #1644

Closed
naoty opened this issue Feb 8, 2015 · 3 comments · Fixed by #1645 or #1681
Closed

Not finish to search files when there is a directory named "," #1644

naoty opened this issue Feb 8, 2015 · 3 comments · Fixed by #1645 or #1681

Comments

@naoty
Copy link

naoty commented Feb 8, 2015

I'm using 0.28.0 and ruby 2.1.5. When there is a directory named ,, rubocop command will not finish. I exclude , directory like below to fix this. The , character in the pattern to search files should be escaped.

AllCops:
  Exclude:
    - ",/**/*"
@bquorning
Copy link
Contributor

I cannot reproduce this error:

Code/rubocop-test » tree -a
.
├── ,
│   └── foo.rb
├── .rubocop.yml
└── foo.rb

1 directory, 3 files

Code/rubocop-test » cat .rubocop.yml
AllCops:
  Exclude:
    - ",/**/*"

Code/rubocop-test » rubocop --version
0.28.0

Code/rubocop-test » rubocop
Inspecting 1 file
.

1 file inspected, no offenses detected

@naoty
Copy link
Author

naoty commented Feb 8, 2015

Sorry for my poor description. I can reproduce this problem.

% tree .
.
├── ,
│   └── foo.rb
└── foo.rb
% rubocop
(not finished)

@bquorning
Copy link
Contributor

Ah, I see. The problem is in TargetFinder#find_files, where the “wanted toplevel dirs” (which includes ,) are joined together into a Dir.glob pattern. And the dirs are joined by commas…

I’ll try to come up with a solution.

bquorning added a commit to bquorning/rubocop that referenced this issue Feb 12, 2015
If a toplevel folder is named ',' the resulting pattern for Dir.glob
would contain something like {foo/,}/**/*, which would search the
entire file system.
bbatsov added a commit that referenced this issue Feb 12, 2015
[Fix #1644] Avoid globbing entire file system
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Feb 27, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Mar 23, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Apr 9, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Apr 21, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Apr 28, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Apr 28, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Apr 29, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue May 3, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue May 18, 2015
bbatsov added a commit that referenced this issue May 19, 2015
…stem

[Fix #1644] Avoid globbing entire file system (fix for jruby and rbx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants