danger-php_codesniffer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rubocop.yml +152 -0
- data/.travis.yml +12 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +136 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +20 -0
- data/Rakefile +23 -0
- data/danger-php_codesniffer.gemspec +49 -0
- data/lib/danger_php_codesniffer.rb +1 -0
- data/lib/danger_plugin.rb +1 -0
- data/lib/php_codesniffer/gem_version.rb +3 -0
- data/lib/php_codesniffer/plugin.rb +138 -0
- data/spec/fixtures/php/empty.php +7 -0
- data/spec/fixtures/php/error.php +9 -0
- data/spec/fixtures/php/warning.php +7 -0
- data/spec/fixtures/result/empty.json +14 -0
- data/spec/fixtures/result/error.json +24 -0
- data/spec/fixtures/result/multiple.json +57 -0
- data/spec/fixtures/result/warning.json +24 -0
- data/spec/php_codesniffer_spec.rb +115 -0
- data/spec/spec_helper.rb +67 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9fbc1d6bc595b3950846a2011d8f337d8e1e044c34aa74ffe44dde1df195ad98
|
4
|
+
data.tar.gz: 4bf62fa2c4a933800d97cd62a41604b5723a9dbddbc31b8fb809ebc0235c20b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e380a24d2f6d5f3af26543480477fee71760c42e5c54f17ca1865c1aa32cfcaaa19781a12327b16e7e94689dbb8434586b6cc945f3407e2d5da94c6015eaa24e
|
7
|
+
data.tar.gz: 513fc22cf91f3549958a87b4e5c067431141e44165e361f262a1e6659d06b5641d8f3cc0fbf95a459c982773bffc40d7b98d67d18490e9004ade02cb96c9b8c4
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
|
3
|
+
# If you don't like these settings, just delete this file :)
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.0
|
7
|
+
|
8
|
+
Style/StringLiterals:
|
9
|
+
EnforcedStyle: double_quotes
|
10
|
+
Enabled: true
|
11
|
+
|
12
|
+
# kind_of? is a good way to check a type
|
13
|
+
Style/ClassCheck:
|
14
|
+
EnforcedStyle: kind_of?
|
15
|
+
|
16
|
+
# It's better to be more explicit about the type
|
17
|
+
Style/BracesAroundHashParameters:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# specs sometimes have useless assignments, which is fine
|
21
|
+
Lint/UselessAssignment:
|
22
|
+
Exclude:
|
23
|
+
- '**/spec/**/*'
|
24
|
+
|
25
|
+
# We could potentially enable the 2 below:
|
26
|
+
Layout/IndentHash:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Layout/AlignHash:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# HoundCI doesn't like this rule
|
33
|
+
Layout/DotPosition:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# We allow !! as it's an easy way to convert ot boolean
|
37
|
+
Style/DoubleNegation:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# Cop supports --auto-correct.
|
41
|
+
Lint/UnusedBlockArgument:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
# We want to allow class Fastlane::Class
|
45
|
+
Style/ClassAndModuleChildren:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Metrics/AbcSize:
|
49
|
+
Max: 60
|
50
|
+
|
51
|
+
# The %w might be confusing for new users
|
52
|
+
Style/WordArray:
|
53
|
+
MinSize: 19
|
54
|
+
|
55
|
+
# raise and fail are both okay
|
56
|
+
Style/SignalException:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
# Better too much 'return' than one missing
|
60
|
+
Style/RedundantReturn:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# Having if in the same line might not always be good
|
64
|
+
Style/IfUnlessModifier:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# and and or is okay
|
68
|
+
Style/AndOr:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
# Configuration parameters: CountComments.
|
72
|
+
Metrics/ClassLength:
|
73
|
+
Max: 350
|
74
|
+
|
75
|
+
Metrics/CyclomaticComplexity:
|
76
|
+
Max: 17
|
77
|
+
|
78
|
+
# Configuration parameters: AllowURI, URISchemes.
|
79
|
+
Metrics/LineLength:
|
80
|
+
Max: 370
|
81
|
+
|
82
|
+
# Configuration parameters: CountKeywordArgs.
|
83
|
+
Metrics/ParameterLists:
|
84
|
+
Max: 10
|
85
|
+
|
86
|
+
Metrics/PerceivedComplexity:
|
87
|
+
Max: 18
|
88
|
+
|
89
|
+
# Sometimes it's easier to read without guards
|
90
|
+
Style/GuardClause:
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
# something = if something_else
|
94
|
+
# that's confusing
|
95
|
+
Style/ConditionalAssignment:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
# Better to have too much self than missing a self
|
99
|
+
Style/RedundantSelf:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
Metrics/MethodLength:
|
103
|
+
Max: 60
|
104
|
+
|
105
|
+
# We're not there yet
|
106
|
+
Style/Documentation:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# Adds complexity
|
110
|
+
Style/IfInsideElse:
|
111
|
+
Enabled: false
|
112
|
+
|
113
|
+
# danger specific
|
114
|
+
|
115
|
+
Style/BlockComments:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
Layout/MultilineMethodCallIndentation:
|
119
|
+
EnforcedStyle: indented
|
120
|
+
|
121
|
+
# FIXME: 25
|
122
|
+
Metrics/BlockLength:
|
123
|
+
Max: 345
|
124
|
+
Exclude:
|
125
|
+
- "**/*_spec.rb"
|
126
|
+
|
127
|
+
Style/MixinGrouping:
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
Style/FileName:
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
Layout/IndentHeredoc:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
Style/SpecialGlobalVars:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
PercentLiteralDelimiters:
|
140
|
+
PreferredDelimiters:
|
141
|
+
"%": ()
|
142
|
+
"%i": ()
|
143
|
+
"%q": ()
|
144
|
+
"%Q": ()
|
145
|
+
"%r": "{}"
|
146
|
+
"%s": ()
|
147
|
+
"%w": ()
|
148
|
+
"%W": ()
|
149
|
+
"%x": ()
|
150
|
+
|
151
|
+
Security/YAMLLoad:
|
152
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-php_codesniffer (0.1.0)
|
5
|
+
danger-plugin-api (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
ast (2.4.0)
|
13
|
+
claide (1.0.2)
|
14
|
+
claide-plugins (0.9.2)
|
15
|
+
cork
|
16
|
+
nap
|
17
|
+
open4 (~> 1.3)
|
18
|
+
coderay (1.1.2)
|
19
|
+
colored2 (3.1.2)
|
20
|
+
cork (0.3.0)
|
21
|
+
colored2 (~> 3.1)
|
22
|
+
danger (5.11.1)
|
23
|
+
claide (~> 1.0)
|
24
|
+
claide-plugins (>= 0.9.2)
|
25
|
+
colored2 (~> 3.1)
|
26
|
+
cork (~> 0.1)
|
27
|
+
faraday (~> 0.9)
|
28
|
+
faraday-http-cache (~> 1.0)
|
29
|
+
git (~> 1.5)
|
30
|
+
kramdown (~> 1.5)
|
31
|
+
no_proxy_fix
|
32
|
+
octokit (~> 4.7)
|
33
|
+
terminal-table (~> 1)
|
34
|
+
danger-plugin-api (1.0.0)
|
35
|
+
danger (> 2.0)
|
36
|
+
diff-lcs (1.3)
|
37
|
+
faraday (0.15.4)
|
38
|
+
multipart-post (>= 1.2, < 3)
|
39
|
+
faraday-http-cache (1.3.1)
|
40
|
+
faraday (~> 0.8)
|
41
|
+
ffi (1.10.0)
|
42
|
+
formatador (0.2.5)
|
43
|
+
git (1.5.0)
|
44
|
+
guard (2.15.0)
|
45
|
+
formatador (>= 0.2.4)
|
46
|
+
listen (>= 2.7, < 4.0)
|
47
|
+
lumberjack (>= 1.0.12, < 2.0)
|
48
|
+
nenv (~> 0.1)
|
49
|
+
notiffany (~> 0.0)
|
50
|
+
pry (>= 0.9.12)
|
51
|
+
shellany (~> 0.0)
|
52
|
+
thor (>= 0.18.1)
|
53
|
+
guard-compat (1.2.1)
|
54
|
+
guard-rspec (4.7.3)
|
55
|
+
guard (~> 2.1)
|
56
|
+
guard-compat (~> 1.1)
|
57
|
+
rspec (>= 2.99.0, < 4.0)
|
58
|
+
jaro_winkler (1.5.2)
|
59
|
+
kramdown (1.17.0)
|
60
|
+
listen (3.0.7)
|
61
|
+
rb-fsevent (>= 0.9.3)
|
62
|
+
rb-inotify (>= 0.9.7)
|
63
|
+
lumberjack (1.0.13)
|
64
|
+
method_source (0.9.2)
|
65
|
+
multipart-post (2.0.0)
|
66
|
+
nap (1.1.0)
|
67
|
+
nenv (0.3.0)
|
68
|
+
no_proxy_fix (0.1.2)
|
69
|
+
notiffany (0.1.1)
|
70
|
+
nenv (~> 0.1)
|
71
|
+
shellany (~> 0.0)
|
72
|
+
octokit (4.13.0)
|
73
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
74
|
+
open4 (1.3.4)
|
75
|
+
parallel (1.13.0)
|
76
|
+
parser (2.6.0.0)
|
77
|
+
ast (~> 2.4.0)
|
78
|
+
powerpack (0.1.2)
|
79
|
+
pry (0.12.2)
|
80
|
+
coderay (~> 1.1.0)
|
81
|
+
method_source (~> 0.9.0)
|
82
|
+
public_suffix (3.0.3)
|
83
|
+
rainbow (3.0.0)
|
84
|
+
rake (10.5.0)
|
85
|
+
rb-fsevent (0.10.3)
|
86
|
+
rb-inotify (0.10.0)
|
87
|
+
ffi (~> 1.0)
|
88
|
+
rspec (3.8.0)
|
89
|
+
rspec-core (~> 3.8.0)
|
90
|
+
rspec-expectations (~> 3.8.0)
|
91
|
+
rspec-mocks (~> 3.8.0)
|
92
|
+
rspec-core (3.8.0)
|
93
|
+
rspec-support (~> 3.8.0)
|
94
|
+
rspec-expectations (3.8.2)
|
95
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
+
rspec-support (~> 3.8.0)
|
97
|
+
rspec-mocks (3.8.0)
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
+
rspec-support (~> 3.8.0)
|
100
|
+
rspec-support (3.8.0)
|
101
|
+
rubocop (0.63.0)
|
102
|
+
jaro_winkler (~> 1.5.1)
|
103
|
+
parallel (~> 1.10)
|
104
|
+
parser (>= 2.5, != 2.5.1.1)
|
105
|
+
powerpack (~> 0.1)
|
106
|
+
rainbow (>= 2.2.2, < 4.0)
|
107
|
+
ruby-progressbar (~> 1.7)
|
108
|
+
unicode-display_width (~> 1.4.0)
|
109
|
+
ruby-progressbar (1.10.0)
|
110
|
+
sawyer (0.8.1)
|
111
|
+
addressable (>= 2.3.5, < 2.6)
|
112
|
+
faraday (~> 0.8, < 1.0)
|
113
|
+
shellany (0.0.1)
|
114
|
+
terminal-table (1.8.0)
|
115
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
116
|
+
thor (0.20.3)
|
117
|
+
unicode-display_width (1.4.1)
|
118
|
+
yard (0.9.16)
|
119
|
+
|
120
|
+
PLATFORMS
|
121
|
+
ruby
|
122
|
+
|
123
|
+
DEPENDENCIES
|
124
|
+
bundler (~> 1.3)
|
125
|
+
danger-php_codesniffer!
|
126
|
+
guard (~> 2.14)
|
127
|
+
guard-rspec (~> 4.7)
|
128
|
+
listen (= 3.0.7)
|
129
|
+
pry
|
130
|
+
rake (~> 10.0)
|
131
|
+
rspec (~> 3.4)
|
132
|
+
rubocop (~> 0.63)
|
133
|
+
yard (~> 0.9)
|
134
|
+
|
135
|
+
BUNDLED WITH
|
136
|
+
1.17.3
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A guardfile for making Danger Plugins
|
2
|
+
# For more info see https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# To run, use `bundle exec guard`.
|
5
|
+
|
6
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
7
|
+
require 'guard/rspec/dsl'
|
8
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
+
|
10
|
+
# RSpec files
|
11
|
+
rspec = dsl.rspec
|
12
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_files)
|
15
|
+
|
16
|
+
# Ruby files
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2019 ymhuang <ymhuang@golface.com.tw>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# danger-php_codesniffer
|
2
|
+
|
3
|
+
A description of danger-php_codesniffer.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install danger-php_codesniffer
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Methods and attributes from this plugin are available in
|
12
|
+
your `Dangerfile` under the `php_codesniffer` namespace.
|
13
|
+
|
14
|
+
## Development
|
15
|
+
|
16
|
+
1. Clone this repo
|
17
|
+
2. Run `bundle install` to setup dependencies.
|
18
|
+
3. Run `bundle exec rake spec` to run the tests.
|
19
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
20
|
+
5. Make your changes.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:specs)
|
6
|
+
|
7
|
+
task default: :specs
|
8
|
+
|
9
|
+
task :spec do
|
10
|
+
Rake::Task['specs'].invoke
|
11
|
+
Rake::Task['rubocop'].invoke
|
12
|
+
Rake::Task['spec_docs'].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run RuboCop on the lib/specs directory'
|
16
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
17
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Ensure that the plugin passes `danger plugins lint`'
|
21
|
+
task :spec_docs do
|
22
|
+
sh 'bundle exec danger plugins lint'
|
23
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'php_codesniffer/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-php_codesniffer'
|
8
|
+
spec.version = PhpCodesniffer::VERSION
|
9
|
+
spec.authors = ['ymhuang0808']
|
10
|
+
spec.email = ['ymhuang@golface.com.tw']
|
11
|
+
spec.description = %q{Danger plugin for PHP_CodeSniffer.}
|
12
|
+
spec.summary = %q{Help you use Danger to check code standard and create comments on PR/MR}
|
13
|
+
spec.homepage = 'https://github.com/Golface/danger-php_codesniffer'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
22
|
+
|
23
|
+
# General ruby development
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
|
27
|
+
# Testing support
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
|
+
|
30
|
+
# Linting code and docs
|
31
|
+
spec.add_development_dependency "rubocop", '~>0.63'
|
32
|
+
spec.add_development_dependency "yard", '~>0.9'
|
33
|
+
|
34
|
+
# Makes testing easy via `bundle exec guard`
|
35
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
36
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
37
|
+
|
38
|
+
# If you want to work on older builds of ruby
|
39
|
+
spec.add_development_dependency 'listen', '3.0.7'
|
40
|
+
|
41
|
+
# This gives you the chance to run a REPL inside your tests
|
42
|
+
# via:
|
43
|
+
#
|
44
|
+
# require 'pry'
|
45
|
+
# binding.pry
|
46
|
+
#
|
47
|
+
# This will stop test execution and let you inspect the results
|
48
|
+
spec.add_development_dependency 'pry'
|
49
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "php_codesniffer/gem_version"
|
@@ -0,0 +1 @@
|
|
1
|
+
require "php_codesniffer/plugin"
|
@@ -0,0 +1,138 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
# Checks PHP files code standard using [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
|
5
|
+
#
|
6
|
+
# @example Execute PHP_CodeSniffer with changed files only and ignored directory
|
7
|
+
#
|
8
|
+
# php_codesniffer.ignore = "./vendor"
|
9
|
+
# php_codesniffer.filtering = true
|
10
|
+
# php_codesniffer.exec
|
11
|
+
#
|
12
|
+
# @see golface/danger-php_codesniffer
|
13
|
+
# @tags monday, weekends, time, rattata
|
14
|
+
#
|
15
|
+
class DangerPhpCodesniffer < Plugin
|
16
|
+
|
17
|
+
# An attribute that you can read/write from your Dangerfile
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :ignore
|
21
|
+
|
22
|
+
# Enable filtering
|
23
|
+
# Only show messages within changed files.
|
24
|
+
# @return [Boolean]
|
25
|
+
attr_accessor :filtering
|
26
|
+
|
27
|
+
# Execute and process phpcs CLL's result.
|
28
|
+
#
|
29
|
+
# @return [void]
|
30
|
+
def exec
|
31
|
+
bin = phpcs_path
|
32
|
+
raise "phpcs is not installed" unless bin
|
33
|
+
|
34
|
+
summary = { "errors"=> 0, "warnings"=> 0, "fixable"=> 0 }
|
35
|
+
report = []
|
36
|
+
|
37
|
+
unless filtering
|
38
|
+
result = run_phpcs(bin, ".")
|
39
|
+
summary = result.fetch("totals")
|
40
|
+
report = generate_report result
|
41
|
+
else
|
42
|
+
((git.modified_files - git.deleted_files) + git.added_files)
|
43
|
+
.select {|file| ((file.end_with? ".php") || (file.end_with? ".inc"))}
|
44
|
+
.map { |file| file.gsub("#{Dir.pwd}/", '') }
|
45
|
+
.each do |file|
|
46
|
+
result = run_phpcs(bin, file)
|
47
|
+
totals = result.fetch("totals")
|
48
|
+
|
49
|
+
summary["errors"] += totals["errors"]
|
50
|
+
summary["warnings"] += totals.fetch("warnings")
|
51
|
+
summary["fixable"] += totals.fetch("fixable")
|
52
|
+
|
53
|
+
report.push(generate_report result)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
markdown "# PHP_CodeSniffer report"
|
58
|
+
markdown generate_summary_markdown summary
|
59
|
+
markdown report
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Get phpcs' bin path
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
def phpcs_path
|
68
|
+
path = "./vendor/bin/phpcs"
|
69
|
+
File.exist?(path) ? path : find_executable("phpcs")
|
70
|
+
end
|
71
|
+
|
72
|
+
# Execute phpcs CLI and return the the result in JSON object
|
73
|
+
#
|
74
|
+
# @return [Hash]
|
75
|
+
def run_phpcs(bin, file)
|
76
|
+
command = "#{bin} --report=json "
|
77
|
+
command << "--basepath=. "
|
78
|
+
command << "--ignore=#{ignore}" if ignore
|
79
|
+
result = `#{command} #{file}`
|
80
|
+
JSON.parse result
|
81
|
+
end
|
82
|
+
|
83
|
+
# Generate summary markdown text
|
84
|
+
#
|
85
|
+
# @param [Hash] summary
|
86
|
+
# The report summary, default: errors, warnings and fixable are 0
|
87
|
+
# @return [String]
|
88
|
+
def generate_summary_markdown(summary = { errors: 0, warnings: 0, fixable: 0 })
|
89
|
+
request_type = host_type == :gitlab ? "MR" : "PR"
|
90
|
+
"## There are #{summary["errors"]} errors, #{summary["warnings"]} warnings and #{summary["fixable"]} fixable in the #{request_type}"
|
91
|
+
end
|
92
|
+
|
93
|
+
# Generate phpcs report markdown text by each file
|
94
|
+
#
|
95
|
+
# @param [Hash] result
|
96
|
+
# The phpcs result
|
97
|
+
# @return [Array<String>]
|
98
|
+
def generate_report(result)
|
99
|
+
report = []
|
100
|
+
|
101
|
+
result.fetch("files")
|
102
|
+
.each do |file_name, v|
|
103
|
+
tbody = v.fetch("messages")
|
104
|
+
.map do |item|
|
105
|
+
# puts item
|
106
|
+
emoji = item.fetch("type") == "ERROR" ? ":no_entry_sign:" : ":warning:"
|
107
|
+
"<tr><td>#{emoji}</td><td>At line #{item.fetch("line")}</td><td>#{item.fetch("message")}</td></tr>"
|
108
|
+
end
|
109
|
+
.join("\n")
|
110
|
+
|
111
|
+
line = "<details><summary>#{file_name}</summary>"
|
112
|
+
line << "<table><thead><tr><th>Type</th><th>line</th><th>message</th></tr></thead>"
|
113
|
+
line << "<tbody>#{tbody}</tbody></table></details>"
|
114
|
+
|
115
|
+
report.push line
|
116
|
+
end
|
117
|
+
|
118
|
+
report
|
119
|
+
end
|
120
|
+
|
121
|
+
# Get SCM host_type
|
122
|
+
#
|
123
|
+
# return [Symbol]
|
124
|
+
def host_type
|
125
|
+
scm = :other
|
126
|
+
if defined? @dangerfile.gitlab
|
127
|
+
scm = :gitlab
|
128
|
+
|
129
|
+
elsif defined? @dangerfile.github
|
130
|
+
scm = :github
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
scm
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"totals": {
|
3
|
+
"errors": 1,
|
4
|
+
"warnings": 0,
|
5
|
+
"fixable": 1
|
6
|
+
},
|
7
|
+
"files": {
|
8
|
+
"spec/fixtures/php/error.php": {
|
9
|
+
"errors": 1,
|
10
|
+
"warnings": 0,
|
11
|
+
"messages": [
|
12
|
+
{
|
13
|
+
"message": "PHP keywords must be lowercase; expected \"or\" but found \"OR\"",
|
14
|
+
"source": "Generic.PHP.LowerCaseKeyword.Found",
|
15
|
+
"severity": 5,
|
16
|
+
"fixable": true,
|
17
|
+
"type": "ERROR",
|
18
|
+
"line": 2,
|
19
|
+
"column": 21
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
{
|
2
|
+
"totals": {
|
3
|
+
"errors": 3,
|
4
|
+
"warnings": 1,
|
5
|
+
"fixable": 4
|
6
|
+
},
|
7
|
+
"files": {
|
8
|
+
"application/config/autoload.php": {
|
9
|
+
"errors": 1,
|
10
|
+
"warnings": 1,
|
11
|
+
"messages": [
|
12
|
+
{
|
13
|
+
"message": "PHP keywords must be lowercase; expected \"or\" but found \"OR\"",
|
14
|
+
"source": "Generic.PHP.LowerCaseKeyword.Found",
|
15
|
+
"severity": 5,
|
16
|
+
"fixable": true,
|
17
|
+
"type": "ERROR",
|
18
|
+
"line": 2,
|
19
|
+
"column": 21
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"message": "Fake warning message",
|
23
|
+
"source": "Fake warning source",
|
24
|
+
"severity": 4,
|
25
|
+
"fixable": true,
|
26
|
+
"type": "WARN",
|
27
|
+
"line": 3,
|
28
|
+
"column": 10
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"application/config/hooks.php": {
|
33
|
+
"errors": 2,
|
34
|
+
"warnings": 0,
|
35
|
+
"messages": [
|
36
|
+
{
|
37
|
+
"message": "PHP keywords must be lowercase; expected \"or\" but found \"OR\"",
|
38
|
+
"source": "Generic.PHP.LowerCaseKeyword.Found",
|
39
|
+
"severity": 5,
|
40
|
+
"fixable": true,
|
41
|
+
"type": "ERROR",
|
42
|
+
"line": 2,
|
43
|
+
"column": 21
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"message": "Spaces must be used to indent lines; tabs are not allowed",
|
47
|
+
"source": "Generic.WhiteSpace.DisallowTabIndent.TabsUsed",
|
48
|
+
"severity": 5,
|
49
|
+
"fixable": true,
|
50
|
+
"type": "ERROR",
|
51
|
+
"line": 11,
|
52
|
+
"column": 1
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"totals": {
|
3
|
+
"errors": 0,
|
4
|
+
"warnings": 1,
|
5
|
+
"fixable": 1
|
6
|
+
},
|
7
|
+
"files": {
|
8
|
+
"spec/fixtures/php/warning.php": {
|
9
|
+
"errors": 0,
|
10
|
+
"warnings": 1,
|
11
|
+
"messages": [
|
12
|
+
{
|
13
|
+
"message": "PHP keywords must be lowercase; expected \"or\" but found \"OR\"",
|
14
|
+
"source": "Generic.PHP.LowerCaseKeyword.Found",
|
15
|
+
"severity": 4,
|
16
|
+
"fixable": true,
|
17
|
+
"type": "WARN",
|
18
|
+
"line": 2,
|
19
|
+
"column": 10
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require File.expand_path("../spec_helper", __FILE__)
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Danger
|
5
|
+
describe Danger::DangerPhpCodesniffer do
|
6
|
+
it "should be a plugin" do
|
7
|
+
expect(Danger::DangerPhpCodesniffer.new(nil)).to be_a Danger::Plugin
|
8
|
+
end
|
9
|
+
|
10
|
+
#
|
11
|
+
# You should test your custom attributes and methods here
|
12
|
+
#
|
13
|
+
describe "with Dangerfile" do
|
14
|
+
before do
|
15
|
+
@dangerfile = testing_dangerfile
|
16
|
+
@php_codesniffer = @dangerfile.php_codesniffer
|
17
|
+
end
|
18
|
+
|
19
|
+
before do
|
20
|
+
gitlab = Danger::RequestSources::GitLab.new({}, testing_env)
|
21
|
+
allow(@dangerfile).to receive(:gitlab).and_return gitlab
|
22
|
+
allow(@dangerfile).to receive(:github)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises error if phpcs is not installed" do
|
26
|
+
allow(@php_codesniffer).to receive(:phpcs_path).and_return(nil)
|
27
|
+
expect { @php_codesniffer.exec }.to raise_error("phpcs is not installed")
|
28
|
+
end
|
29
|
+
|
30
|
+
describe :exec do
|
31
|
+
before do
|
32
|
+
@mix_result = JSON.parse File.read('spec/fixtures/result/multiple.json')
|
33
|
+
@error_result = JSON.parse File.read('spec/fixtures/result/error.json')
|
34
|
+
@warning_result = JSON.parse File.read('spec/fixtures/result/warning.json')
|
35
|
+
@empty_result = JSON.parse File.read('spec/fixtures/result/empty.json')
|
36
|
+
|
37
|
+
allow(@php_codesniffer).to receive(:run_phpcs)
|
38
|
+
.with("phpcs", "spec/fixtures/php/error.php")
|
39
|
+
.and_return @error_result
|
40
|
+
allow(@php_codesniffer).to receive(:run_phpcs)
|
41
|
+
.with("phpcs", "spec/fixtures/php/warning.php")
|
42
|
+
.and_return @warning_result
|
43
|
+
allow(@php_codesniffer).to receive(:run_phpcs)
|
44
|
+
.with("phpcs", "spec/fixtures/php/empty.php")
|
45
|
+
.and_return @empty_result
|
46
|
+
end
|
47
|
+
|
48
|
+
before do
|
49
|
+
allow(@php_codesniffer).to receive(:phpcs_path).and_return "phpcs"
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
it "checks all PHP files when filtering is not set" do
|
54
|
+
allow(@php_codesniffer).to receive(:run_phpcs).and_return @mix_result
|
55
|
+
@php_codesniffer.exec
|
56
|
+
output = @php_codesniffer.status_report[:markdowns]
|
57
|
+
|
58
|
+
expect(output.length).to eq(4)
|
59
|
+
expect(output[0].message).to eq("# PHP_CodeSniffer report")
|
60
|
+
expect(output[1].message).to eq("## There are 3 errors, 1 warnings and 4 fixable in the MR")
|
61
|
+
expect(output[2].message).to include("application/config/autoload.php")
|
62
|
+
expect(output[3].message).to include("application/config/hooks.php")
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "when filtering is true" do
|
66
|
+
before do
|
67
|
+
@php_codesniffer.filtering = true
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
it "checks PHP files with only modified_files" do
|
73
|
+
allow(@php_codesniffer.git).to receive(:modified_files)
|
74
|
+
.and_return(["spec/fixtures/php/error.php"])
|
75
|
+
allow(@php_codesniffer.git).to receive(:deleted_files)
|
76
|
+
.and_return([])
|
77
|
+
allow(@php_codesniffer.git).to receive(:added_files)
|
78
|
+
.and_return([])
|
79
|
+
allow(@php_codesniffer).to receive(:phpcs_path).and_return "phpcs"
|
80
|
+
|
81
|
+
@php_codesniffer.filtering = true
|
82
|
+
@php_codesniffer.exec
|
83
|
+
|
84
|
+
output = @php_codesniffer.status_report[:markdowns]
|
85
|
+
|
86
|
+
expect(output.length).to eq 3
|
87
|
+
expect(output[0].message).to eq("# PHP_CodeSniffer report")
|
88
|
+
expect(output[1].message).to eq("## There are 1 errors, 0 warnings and 1 fixable in the MR")
|
89
|
+
expect(output[2].message).to include("spec/fixtures/php/error.php")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "checks PHP files without deleted files and with modified and added files" do
|
93
|
+
allow(@php_codesniffer.git).to receive(:modified_files)
|
94
|
+
.and_return(["spec/fixtures/php/error.php"])
|
95
|
+
allow(@php_codesniffer.git).to receive(:deleted_files)
|
96
|
+
.and_return(["spec/fixtures/php/empty.php"])
|
97
|
+
allow(@php_codesniffer.git).to receive(:added_files)
|
98
|
+
.and_return(["spec/fixtures/php/warning.php"])
|
99
|
+
allow(@php_codesniffer).to receive(:phpcs_path).and_return "phpcs"
|
100
|
+
|
101
|
+
|
102
|
+
@php_codesniffer.filtering = true
|
103
|
+
@php_codesniffer.exec
|
104
|
+
|
105
|
+
output = @php_codesniffer.status_report[:markdowns]
|
106
|
+
|
107
|
+
expect(output.length).to eq 4
|
108
|
+
expect(output[0].message).to eq("# PHP_CodeSniffer report")
|
109
|
+
expect(output[1].message).to eq("## There are 1 errors, 1 warnings and 2 fixable in the MR")
|
110
|
+
expect(output[2].message).to include("spec/fixtures/php/error.php")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require "pathname"
|
2
|
+
ROOT = Pathname.new(File.expand_path("../../", __FILE__))
|
3
|
+
$:.unshift((ROOT + "lib").to_s)
|
4
|
+
$:.unshift((ROOT + "spec").to_s)
|
5
|
+
|
6
|
+
require "bundler/setup"
|
7
|
+
require "pry"
|
8
|
+
|
9
|
+
require "rspec"
|
10
|
+
require "danger"
|
11
|
+
|
12
|
+
if `git remote -v` == ''
|
13
|
+
puts "You cannot run tests without setting a local git remote on this repo"
|
14
|
+
puts "It's a weird side-effect of Danger's internals."
|
15
|
+
exit(0)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Use coloured output, it's the best.
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.filter_gems_from_backtrace "bundler"
|
21
|
+
config.color = true
|
22
|
+
config.tty = true
|
23
|
+
end
|
24
|
+
|
25
|
+
require "danger_plugin"
|
26
|
+
|
27
|
+
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
|
28
|
+
# If you are expanding these files, see if it's already been done ^.
|
29
|
+
|
30
|
+
# A silent version of the user interface,
|
31
|
+
# it comes with an extra function `.string` which will
|
32
|
+
# strip all ANSI colours from the string.
|
33
|
+
|
34
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
35
|
+
def testing_ui
|
36
|
+
@output = StringIO.new
|
37
|
+
def @output.winsize
|
38
|
+
[20, 9999]
|
39
|
+
end
|
40
|
+
|
41
|
+
cork = Cork::Board.new(out: @output)
|
42
|
+
def cork.string
|
43
|
+
out.string.gsub(/\e\[([;\d]+)?m/, "")
|
44
|
+
end
|
45
|
+
cork
|
46
|
+
end
|
47
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
48
|
+
|
49
|
+
# Example environment (ENV) that would come from
|
50
|
+
# running a PR on TravisCI
|
51
|
+
def testing_env
|
52
|
+
{
|
53
|
+
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
|
54
|
+
"TRAVIS_PULL_REQUEST" => "800",
|
55
|
+
"TRAVIS_REPO_SLUG" => "artsy/eigen",
|
56
|
+
"TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
|
57
|
+
"DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio",
|
58
|
+
"DANGER_GITLAB_API_TOKEN" => "123abcd54erfsd3422gdfio",
|
59
|
+
"DANGER_GITLAB_API_BASE_URL" => "https://mygitlab.com"
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# A stubbed out Dangerfile for use in tests
|
64
|
+
def testing_dangerfile
|
65
|
+
env = Danger::EnvironmentManager.new(testing_env)
|
66
|
+
Danger::Dangerfile.new(env, testing_ui)
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danger-php_codesniffer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ymhuang0808
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: danger-plugin-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.63'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.63'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.14'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.14'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.7'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: listen
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.0.7
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.0.7
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Danger plugin for PHP_CodeSniffer.
|
154
|
+
email:
|
155
|
+
- ymhuang@golface.com.tw
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rubocop.yml"
|
162
|
+
- ".travis.yml"
|
163
|
+
- Gemfile
|
164
|
+
- Gemfile.lock
|
165
|
+
- Guardfile
|
166
|
+
- LICENSE.txt
|
167
|
+
- README.md
|
168
|
+
- Rakefile
|
169
|
+
- danger-php_codesniffer.gemspec
|
170
|
+
- lib/danger_php_codesniffer.rb
|
171
|
+
- lib/danger_plugin.rb
|
172
|
+
- lib/php_codesniffer/gem_version.rb
|
173
|
+
- lib/php_codesniffer/plugin.rb
|
174
|
+
- spec/fixtures/php/empty.php
|
175
|
+
- spec/fixtures/php/error.php
|
176
|
+
- spec/fixtures/php/warning.php
|
177
|
+
- spec/fixtures/result/empty.json
|
178
|
+
- spec/fixtures/result/error.json
|
179
|
+
- spec/fixtures/result/multiple.json
|
180
|
+
- spec/fixtures/result/warning.json
|
181
|
+
- spec/php_codesniffer_spec.rb
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
homepage: https://github.com/Golface/danger-php_codesniffer
|
184
|
+
licenses:
|
185
|
+
- MIT
|
186
|
+
metadata: {}
|
187
|
+
post_install_message:
|
188
|
+
rdoc_options: []
|
189
|
+
require_paths:
|
190
|
+
- lib
|
191
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
requirements: []
|
202
|
+
rubygems_version: 3.0.2
|
203
|
+
signing_key:
|
204
|
+
specification_version: 4
|
205
|
+
summary: Help you use Danger to check code standard and create comments on PR/MR
|
206
|
+
test_files:
|
207
|
+
- spec/fixtures/php/empty.php
|
208
|
+
- spec/fixtures/php/error.php
|
209
|
+
- spec/fixtures/php/warning.php
|
210
|
+
- spec/fixtures/result/empty.json
|
211
|
+
- spec/fixtures/result/error.json
|
212
|
+
- spec/fixtures/result/multiple.json
|
213
|
+
- spec/fixtures/result/warning.json
|
214
|
+
- spec/php_codesniffer_spec.rb
|
215
|
+
- spec/spec_helper.rb
|