danger-xcode_summary 1.0.0 → 1.2.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: e30986734f1f4563b6c7f58e5765cb2b00be9bf4cc86ae03c88485d429009e3e
4
- data.tar.gz: 570891d22c3fbb5a9b2cdbb61dab1833ac8570013e0c2689886b78702cbff368
3
+ metadata.gz: dc604898bf47a3eb60ecd5c408807611ea65c56571990cb0e1a6987bf850902f
4
+ data.tar.gz: 849961ea33f86df1aa5e664cd7b4a155830eb6c2b889c13289cc1bd64cdd3db2
5
5
  SHA512:
6
- metadata.gz: dac17c30dbeaf27f6b026c82f213a8d6ede70623c05bd811ab352957dde61b9a7c402ebca595146b161b8a82c3405e7cc93002c950363aa4262bee9d17267f76
7
- data.tar.gz: 32db5f742803b7cc51d46be5825a644be65d40c89b790db6cfad3e15312b099f58912b7febb542767ee0dd8ef63fd703a059ae20c2b80ee1765bdea8dbdbf05b
6
+ metadata.gz: 179dd4adf7cd7dcac32e3a25d9ebd0234271eaa02d15649cab79847d2d8d2e965fa1edccf27d0e3c71e74c2e4c8c24e44c110d53b513498efc5d8a2e46ee3d5e
7
+ data.tar.gz: bf254c7e2a8d7e5b8b9465052aaffa2814f077d0f965923e79816d5f81e63e678f9f2984d446be9fa49e3a7bfa539ccd70acaaee2ad84b46add1cd2d2c58e304
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-xcode_summary (1.0.0)
4
+ danger-xcode_summary (1.2.0)
5
5
  danger-plugin-api (~> 1.0)
6
6
  xcresult (~> 0.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.7.0)
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.2.3)
23
+ danger (8.6.1)
24
24
  claide (~> 1.0)
25
25
  claide-plugins (>= 0.9.2)
26
26
  colored2 (~> 3.1)
@@ -35,33 +35,43 @@ 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.4.2)
38
+ diff-lcs (1.5.0)
39
+ faraday (1.10.0)
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)
44
+ faraday-multipart (~> 1.0)
43
45
  faraday-net_http (~> 1.0)
44
- faraday-net_http_persistent (~> 1.1)
45
- multipart-post (>= 1.2, < 3)
46
+ faraday-net_http_persistent (~> 1.0)
47
+ faraday-patron (~> 1.0)
48
+ faraday-rack (~> 1.0)
49
+ faraday-retry (~> 1.0)
46
50
  ruby2_keywords (>= 0.0.4)
47
51
  faraday-em_http (1.0.0)
48
52
  faraday-em_synchrony (1.0.0)
49
53
  faraday-excon (1.1.0)
50
54
  faraday-http-cache (2.2.0)
51
55
  faraday (>= 0.8)
56
+ faraday-httpclient (1.0.1)
57
+ faraday-multipart (1.0.3)
58
+ multipart-post (>= 1.2, < 3)
52
59
  faraday-net_http (1.0.1)
53
- faraday-net_http_persistent (1.1.0)
54
- ffi (1.15.1)
55
- formatador (0.2.5)
56
- git (1.8.1)
60
+ faraday-net_http_persistent (1.2.0)
61
+ faraday-patron (1.0.0)
62
+ faraday-rack (1.0.0)
63
+ faraday-retry (1.0.3)
64
+ ffi (1.15.5)
65
+ formatador (1.1.0)
66
+ git (1.11.0)
57
67
  rchardet (~> 1.8)
58
- guard (2.17.0)
68
+ guard (2.18.0)
59
69
  formatador (>= 0.2.4)
60
70
  listen (>= 2.7, < 4.0)
61
71
  lumberjack (>= 1.0.12, < 2.0)
62
72
  nenv (~> 0.1)
63
73
  notiffany (~> 0.0)
64
- pry (>= 0.9.12)
74
+ pry (>= 0.13.0)
65
75
  shellany (~> 0.0)
66
76
  thor (>= 0.18.1)
67
77
  guard-compat (1.2.1)
@@ -69,13 +79,13 @@ GEM
69
79
  guard (~> 2.1)
70
80
  guard-compat (~> 1.1)
71
81
  rspec (>= 2.99.0, < 4.0)
