danger-php_codesniffer 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +18 -4
- data/lib/php_codesniffer/gem_version.rb +1 -1
- data/lib/php_codesniffer/plugin.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94e2d149df27164dbc3c2ca8e784da9e86c694258d602ce5a8cfaa31e1fa3990
|
4
|
+
data.tar.gz: 3f0247e8338e89f5124259b8c4eacda562cfbe7df036c220fc485993b5dcf8a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9270f35b3ae56dd65c532ea7db39167c629e212428c24ea218606d8b42dbd928cb945b4eb03bfb057f30bacdce12a95ec0350fd2ea57bde564690b0e2781d152
|
7
|
+
data.tar.gz: 862ce6904a412a0d8327385cb07cc48865e9105315712bb94d28023f0a2f0f38a7b57f2007612de013ee5c0c872d3456a62be359dfd7c51bd410b86d9ba9e0c4
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-php_codesniffer (0.1.
|
4
|
+
danger-php_codesniffer (0.1.6)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -115,7 +115,7 @@ GEM
|
|
115
115
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
116
116
|
thor (0.20.3)
|
117
117
|
unicode-display_width (1.4.1)
|
118
|
-
yard (0.9.
|
118
|
+
yard (0.9.20)
|
119
119
|
|
120
120
|
PLATFORMS
|
121
121
|
ruby
|
data/README.md
CHANGED
@@ -14,27 +14,41 @@ $ gem install danger-php_codesniffer
|
|
14
14
|
|
15
15
|
Detect your PHP violations of a defined coding standard. The plugin will post a comment on PR/MR on your Github or Gitlab project.
|
16
16
|
|
17
|
-
Dangerfile:
|
17
|
+
Add this to your Dangerfile to run CodeSniffer:
|
18
18
|
|
19
19
|
```
|
20
20
|
php_codesniffer.exec
|
21
21
|
```
|
22
22
|
|
23
|
-
|
23
|
+
---
|
24
|
+
|
25
|
+
You can modify how the plugin behaves by adding one or more of the following options before the `php_codesniffer.exec` call:
|
26
|
+
|
27
|
+
Ignore file/path:
|
24
28
|
|
25
29
|
```
|
26
30
|
php_codesniffer.ignore = "./vendor"
|
31
|
+
```
|
32
|
+
|
33
|
+
Use specific coding standard:
|
34
|
+
|
35
|
+
```
|
27
36
|
php_codesniffer.standard = "CodeIgniter"
|
28
|
-
php_codesniffer.exec
|
29
37
|
```
|
30
38
|
|
31
39
|
Only check new and modified file:
|
32
40
|
|
33
41
|
```
|
34
42
|
php_codesniffer.filtering = true
|
35
|
-
php_codesniffer.exec
|
36
43
|
```
|
37
44
|
|
45
|
+
Fail the pipeline if CodeSniffer reports any errors (you also have to run Danger with the `--fail-on-errors` flag set to true):
|
46
|
+
|
47
|
+
```
|
48
|
+
php_codesniffer.fail_on_error = true
|
49
|
+
```
|
50
|
+
|
51
|
+
|
38
52
|
## Development
|
39
53
|
|
40
54
|
1. Clone this repo
|
@@ -30,6 +30,12 @@ module Danger
|
|
30
30
|
# @return [Boolean]
|
31
31
|
attr_accessor :filtering
|
32
32
|
|
33
|
+
# An attribute for failing on errors
|
34
|
+
# In case phpcs finds errors, Danger will also fail
|
35
|
+
# This allows failing pipelines using the `--fail-on-errors` flag in Danger
|
36
|
+
# @return [Boolean]
|
37
|
+
attr_accessor :fail_on_error
|
38
|
+
|
33
39
|
# Execute and process phpcs CLL's result.
|
34
40
|
#
|
35
41
|
# @return [void]
|
@@ -63,6 +69,9 @@ module Danger
|
|
63
69
|
markdown "# PHP_CodeSniffer report"
|
64
70
|
markdown generate_summary_markdown summary
|
65
71
|
markdown report
|
72
|
+
if fail_on_error && summary["errors"] > 0
|
73
|
+
fail "There are #{summary["errors"]} errors that need to be resolved."
|
74
|
+
end
|
66
75
|
end
|
67
76
|
|
68
77
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-php_codesniffer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ymhuang0808
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|