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

Rake task blows up with ‘Error: No such file - lib/**/*.rb’ #642

Closed
chastell opened this issue Aug 17, 2015 · 11 comments · Fixed by #683
Closed

Rake task blows up with ‘Error: No such file - lib/**/*.rb’ #642

chastell opened this issue Aug 17, 2015 · 11 comments · Fixed by #683
Labels

Comments

@chastell
Copy link
Collaborator

I think this is a new bug in reek 3.2 – running reek works, running rake reek blows up with Error: No such file - lib/**/*.rb. Example from my art_decomp code:

Error: No such file - lib/**/*.rb
/home/chastell/.rubies/ruby-2.2.2/lib/ruby/2.2.0/find.rb:42:in `block in find': No such file or directory (Errno::ENOENT)
    from /home/chastell/.rubies/ruby-2.2.2/lib/ruby/2.2.0/find.rb:42:in `collect!'
    from /home/chastell/.rubies/ruby-2.2.2/lib/ruby/2.2.0/find.rb:42:in `find'
    from /home/chastell/.rubies/ruby-2.2.2/lib/ruby/2.2.0/pathname.rb:551:in `find'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/source/source_locator.rb:37:in `block in source_paths'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/source/source_locator.rb:35:in `each'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/source/source_locator.rb:35:in `each_with_object'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/source/source_locator.rb:35:in `source_paths'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/source/source_locator.rb:27:in `sources'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/cli/input.rb:39:in `sources_from_argv'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/cli/input.rb:18:in `sources'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/cli/reek_command.rb:13:in `execute'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/lib/reek/cli/application.rb:34:in `execute'
    from /home/chastell/.gem/ruby/2.2.2/gems/reek-3.2/bin/reek:12:in `<top (required)>'
    from /home/chastell/.gem/ruby/2.2.2/bin/reek:23:in `load'
    from /home/chastell/.gem/ruby/2.2.2/bin/reek:23:in `<main>'
    from /home/chastell/.gem/ruby/2.2.2/bin/ruby_executable_hooks:15:in `eval'
    from /home/chastell/.gem/ruby/2.2.2/bin/ruby_executable_hooks:15:in `<main>'
@chastell
Copy link
Collaborator Author

(I’d debug and fix outright, but I’m on vacations and can’t plan my reek time in any way, sorry.)

@troessner
Copy link
Owner

Hmm, pretty weird.

Adding a binding.pry before here: https://github.com/troessner/reek/blob/master/lib/reek/rake/task.rb#L85

gives me:

[1] pry(#<Reek::Rake::Task>)> p(*command)
"reek"
"lib/**/*.rb"
=> ["reek", "lib/**/*.rb"]

which blows up.

But if I do a

reek lib/**/*.rb

it works. Investigating...

@mvz
Copy link
Collaborator

mvz commented Aug 17, 2015

I'm guessing the rake task bypasses shell globbing.

@troessner
Copy link
Owner

On the road until tomorrow - @mvz do you have time to look into it? I probably cant look into it until tomorrow evening.

@troessner
Copy link
Owner

I just did a git bisect:

git bisect start
git bisect good 6796823
git bisect bad 5596f1b

And look what it found:

( $ ((no branch, bisect started on master))) git bisect good
864f0a92fbdde7d197125d50653cb25f8a42d42c is the first bad commit
commit 864f0a92fbdde7d197125d50653cb25f8a42d42c
Author: Piotr Szotkowski <[email protected]>
Date:   Sun Jul 26 23:29:45 2015 +0200

    Access ivars only in constructors and for memoization

Checking out this commit now.

troessner added a commit that referenced this issue Aug 17, 2015
@troessner
Copy link
Owner

I considered fixing this pretty urgent since most reek integrations will be using the rake task and this will fail for everybody who upgrades or install reek fresh.

What I did:

  • Found the buggy commit
  • I reverted the commit in question: c5c4d07
  • Made sure "rake reek" is running again and the specs are passing
  • Bumped the version 3.2.1 4f962d2
  • And released it

Aftermath:

Let's find out what the problem was with c5c4d07 and re-introduce it. @chastell since you're the author of this commit, would you like to take over? I quickly skimmed it but couldn't see anything obvious.

@troessner
Copy link
Owner

I think I found the bug - bugfix is up here: #644
Please review. :)

@chastell
Copy link
Collaborator Author

Great debugging! It might’ve been a tad easier if the commits were smaller – but, well… ;)

Apologies for this; as mentioned in #644 I’ll write tests for Reek::Rake::Task so that this won’t happen again.

@backus
Copy link
Contributor

backus commented Sep 3, 2015

@troessner I think this issue should be reopened. Rake tasks that customize source_files like this one mbj/devtools: reek.rake are still broken. The current release evaluates the FileList in the initializer only while releases before 864f0a9 evaluated the FileList at runtime.

@chastell
Copy link
Collaborator Author

chastell commented Sep 3, 2015

Oh, good point. I think using the setters is a canonical Rake task usage. I’ll fix it early next week at the latest (I’m travelling at the moment).

@troessner
Copy link
Owner

Fix up in #683 - please review.

Sorry @chastell 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants