danger-xcode_summary 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03c3c535aacaf5147fbaa8a5bb2d77b54c89b56fd72de75071f16655903b5b95
4
- data.tar.gz: 4f1b7450d3f00cf969ddf63a74c4c4917b3dc7399c2bf27f5951bc6759485daf
3
+ metadata.gz: 5f2fbf0b2b5b627c8f595437c80bfe676cf2f7717a140b24b4b46fa64d0b07cf
4
+ data.tar.gz: b5dd0539de517d98eb0ac316c78db524c44c880d3d32fc495fed69295a298e09
5
5
  SHA512:
6
- metadata.gz: c4cdc7816df1c0d50682cd387bce49b47f8fd7a99aff6b0c56dfce0252e9421c4e02be8cfc6c637109abd52b767ca29842c761031e1961ff835dd8ef90d731e0
7
- data.tar.gz: 39d7f4bbee347d2f7f7e0f25dbff37dd43b486f1277cf22890d15c11531fed69794e8ce8049828d71924f8ee15f414ce3b15b5cd271a78fda6da4e9abc7ae5f1
6
+ metadata.gz: 2c5d50b34767978e6ce5b544e9e45bd66234d27351ad96128939d1372830fb8ec61eb0c820e3f4e47bae40849552105bd0849430dd8ec6cc89883de63fac680d
7
+ data.tar.gz: 50b34884ff63462cb83aaad5b9dc39dbc87ea33b55b6c91031cd72a34774383edce0f8e58258f7eb6b6afa13d0fb78b9f7234b5da36e918a78ecfd71063f0e36
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-xcode_summary (1.0.1)
4
+ danger-xcode_summary (1.1.0)
5
5
  danger-plugin-api (~> 1.0)
6
6
  xcresult (~> 0.2)
7
7
 
@@ -11,7 +11,7 @@ GEM
11
11
  addressable (2.8.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.2)
14
- claide (1.0.3)
14
+ claide (1.1.0)
15
15
  claide-plugins (0.9.2)
16
16
  cork
17
17
  nap
@@ -20,7 +20,7 @@ GEM
20
20
  colored2 (3.1.2)
21
21
  cork (0.3.0)
22
22
  colored2 (~> 3.1)
23
- danger (8.4.0)
23
+ danger (8.4.2)
24
24
  claide (~> 1.0)
25
25
  claide-plugins (>= 0.9.2)
26
26
  colored2 (~> 3.1)
@@ -35,17 +35,18 @@ GEM
35
35
  terminal-table (>= 1, < 4)
36
36
  danger-plugin-api (1.0.0)
37
37
  danger (> 2.0)
38
- diff-lcs (1.4.4)
39
- faraday (1.8.0)
38
+ diff-lcs (1.5.0)
39
+ faraday (1.9.3)
40
40
  faraday-em_http (~> 1.0)
41
41
  faraday-em_synchrony (~> 1.0)
42
42
  faraday-excon (~> 1.1)
43
- faraday-httpclient (~> 1.0.1)
43
+ faraday-httpclient (~> 1.0)
44
+ faraday-multipart (~> 1.0)
44
45
  faraday-net_http (~> 1.0)
45
- faraday-net_http_persistent (~> 1.1)
46
+ faraday-net_http_persistent (~> 1.0)
46
47
  faraday-patron (~> 1.0)
47
48
  faraday-rack (~> 1.0)
48
- multipart-post (>= 1.2, < 3)
49
+ faraday-retry (~> 1.0)
49
50
  ruby2_keywords (>= 0.0.4)
50
51
  faraday-em_http (1.0.0)
51
52
  faraday-em_synchrony (1.0.0)
@@ -53,13 +54,16 @@ GEM
53
54
  faraday-http-cache (2.2.0)
54
55
  faraday (>= 0.8)
55
56
  faraday-httpclient (1.0.1)
57
+ faraday-multipart (1.0.3)
58
+ multipart-post (>= 1.2, < 3)
56
59
  faraday-net_http (1.0.1)
57
60
  faraday-net_http_persistent (1.2.0)
58
61
  faraday-patron (1.0.0)
59
62
  faraday-rack (1.0.0)
60
- ffi (1.15.4)
61
- formatador (0.3.0)
62
- git (1.9.1)
63
+ faraday-retry (1.0.3)
64
+ ffi (1.15.5)
65
+ formatador (1.1.0)
66
+ git (1.10.2)
63
67
  rchardet (~> 1.8)
64
68
  guard (2.18.0)
65
69
  formatador (>= 0.2.4)
@@ -79,7 +83,7 @@ GEM
79
83
  rexml