72
- kramdown (2.3.1)
82
+ kramdown (2.4.0)
73
83
  rexml
74
84
  kramdown-parser-gfm (1.1.0)
75
85
  kramdown (~> 2.0)
76
- listen (3.0.7)
77
- rb-fsevent (>= 0.9.3)
78
- rb-inotify (>= 0.9.7)
86
+ listen (3.7.1)
87
+ rb-fsevent (~> 0.10, >= 0.10.3)
88
+ rb-inotify (~> 0.9, >= 0.9.10)
79
89
  lumberjack (1.2.8)
80
90
  method_source (1.0.0)
81
91
  multipart-post (2.1.1)
@@ -85,61 +95,63 @@ GEM
85
95
  notiffany (0.1.3)
86
96
  nenv (~> 0.1)
87
97
  shellany (~> 0.0)
88
- octokit (4.21.0)
98
+ octokit (4.22.0)
89
99
  faraday (>= 0.9)
90
100
  sawyer (~> 0.8.0, >= 0.5.3)
91
101
  open4 (1.3.4)
92
- parallel (1.20.1)
93
- parser (3.0.1.1)
102
+ parallel (1.22.1)
103
+ parser (3.1.2.0)
94
104
  ast (~> 2.4.1)
95
105
  pry (0.14.1)
96
106
  coderay (~> 1.1)
97
107
  method_source (~> 1.0)
98
- public_suffix (4.0.6)
99
- rainbow (3.0.0)
100
- rake (13.0.3)
101
- rb-fsevent (0.11.0)
108
+ public_suffix (4.0.7)
109
+ rainbow (3.1.1)
110
+ rake (13.0.6)
111
+ rb-fsevent (0.11.1)
102
112
  rb-inotify (0.10.1)
103
113
  ffi (~> 1.0)
104
114
  rchardet (1.8.0)
105
- regexp_parser (2.1.1)
115
+ regexp_parser (2.3.1)
106
116
  rexml (3.2.5)
107
- rspec (3.10.0)
108
- rspec-core (~> 3.10.0)
109
- rspec-expectations (~> 3.10.0)
110
- rspec-mocks (~> 3.10.0)
111
- rspec-core (3.10.1)
112
- rspec-support (~> 3.10.0)
113
- rspec-expectations (3.10.1)
117
+ rspec (3.11.0)
118
+ rspec-core (~> 3.11.0)
119
+ rspec-expectations (~> 3.11.0)
120
+ rspec-mocks (~> 3.11.0)
121
+ rspec-core (3.11.0)
122
+ rspec-support (~> 3.11.0)
123
+ rspec-expectations (3.11.0)
114
124
  diff-lcs (>= 1.2.0, < 2.0)
115
- rspec-support (~> 3.10.0)
116
- rspec-mocks (3.10.2)
125
+ rspec-support (~> 3.11.0)
126
+ rspec-mocks (3.11.1)
117
127
  diff-lcs (>= 1.2.0, < 2.0)
118
- rspec-support (~> 3.10.0)
119
- rspec-support (3.10.2)
120
- rubocop (1.15.0)
128
+ rspec-support (~> 3.11.0)
129
+ rspec-support (3.11.0)
130
+ rubocop (1.28.2)
121
131
  parallel (~> 1.10)
122
- parser (>= 3.0.0.0)
132
+ parser (>= 3.1.0.0)
123
133
  rainbow (>= 2.2.2, < 4.0)
124
134
  regexp_parser (>= 1.8, < 3.0)
125
135
  rexml
126
- rubocop-ast (>= 1.5.0, < 2.0)
136
+ rubocop-ast (>= 1.17.0, < 2.0)
127
137
  ruby-progressbar (~> 1.7)
128
138
  unicode-display_width (>= 1.4.0, < 3.0)
129
- rubocop-ast (1.5.0)
130
- parser (>= 3.0.1.1)
139
+ rubocop-ast (1.17.0)
140
+ parser (>= 3.1.1.0)
131
141
  ruby-progressbar (1.11.0)
132
- ruby2_keywords (0.0.4)
142
+ ruby2_keywords (0.0.5)
133
143
  sawyer (0.8.2)
134
144
  addressable (>= 2.3.5)
135
145
  faraday (> 0.8, < 2.0)
136
146
  shellany (0.0.1)
