danger-rubocop 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -6
- data/README.md +8 -1
- data/lib/danger_plugin.rb +4 -3
- data/lib/version.rb +1 -1
- data/spec/danger_plugin_spec.rb +11 -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: 14d031b9e478c7bff00e541dd0637352a01888939c18ddf48a738525f0954b08
|
4
|
+
data.tar.gz: 4894183f30dbfc5a1b615d93e6361a7ed1f3b828a86a67e0f47abfd2e1dd8f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a34d01243770479c10ce9442655cd00b53ad8cceb3b832afd6ff081de84bb817a0996a083098909da41089de3b63af11eeaba51b6ab81ff075ed5a86fb7afd
|
7
|
+
data.tar.gz: c7e02e4b2389c7d35c33f93b9175a30d9a4ab05a7636e4bf80cd4851e164e039130af6abbd360778ff35ce638492a88cb5742c9ccb0b8cce47ec36e115f5a5e2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-rubocop (0.9.
|
4
|
+
danger-rubocop (0.9.5)
|
5
5
|
danger
|
6
6
|
rubocop (~> 1.0)
|
7
7
|
|
@@ -35,12 +35,16 @@ GEM
|
|
35
35
|
octokit (~> 4.7)
|
36
36
|
terminal-table (>= 1, < 4)
|
37
37
|
diff-lcs (1.4.4)
|
38
|
-
faraday (1.4.
|
38
|
+
faraday (1.4.2)
|
39
|
+
faraday-em_http (~> 1.0)
|
40
|
+
faraday-em_synchrony (~> 1.0)
|
39
41
|
faraday-excon (~> 1.1)
|
40
42
|
faraday-net_http (~> 1.0)
|
41
43
|
faraday-net_http_persistent (~> 1.1)
|
42
44
|
multipart-post (>= 1.2, < 3)
|
43
45
|
ruby2_keywords (>= 0.0.4)
|
46
|
+
faraday-em_http (1.0.0)
|
47
|
+
faraday-em_synchrony (1.0.0)
|
44
48
|
faraday-excon (1.1.0)
|
45
49
|
faraday-http-cache (2.2.0)
|
46
50
|
faraday (>= 0.8)
|
@@ -117,16 +121,16 @@ GEM
|
|
117
121
|
diff-lcs (>= 1.2.0, < 2.0)
|
118
122
|
rspec-support (~> 3.10.0)
|
119
123
|
rspec-support (3.10.2)
|
120
|
-
rubocop (1.
|
124
|
+
rubocop (1.16.0)
|
121
125
|
parallel (~> 1.10)
|
122
126
|
parser (>= 3.0.0.0)
|
123
127
|
rainbow (>= 2.2.2, < 4.0)
|
124
128
|
regexp_parser (>= 1.8, < 3.0)
|
125
129
|
rexml
|
126
|
-
rubocop-ast (>= 1.
|
130
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
127
131
|
ruby-progressbar (~> 1.7)
|
128
132
|
unicode-display_width (>= 1.4.0, < 3.0)
|
129
|
-
rubocop-ast (1.
|
133
|
+
rubocop-ast (1.7.0)
|
130
134
|
parser (>= 3.0.1.1)
|
131
135
|
ruby-progressbar (1.11.0)
|
132
136
|
ruby2_keywords (0.0.4)
|
@@ -134,7 +138,8 @@ GEM
|
|
134
138
|
addressable (>= 2.3.5)
|
135
139
|
faraday (> 0.8, < 2.0)
|
136
140
|
shellany (0.0.1)
|
137
|
-
terminal-table (
|
141
|
+
terminal-table (3.0.1)
|
142
|
+
unicode-display_width (>= 1.1.1, < 3)
|
138
143
|
thor (1.1.0)
|
139
144
|
unicode-display_width (2.0.0)
|
140
145
|
yard (0.9.26)
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Danger Rubocop
|
4
4
|
|
5
|
-
A [Danger](https://github.com/danger/danger) plugin for [Rubocop](https://github.com/bbatsov/rubocop).
|
5
|
+
A [Danger](https://github.com/danger/danger) plugin for [Rubocop](https://github.com/bbatsov/rubocop) (and compatible wrappers such as [Standard](https://github.com/testdouble/standard/)).
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -37,6 +37,12 @@ github.dismiss_out_of_range_messages
|
|
37
37
|
rubocop.lint inline_comment: true
|
38
38
|
```
|
39
39
|
|
40
|
+
> Format using `standardrb` instead of Rubocop
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
rubocop.lint rubocop_cmd: 'standardrb'
|
44
|
+
```
|
45
|
+
|
40
46
|
#### Methods
|
41
47
|
|
42
48
|
`lint(config: Hash)`
|
@@ -57,6 +63,7 @@ The following keys are supported:
|
|
57
63
|
* `only_report_new_offenses`: pass `true` to only report offenses that are in current user's scope.
|
58
64
|
Note that this won't mark offenses for _Metrics/XXXLength_ if you add lines to an already existing scope.
|
59
65
|
* `include_cop_names`: Prepends cop names to the output messages. Example: "Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end."
|
66
|
+
* `rubocop_cmd`: Allows you to change the rubocop executable that's invoked. This is used to support rubocop wrappers like [Standard](https://github.com/testdouble/standard/) by passing `standardrb` as the value.
|
60
67
|
|
61
68
|
|
62
69
|
Passing `files` as only argument is also supported for backward compatibility.
|
data/lib/danger_plugin.rb
CHANGED
@@ -36,9 +36,10 @@ module Danger
|
|
36
36
|
inline_comment = config[:inline_comment] || false
|
37
37
|
fail_on_inline_comment = config[:fail_on_inline_comment] || false
|
38
38
|
include_cop_names = config[:include_cop_names] || false
|
39
|
+
rubocop_cmd = config[:rubocop_cmd] || 'rubocop'
|
39
40
|
|
40
41
|
files_to_lint = fetch_files_to_lint(files)
|
41
|
-
files_to_report = rubocop(files_to_lint, force_exclusion, only_report_new_offenses, config_path: config_path)
|
42
|
+
files_to_report = rubocop(files_to_lint, force_exclusion, only_report_new_offenses, cmd: rubocop_cmd, config_path: config_path)
|
42
43
|
|
43
44
|
return if files_to_report.empty?
|
44
45
|
return report_failures files_to_report if report_danger
|
@@ -52,8 +53,8 @@ module Danger
|
|
52
53
|
|
53
54
|
private
|
54
55
|
|
55
|
-
def rubocop(files_to_lint, force_exclusion, only_report_new_offenses, config_path: nil)
|
56
|
-
base_command = [
|
56
|
+
def rubocop(files_to_lint, force_exclusion, only_report_new_offenses, cmd: 'rubocop', config_path: nil)
|
57
|
+
base_command = [cmd, '-f', 'json', '--only-recognized-file-types']
|
57
58
|
base_command.concat(['--force-exclusion']) if force_exclusion
|
58
59
|
base_command.concat(['--config', config_path.shellescape]) unless config_path.nil?
|
59
60
|
|
data/lib/version.rb
CHANGED
data/spec/danger_plugin_spec.rb
CHANGED
@@ -312,6 +312,17 @@ EOS
|
|
312
312
|
.to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13, type: error }")
|
313
313
|
end
|
314
314
|
end
|
315
|
+
|
316
|
+
context 'using standardrb cmd' do
|
317
|
+
it 'executes using the standardrb cmd' do
|
318
|
+
allow(@rubocop).to receive(:`)
|
319
|
+
.with('bundle exec standardrb -f json --only-recognized-file-types --config path/to/rubocop.yml spec/fixtures/ruby_file.rb')
|
320
|
+
.and_return(response_ruby_file)
|
321
|
+
|
322
|
+
# Do it
|
323
|
+
@rubocop.lint(files: 'spec/fixtures/ruby*.rb', rubocop_cmd: 'standardrb', config: 'path/to/rubocop.yml')
|
324
|
+
end
|
325
|
+
end
|
315
326
|
end
|
316
327
|
|
317
328
|
describe 'a filename with special characters' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ash Furrow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger
|