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

"pronto run" doesn't to do anything, --staged crashes #240

Open
stiller-leser opened this issue May 29, 2017 · 1 comment
Open

"pronto run" doesn't to do anything, --staged crashes #240

stiller-leser opened this issue May 29, 2017 · 1 comment
Assignees
Labels

Comments

@stiller-leser
Copy link
Contributor

stiller-leser commented May 29, 2017

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.

@vochicong
Copy link

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

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

No branches or pull requests

3 participants