137
- terminal-table (3.0.1)
147
+ terminal-table (3.0.2)
138
148
  unicode-display_width (>= 1.1.1, < 3)
139
- thor (1.1.0)
140
- unicode-display_width (2.0.0)
149
+ thor (1.2.1)
150
+ unicode-display_width (2.1.0)
151
+ webrick (1.7.0)
141
152
  xcresult (0.2.1)
142
- yard (0.9.26)
153
+ yard (0.9.27)
154
+ webrick (~> 1.7.0)
143
155
 
144
156
  PLATFORMS
145
157
  ruby
@@ -150,7 +162,7 @@ DEPENDENCIES
150
162
  danger-xcode_summary!
151
163
  guard (~> 2.14)
152
164
  guard-rspec (~> 4.7)
153
- listen (= 3.0.7)
165
+ listen (~> 3.0)
154
166
  pry
155
167
  rake (~> 13.0)
156
168
  rspec (~> 3.4)
@@ -158,4 +170,4 @@ DEPENDENCIES
158
170
  yard
159
171
 
160
172
  BUNDLED WITH
161
- 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
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'guard-rspec', '~> 4.7'
39
39
 
40
40
  # If you want to work on older builds of ruby
41
- spec.add_development_dependency 'listen', '3.0.7'
41
+ spec.add_development_dependency 'listen', '~> 3.0'
42
42
 
43
43
  # This gives you the chance to run a REPL inside your test
44
44
  # via
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module XcodeSummary
4
- VERSION = '1.0.0'
4
+ VERSION = '1.2.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,9 @@ 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
+ # StartingLineNumber is 0-based, but we need a 1-based value
208
+ line = line_number.nil? || line_number.empty? ? 0 : line_number.to_i + 1
189
209
  Location.new(file_name, relative_path(file_path), line)
190
210
  end
191
211
 
@@ -14,7 +14,7 @@ module Danger
14
14
  before do
15
15
  @dangerfile = testing_dangerfile
16
16
  @xcode_summary = @dangerfile.xcode_summary
17
- @xcode_summary.env.request_source.pr_json = JSON.parse(IO.read('spec/fixtures/pr_json.json'))
17
+ @xcode_summary.env.request_source.pr_json = JSON.parse(File.read('spec/fixtures/pr_json.json'))
18
18
  @xcode_summary.project_root = '/Users/marcelofabri/SwiftLint/'
19
19
  end
20
20
 
@@ -172,6 +172,23 @@ module Danger
172
172
  expect(result).to eq '{"warnings":19,"errors":1}'
173
173
  end
174
174
  end
175
+
176
+ context 'without strict' do
177
+ before do
178
+ @xcode_summary.strict = false
179
+ end
180
+
181
+ it 'shows errors as warnings' do
182
+ @xcode_summary.report('spec/fixtures/build_error.xcresult')
183
+ expect(@dangerfile.status_report[:warnings].count).to_not eq 0
184
+ expect(@dangerfile.status_report[:errors]).to eq []
185
+ end
186
+
187
+ it 'report warning and error counts' do
188
+ result = @xcode_summary.warning_error_count('spec/fixtures/build_error.xcresult')
189
+ expect(result).to eq '{"warnings":21,"errors":3}'
190
+ end
191
+ end
175
192
  end
176
193
  end
177
194
 
@@ -180,7 +197,7 @@ module Danger
180
197
  before do
181
198
  @dangerfile = testing_bitbucket_dangerfile
182
199
  @xcode_summary = @dangerfile.xcode_summary
183
- @xcode_summary.env.request_source.pr_json = JSON.parse(IO.read('spec/fixtures/bitbucket_pr.json'), symbolize_names: true)
200
+ @xcode_summary.env.request_source.pr_json = JSON.parse(File.read('spec/fixtures/bitbucket_pr.json'), symbolize_names: true)
184
201
  @xcode_summary.project_root = '/Users/diogo/src/danger-xcode_summary'
185
202
  end
186
203
 
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.0
4
+ version: 1.2.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-08-30 00:00:00.000000000 Z
12
+ date: 2022-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcresult
@@ -113,16 +113,16 @@ dependencies:
113
113
  name: listen
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '='
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 3.0.7
118
+ version: '3.0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '='
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 3.0.7
125
+ version: '3.0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: pry
128
128
  requirement: !ruby/object:Gem::Requirement