Skip to content

Implement exec command #11

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

Merged
merged 1 commit into from
Jun 25, 2016
Merged

Implement exec command #11

merged 1 commit into from
Jun 25, 2016

Conversation

shoyan
Copy link

@shoyan shoyan commented Jun 23, 2016

Hello. checkstyle_filter-git is good product.

I found one bug that following.

⇒  vendor/bin/phpcs -n --report=checkstyle index.php | bundle exec checkstyle_filter-git diff origin/master
bundler: failed to load command: checkstyle_filter-git (/Users/shoyan/app/vendor/bundle/ruby/2.3.0/bin/checkstyle_filter-git)
ArgumentError: invalid byte sequence in UTF-8
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/git_diff_parser-2.3.0/lib/git_diff_parser/patches.rb:22:in `==='
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/git_diff_parser-2.3.0/lib/git_diff_parser/patches.rb:22:in `block in parse'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/git_diff_parser-2.3.0/lib/git_diff_parser/patches.rb:20:in `each'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/git_diff_parser-2.3.0/lib/git_diff_parser/patches.rb:20:in `each_with_index'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/git_diff_parser-2.3.0/lib/git_diff_parser/patches.rb:20:in `parse'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/git_diff_parser-2.3.0/lib/git_diff_parser.rb:13:in `parse'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/checkstyle_filter-git-1.0.3/lib/checkstyle_filter/git/filter.rb:8:in `filter'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/checkstyle_filter-git-1.0.3/lib/checkstyle_filter/git/cli.rb:29:in `diff'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/gems/checkstyle_filter-git-1.0.3/exe/checkstyle_filter-git:6:in `<top (required)>'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/bin/checkstyle_filter-git:23:in `load'
  /Users/shoyan/app/vendor/bundle/ruby/2.3.0/bin/checkstyle_filter-git:23:in `<top (required)>'

A character encoding of index.php is EUC-JP.

I first had to customize the diff command. However, it did not work.
So I implemented exec command.

For example.

$  vendor/bin/phpcs -n --report=checkstyle index.php | bundle exec checkstyle_filter-git exec "git diff --no-color origin/master | iconv -f EUCJP -t UTF8"
<?xml version='1.0' encoding='UTF-8'?>
<checkstyle version='2.6.1'>
<file name='/Users/shoyan/app/index.php'>
 <error column='5' line='9' message='Expected 1 space after closing parenthesis; found 0' severity='error' source='Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis'/>
</file>
</checkstyle>

@sanemat
Copy link
Member

sanemat commented Jun 23, 2016

Thank you for your patch! I understand the use case which you wrote.

@shoyan
Copy link
Author

shoyan commented Jun 23, 2016

@sanemat

Thank you for the quick response! Please refer to the following.

その他
ファイルのエンコードがEUC-JPのソースコードに適用したところエラーとなりました。
リポジトリをフォークして対応しました。
http://shoyan.github.io/blog/2016/06/23/php-syntax-check/

@sanemat sanemat merged commit 75b70ad into packsaddle:master Jun 25, 2016
@sanemat
Copy link
Member

sanemat commented Jun 25, 2016

👍

@sanemat
Copy link
Member

sanemat commented Jun 25, 2016

I ship v1.1.0 🎉

@shoyan
Copy link
Author

shoyan commented Jun 27, 2016

Thank you! 🎉

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

Successfully merging this pull request may close these issues.

2 participants