pre-commit 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/templates/hooks/automatic +2 -2
- data/templates/hooks/default +2 -2
- metadata +2 -3
- data/lib/plugins/pre_commit/checks/php.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f9bf8ebb73fb121cdc9ce60b5bd6f8fbb88738
|
4
|
+
data.tar.gz: daae6e81f29f5d0b0d98be38fbda95bda9ed0c14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71055c47a64fec652fc176defceceab2c80d913d442f7c91c025ffc527461f2e0224da2f1fd54944e1ce6b59f89f7e411a5b62c89345a581ec3b1d257644dc2f
|
7
|
+
data.tar.gz: c4e33f9f692303cf706b80be808c20769f87bae32f8c3e5ae2b2f83efd8df89ecafb0845a2267f83d9f799bdf494ed2269a32987b42509f619da43eb579c4abe
|
data/templates/hooks/automatic
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
cmd=`git config pre-commit.ruby 2>/dev/null`
|
13
13
|
if test -n "${cmd}"
|
14
14
|
then true
|
15
|
-
elif which rvm
|
15
|
+
elif which rvm >/dev/null 2>/dev/null
|
16
16
|
then cmd="rvm default do ruby"
|
17
|
-
elif which rbenv
|
17
|
+
elif which rbenv >/dev/null 2>/dev/null
|
18
18
|
then cmd="rbenv exec ruby"
|
19
19
|
else cmd="ruby"
|
20
20
|
fi
|
data/templates/hooks/default
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
cmd=`git config pre-commit.ruby 2>/dev/null`
|
13
13
|
if test -n "${cmd}"
|
14
14
|
then true
|
15
|
-
elif which rvm
|
15
|
+
elif which rvm >/dev/null 2>/dev/null
|
16
16
|
then cmd="rvm default do ruby"
|
17
|
-
elif which rbenv
|
17
|
+
elif which rbenv >/dev/null 2>/dev/null
|
18
18
|
then cmd="rbenv exec ruby"
|
19
19
|
else cmd="ruby"
|
20
20
|
fi
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pre-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shajith Chacko, Josh Lubaway
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pluginator
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- lib/plugins/pre_commit/checks/merge_conflict.rb
|
137
137
|
- lib/plugins/pre_commit/checks/migration.rb
|
138
138
|
- lib/plugins/pre_commit/checks/nb_space.rb
|
139
|
-
- lib/plugins/pre_commit/checks/php.rb
|
140
139
|
- lib/plugins/pre_commit/checks/pry.rb
|
141
140
|
- lib/plugins/pre_commit/checks/rails.rb
|
142
141
|
- lib/plugins/pre_commit/checks/rspec_focus.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'pre-commit/checks/plugin'
|
2
|
-
|
3
|
-
module PreCommit
|
4
|
-
module Checks
|
5
|
-
class Php < Plugin
|
6
|
-
|
7
|
-
def call(staged_files)
|
8
|
-
staged_files = staged_files.grep /\.(php|engine|theme|install|inc|module|test)$/
|
9
|
-
return if staged_files.empty?
|
10
|
-
|
11
|
-
errors = staged_files.map { |file| run_check(file) }.compact
|
12
|
-
return if errors.empty?
|
13
|
-
|
14
|
-
errors.join("\n")
|
15
|
-
end
|
16
|
-
|
17
|
-
def run_check(file)
|
18
|
-
# We force PHP to display errors otherwise they will likely end up in the
|
19
|
-
# error_log and not in stdout.
|
20
|
-
result = `php -d display_errors=1 -l #{file} 2>&1`
|
21
|
-
# Filter out the obvious note from PHP.
|
22
|
-
result = result.split($/).find_all {|line| line !~ /Errors/}.join($/)
|
23
|
-
# If PHP exited non-zero then there was a parse error.
|
24
|
-
result.strip unless $? == 0
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.description
|
28
|
-
"Detects PHP errors."
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|