80
84
  kramdown-parser-gfm (1.1.0)
81
85
  kramdown (~> 2.0)
82
- listen (3.7.0)
86
+ listen (3.7.1)
83
87
  rb-fsevent (~> 0.10, >= 0.10.3)
84
88
  rb-inotify (~> 0.9, >= 0.9.10)
85
89
  lumberjack (1.2.8)
@@ -91,48 +95,48 @@ GEM
91
95
  notiffany (0.1.3)
92
96
  nenv (~> 0.1)
93
97
  shellany (~> 0.0)
94
- octokit (4.21.0)
98
+ octokit (4.22.0)
95
99
  faraday (>= 0.9)
96
100
  sawyer (~> 0.8.0, >= 0.5.3)
97
101
  open4 (1.3.4)
98
102
  parallel (1.21.0)
99
- parser (3.0.2.0)
103
+ parser (3.1.0.0)
100
104
  ast (~> 2.4.1)
101
105
  pry (0.14.1)
102
106
  coderay (~> 1.1)
103
107
  method_source (~> 1.0)
104
108
  public_suffix (4.0.6)
105
- rainbow (3.0.0)
109
+ rainbow (3.1.1)
106
110
  rake (13.0.6)
107
- rb-fsevent (0.11.0)
111
+ rb-fsevent (0.11.1)
108
112
  rb-inotify (0.10.1)
109
113
  ffi (~> 1.0)
110
114
  rchardet (1.8.0)
111
- regexp_parser (2.1.1)
115
+ regexp_parser (2.2.0)
112
116
  rexml (3.2.5)
113
117
  rspec (3.10.0)
114
118
  rspec-core (~> 3.10.0)
115
119
  rspec-expectations (~> 3.10.0)
116
120
  rspec-mocks (~> 3.10.0)
117
- rspec-core (3.10.1)
121
+ rspec-core (3.10.2)
118
122
  rspec-support (~> 3.10.0)
119
- rspec-expectations (3.10.1)
123
+ rspec-expectations (3.10.2)
120
124
  diff-lcs (>= 1.2.0, < 2.0)
121
125
  rspec-support (~> 3.10.0)
122
- rspec-mocks (3.10.2)
126
+ rspec-mocks (3.10.3)
123
127
  diff-lcs (>= 1.2.0, < 2.0)
124
128
  rspec-support (~> 3.10.0)
125
- rspec-support (3.10.2)
126
- rubocop (1.22.1)
129
+ rspec-support (3.10.3)
130
+ rubocop (1.25.1)
127
131
  parallel (~> 1.10)
128
- parser (>= 3.0.0.0)
132
+ parser (>= 3.1.0.0)
129
133
  rainbow (>= 2.2.2, < 4.0)
130
134
  regexp_parser (>= 1.8, < 3.0)
131
135
  rexml
132
- rubocop-ast (>= 1.12.0, < 2.0)
136
+ rubocop-ast (>= 1.15.1, < 2.0)
133
137
  ruby-progressbar (~> 1.7)
134
138
  unicode-display_width (>= 1.4.0, < 3.0)
135
- rubocop-ast (1.12.0)
139
+ rubocop-ast (1.15.1)
136
140
  parser (>= 3.0.1.1)
137
141
  ruby-progressbar (1.11.0)
138
142
  ruby2_keywords (0.0.5)
@@ -142,10 +146,12 @@ GEM
142
146
  shellany (0.0.1)
143
147
  terminal-table (3.0.2)
144
148
  unicode-display_width (>= 1.1.1, < 3)
145
- thor (1.1.0)
149
+ thor (1.2.1)
146
150
  unicode-display_width (2.1.0)
151
+ webrick (1.7.0)
147
152
  xcresult (0.2.1)
148
- yard (0.9.26)
153
+ yard (0.9.27)
154
+ webrick (~> 1.7.0)
149
155
 
150
156
  PLATFORMS
151
157
  ruby
@@ -164,4 +170,4 @@ DEPENDENCIES
164
170
  yard
165
171
 
166
172
  BUNDLED WITH
167
- 2.2.26
173
+ 2.3.0
data/README.md CHANGED
@@ -106,6 +106,13 @@ xcode_summary.inline_mode = true
106
106
  xcode_summary.report 'MyApp.xcresult'
107
107
  ```
108
108
 
109
+ You can use `strict` to reporting errors as warnings thereby don't block merge PR.
110
+
111
+ ```ruby
112
+ # If value is `false`, then errors will be reporting as warnings
113
+ xcode_summary.strict = false
114
+ ```
115
+
109
116
  You can get warning and error number by calling `warning_error_count`. The return will be a JSON string contains warning and error count, e.g `{"warnings":1,"errors":3}`:
110
117
 
111
118
  ```ruby
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module XcodeSummary
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -55,6 +55,12 @@ module Danger
55
55
  # @return [Boolean]
