pronto
pronto copied to clipboard
"pronto run" doesn't to do anything, --staged crashes
I created a bogus file on a bogus branch on my MacOS machine:
#I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY LONG LINE I AM A VERY
def i_am_a_vunction lala, lulu
puts lulu
end
i_am_a_vunction "hahaha"
However neither of the following commands yields a result until I have commited the changes:
pronto run (before or after git add .) pronto run --unstaged (before git add .)
Running pronto run --staged (after git add .) I get the following error message:
/Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/git/repository.rb:52:in `new': the path 'test.rb' does not exist in the given tree (Rugged::TreeError)
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/git/repository.rb:52:in `blame'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/git/patch.rb:17:in `blame'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/git/line.rb:45:in `blame'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/git/line.rb:20:in `commit_sha'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/message.rb:18:in `initialize'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:49:in `new'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:49:in `new_message'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:41:in `block (2 levels) in inspect'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:41:in `map'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:41:in `block in inspect'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:38:in `map'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:38:in `inspect'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:18:in `block in run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:18:in `map'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-rubocop-0.9.0/lib/pronto/rubocop.rb:18:in `run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/runners.rb:20:in `block in run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/runners.rb:13:in `each'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/runners.rb:13:in `run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto.rb:64:in `run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/cli.rb:61:in `block in run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/cli.rb:60:in `chdir'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/lib/pronto/cli.rb:60:in `run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/gems/pronto-0.9.3/bin/pronto:6:in `<top (required)>'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/bin/pronto:23:in `load'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/bin/pronto:23:in `<main>'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/MyUser/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Only after I commit I get to see the error messages of the runners. However I would prefer to be able to run pronto as a pre-commit-git-hook.
Update 1:
Seems like the issue is that the file is untracked. Is there a way to run pronto on untracked files?
Update 2:
Running pronto run --unstaged
on existing files works fine before running git add .
- however running pronto run --staged
after git add .
still crashes.
Update 3:
Seems like pronto run --staged
only crashes for new files. It does however work fine for existing files.
My workaround:
- Git reset newly added (Ruby) files once and re-add later after
pronto run --staged
- Check the newly added (Ruby) files by running separate checkers (Reek, Rubocop, ...)
https://gist.github.com/vochicong/9c58ffbe045772fc2d4010b0b7c63f41#file-precommit-part1-sh https://gist.github.com/vochicong/9c58ffbe045772fc2d4010b0b7c63f41#file-precommit-part2-sh