56
56
  attr_accessor :ignores_warnings
57
57
 
58
+ # Defines errors strict. If value is `false`, then errors will be reporting as warnings.
59
+ # Defaults to `true`
60
+ # @param [Boolean] value
61
+ # @return [Boolean]
62
+ attr_accessor :strict
63
+
58
64
  # rubocop:disable Lint/DuplicateMethods
59
65
  def project_root
60
66
  root = @project_root || Dir.pwd
@@ -78,8 +84,14 @@ module Danger
78
84
  @ignores_warnings || false
79
85
  end
80
86
 
87
+ def strict
88
+ @strict.nil? ? true : @strict
89
+ end
90
+
81
91
  # Pick a Dangerfile plugin for a chosen request_source and cache it
82
92
  # based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
93
+ #
94
+ # @return [void]
83
95
  def plugin
84
96
  plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
85
97
  @plugin ||= plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
@@ -130,15 +142,21 @@ module Danger
130
142
  warn(result.message, sticky: false)
131
143
  end
132
144
  end
133
- # rubocop:disable Lint/UnreachableLoop
134
145
  errors(action).each do |result|
135
146
  if inline_mode && result.location
136
- fail(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
147
+ if strict
148
+ fail(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
149
+ else
150
+ warn(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
151
+ end
137
152
  else
138
- fail(result.message, sticky: false)
153
+ if strict
154
+ fail(result.message, sticky: false)
155
+ else
156
+ warn(result.message, sticky: false)
157
+ end
139
158
  end
140
159
  end
141
- # rubocop:enable Lint/UnreachableLoop
142
160
  end
143
161
  end
144
162
 
@@ -185,7 +203,8 @@ module Danger
185
203
  file_name = file_path.split('/').last
186
204
  fragment = document_location.url.split('#').last
187
205
  params = CGI.parse(fragment).transform_values(&:first)
188
- line = params['StartingLineNumber'].to_i + 1 # StartingLineNumber is 0-based, but we need a 1-based value
206
+ line_number = params['StartingLineNumber']
207
+ line = line_number.empty? ? -0 : line_number.to_i + 1 # StartingLineNumber is 0-based, but we need a 1-based value
189
208
  Location.new(file_name, relative_path(file_path), line)
190
209
  end
191
210
 
@@ -18,6 +18,13 @@ module Danger
18
18
  @xcode_summary.project_root = '/Users/marcelofabri/SwiftLint/'
19
19
  end
20
20
 
21
+ it 'test' do
22
+ params = { 'one' => '10' }
23
+ line_number = params['StartingLineNumber']
24
+ line = line_number.empty? ? -0 : line_number.to_i + 1 # StartingLineNumber is 0-based, but we need a 1-based value
25
+ expect(line).to eq -0
26
+ end
27
+
21
28
  it 'fail if file does not exist' do
22
29
  @xcode_summary.report('spec/fixtures/inexistent_file.xcresult')
23
30
  expect(@dangerfile.status_report[:errors]).to eq ['summary file not found']
@@ -172,6 +179,23 @@ module Danger
172
179
  expect(result).to eq '{"warnings":19,"errors":1}'
173
180
  end
174
181
  end
182
+
183
+ context 'without strict' do
184
+ before do
185
+ @xcode_summary.strict = false
186
+ end
187
+
188
+ it 'shows errors as warnings' do
189
+ @xcode_summary.report('spec/fixtures/build_error.xcresult')
190
+ expect(@dangerfile.status_report[:warnings].count).to_not eq 0
191
+ expect(@dangerfile.status_report[:errors]).to eq []
192
+ end
193
+
194
+ it 'report warning and error counts' do
195
+ result = @xcode_summary.warning_error_count('spec/fixtures/build_error.xcresult')
196
+ expect(result).to eq '{"warnings":21,"errors":3}'
197
+ end
198
+ end
175
199
  end
176
200
  end
177
201
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-xcode_summary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diogo Tridapalli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-11 00:00:00.000000000 Z
12
+ date: 2022-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcresult
@@ -311,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
311
  - !ruby/object:Gem::Version
312
312
  version: '0'
313
313
  requirements: []
314
- rubygems_version: 3.0.3
314
+ rubygems_version: 3.1.4
315
315
  signing_key:
316
316
  specification_version: 4
317
317
  summary: A [Danger](http://danger.systems) plugin that shows all build errors, warnings