danger-xcode_summary 1.0.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03c3c535aacaf5147fbaa8a5bb2d77b54c89b56fd72de75071f16655903b5b95
4
- data.tar.gz: 4f1b7450d3f00cf969ddf63a74c4c4917b3dc7399c2bf27f5951bc6759485daf
3
+ metadata.gz: f7f4af287c0370b31f01a690b01e813461929e52ab57fce3285aa66bcaff49c4
4
+ data.tar.gz: ed22370ea6a8c18a4fe031ab7b8dac06654ddbc31a45862d7232520b4b98955e
5
5
  SHA512:
6
- metadata.gz: c4cdc7816df1c0d50682cd387bce49b47f8fd7a99aff6b0c56dfce0252e9421c4e02be8cfc6c637109abd52b767ca29842c761031e1961ff835dd8ef90d731e0
7
- data.tar.gz: 39d7f4bbee347d2f7f7e0f25dbff37dd43b486f1277cf22890d15c11531fed69794e8ce8049828d71924f8ee15f414ce3b15b5cd271a78fda6da4e9abc7ae5f1
6
+ metadata.gz: 6fb83b4b61b89603f5b4075c67039cabcf1221defda9106583ac9b569be141fcc7cbb33475f4369eaca4c77eabd86868a9ae99cd891ee2a820764de805fcf6b9
7
+ data.tar.gz: b8ce24b92d313924532bf56626f4493cd8a1e2a9fa57beaeea66ac50cc08b40a5e5ed09c2aa8721bcce6d18a71d33820e777584e98a368517ed4d888fdea821b
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: macos-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['3.2.2']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rake spec
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Gemfile.lock CHANGED
@@ -1,17 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-xcode_summary (1.0.1)
4
+ danger-xcode_summary (1.3.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.8.0)
12
- public_suffix (>= 2.0.2, < 5.0)
11
+ addressable (2.8.6)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
- claide (1.0.3)
14
+ base64 (0.2.0)
15
+ claide (1.1.0)
15
16
  claide-plugins (0.9.2)
16
17
  cork
17
18
  nap
@@ -20,48 +21,34 @@ GEM
20
21
  colored2 (3.1.2)
21
22
  cork (0.3.0)
22
23
  colored2 (~> 3.1)
23
- danger (8.4.0)
24
+ danger (9.4.3)
24
25
  claide (~> 1.0)
25
26
  claide-plugins (>= 0.9.2)
26
27
  colored2 (~> 3.1)
27
28
  cork (~> 0.1)
28
- faraday (>= 0.9.0, < 2.0)
29
+ faraday (>= 0.9.0, < 3.0)
29
30
  faraday-http-cache (~> 2.0)
30
- git (~> 1.7)
31
+ git (~> 1.13)
31
32
  kramdown (~> 2.3)
32
33
  kramdown-parser-gfm (~> 1.0)
33
34
  no_proxy_fix
34
- octokit (~> 4.7)
35
+ octokit (>= 4.0)
35
36
  terminal-table (>= 1, < 4)
36
37
  danger-plugin-api (1.0.0)
37
38
  danger (> 2.0)
38
- diff-lcs (1.4.4)
39
- faraday (1.8.0)
40
- faraday-em_http (~> 1.0)
41
- faraday-em_synchrony (~> 1.0)
42
- faraday-excon (~> 1.1)
43
- faraday-httpclient (~> 1.0.1)
44
- faraday-net_http (~> 1.0)
45
- faraday-net_http_persistent (~> 1.1)
46
- faraday-patron (~> 1.0)
47
- faraday-rack (~> 1.0)
48
- multipart-post (>= 1.2, < 3)
49
- ruby2_keywords (>= 0.0.4)
50
- faraday-em_http (1.0.0)
51
- faraday-em_synchrony (1.0.0)
52
- faraday-excon (1.1.0)
53
- faraday-http-cache (2.2.0)
39
+ diff-lcs (1.5.1)
40
+ faraday (2.9.0)
41
+ faraday-net_http (>= 2.0, < 3.2)
42
+ faraday-http-cache (2.5.1)
54
43
  faraday (>= 0.8)
55
- faraday-httpclient (1.0.1)
56
- faraday-net_http (1.0.1)
57
- faraday-net_http_persistent (1.2.0)
58
- faraday-patron (1.0.0)
59
- faraday-rack (1.0.0)
60
- ffi (1.15.4)
61
- formatador (0.3.0)
62
- git (1.9.1)
44
+ faraday-net_http (3.1.0)
45
+ net-http
46
+ ffi (1.16.3)
47
+ formatador (1.1.0)
48
+ git (1.19.1)
49
+ addressable (~> 2.8)
63
50
  rchardet (~> 1.8)
64
- guard (2.18.0)
51
+ guard (2.18.1)
65
52
  formatador (>= 0.2.4)
66
53
  listen (>= 2.7, < 4.0)
67
54
  lumberjack (>= 1.0.12, < 2.0)
@@ -75,77 +62,85 @@ GEM
75
62
  guard (~> 2.1)
76
63
  guard-compat (~> 1.1)
77
64
  rspec (>= 2.99.0, < 4.0)
78
- kramdown (2.3.1)
65
+ json (2.7.1)
66
+ kramdown (2.4.0)
79
67
  rexml
80
68
  kramdown-parser-gfm (1.1.0)
81
69
  kramdown (~> 2.0)
82
- listen (3.7.0)
70
+ language_server-protocol (3.17.0.3)
71
+ listen (3.8.0)
83
72
  rb-fsevent (~> 0.10, >= 0.10.3)
84
73
  rb-inotify (~> 0.9, >= 0.9.10)
85
- lumberjack (1.2.8)
74
+ lumberjack (1.2.10)
86
75
  method_source (1.0.0)
87
- multipart-post (2.1.1)
88
76
  nap (1.1.0)
89
77
  nenv (0.3.0)
78
+ net-http (0.4.1)
79
+ uri
90
80
  no_proxy_fix (0.1.2)
91
81
  notiffany (0.1.3)
92
82
  nenv (~> 0.1)
93
83
  shellany (~> 0.0)
94
- octokit (4.21.0)
95
- faraday (>= 0.9)
96
- sawyer (~> 0.8.0, >= 0.5.3)
84
+ octokit (8.1.0)
85
+ base64
86
+ faraday (>= 1, < 3)
87
+ sawyer (~> 0.9)
97
88
  open4 (1.3.4)
98
- parallel (1.21.0)
99
- parser (3.0.2.0)
89
+ parallel (1.24.0)
90
+ parser (3.3.0.5)
100
91
  ast (~> 2.4.1)
101
- pry (0.14.1)
92
+ racc
93
+ pry (0.14.2)
102
94
  coderay (~> 1.1)
103
95
  method_source (~> 1.0)
104
- public_suffix (4.0.6)
105
- rainbow (3.0.0)
106
- rake (13.0.6)
107
- rb-fsevent (0.11.0)
96
+ public_suffix (5.0.4)
97
+ racc (1.7.3)
98
+ rainbow (3.1.1)
99
+ rake (13.1.0)
100
+ rb-fsevent (0.11.2)
108
101
  rb-inotify (0.10.1)
109
102
  ffi (~> 1.0)
110
103
  rchardet (1.8.0)
111
- regexp_parser (2.1.1)
112
- rexml (3.2.5)
113
- rspec (3.10.0)
114
- rspec-core (~> 3.10.0)
115
- rspec-expectations (~> 3.10.0)
116
- rspec-mocks (~> 3.10.0)
117
- rspec-core (3.10.1)
118
- rspec-support (~> 3.10.0)
119
- rspec-expectations (3.10.1)
104
+ regexp_parser (2.9.0)
105
+ rexml (3.2.6)
106
+ rspec (3.13.0)
107
+ rspec-core (~> 3.13.0)
108
+ rspec-expectations (~> 3.13.0)
109
+ rspec-mocks (~> 3.13.0)
110
+ rspec-core (3.13.0)
111
+ rspec-support (~> 3.13.0)
112
+ rspec-expectations (3.13.0)
120
113
  diff-lcs (>= 1.2.0, < 2.0)
121
- rspec-support (~> 3.10.0)
122
- rspec-mocks (3.10.2)
114
+ rspec-support (~> 3.13.0)
115
+ rspec-mocks (3.13.0)
123
116
  diff-lcs (>= 1.2.0, < 2.0)
124
- rspec-support (~> 3.10.0)
125
- rspec-support (3.10.2)
126
- rubocop (1.22.1)
117
+ rspec-support (~> 3.13.0)
118
+ rspec-support (3.13.0)
119
+ rubocop (1.60.2)
120
+ json (~> 2.3)
121
+ language_server-protocol (>= 3.17.0)
127
122
  parallel (~> 1.10)
128
- parser (>= 3.0.0.0)
123
+ parser (>= 3.3.0.2)
129
124
  rainbow (>= 2.2.2, < 4.0)
130
125
  regexp_parser (>= 1.8, < 3.0)
131
- rexml
132
- rubocop-ast (>= 1.12.0, < 2.0)
126
+ rexml (>= 3.2.5, < 4.0)
127
+ rubocop-ast (>= 1.30.0, < 2.0)
133
128
  ruby-progressbar (~> 1.7)
134
- unicode-display_width (>= 1.4.0, < 3.0)
135
- rubocop-ast (1.12.0)
136
- parser (>= 3.0.1.1)
137
- ruby-progressbar (1.11.0)
138
- ruby2_keywords (0.0.5)
139
- sawyer (0.8.2)
129
+ unicode-display_width (>= 2.4.0, < 3.0)
130
+ rubocop-ast (1.30.0)
131
+ parser (>= 3.2.1.0)
132
+ ruby-progressbar (1.13.0)
133
+ sawyer (0.9.2)
140
134
  addressable (>= 2.3.5)
141
- faraday (> 0.8, < 2.0)
135
+ faraday (>= 0.17.3, < 3)
142
136
  shellany (0.0.1)
143
137
  terminal-table (3.0.2)
144
138
  unicode-display_width (>= 1.1.1, < 3)
145
- thor (1.1.0)
146
- unicode-display_width (2.1.0)
139
+ thor (1.3.0)
140
+ unicode-display_width (2.5.0)
141
+ uri (0.13.0)
147
142
  xcresult (0.2.1)
148
- yard (0.9.26)
143
+ yard (0.9.34)
149
144
 
150
145
  PLATFORMS
151
146
  ruby
@@ -164,4 +159,4 @@ DEPENDENCIES
164
159
  yard
165
160
 
166
161
  BUNDLED WITH
167
- 2.2.26
162
+ 2.3.0
data/README.md CHANGED
@@ -56,6 +56,24 @@ A [Danger](http://danger.systems) plugin that shows all build errors, warnings a
56
56
  </tbody>
57
57
  </table>
58
58
 
59
+ <table>
60
+ <thead>
61
+ <tr>
62
+ <th width="50"></th>
63
+ <th width="100%">
64
+ 1 Message
65
+ </th>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ <tr>
70
+ <td><g-emoji alias="book" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f4d6.png">📖</g-emoji></td>
71
+ <td>TestTarget: Executed 5 tests, with 1 failure (0 unexpected) in 0.032 (0.065) seconds</td>
72
+ </tr>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
+
59
77
  ## Installation
60
78
 
61
79
  Add this line to your Gemfile:
@@ -106,6 +124,13 @@ xcode_summary.inline_mode = true
106
124
  xcode_summary.report 'MyApp.xcresult'
107
125
  ```
108
126
 
127
+ You can use `strict` to reporting errors as warnings thereby don't block merge PR.
128
+
129
+ ```ruby
130
+ # If value is `false`, then errors will be reporting as warnings
131
+ xcode_summary.strict = false
132
+ ```
133
+
109
134
  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
135
 
111
136
  ```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.3.0'
5
5
  end
@@ -21,6 +21,7 @@ module Danger
21
21
  class DangerXcodeSummary < Plugin
22
22
  Location = Struct.new(:file_name, :file_path, :line)
23
23
  Result = Struct.new(:message, :location)
24
+ Warning = Struct.new(:message, :sticky, :location)
24
25
 
25
26
  # The project root, which will be used to make the paths relative.
26
27
  # Defaults to `pwd`.
@@ -39,10 +40,30 @@ module Danger
39
40
  # A block that filters specific results.
40
41
  # An example would be `lambda { |result| result.message.start_with?('ld') }` to ignore results for ld_warnings.
41
42
  #
42
- # @param [Block value
43
+ # @param [Block] value
43
44
  # @return [Block]
44
45
  attr_accessor :ignored_results
45
46
 
47
+ # Defines if the test summary will be sticky or not.
48
+ # Defaults to `false`.
49
+ # @param [Boolean] value
50
+ # @return [Boolean]
51
+ attr_accessor :sticky_summary
52
+
53
+ # Defines if the build summary is shown or not.
54
+ # Defaults to `true`.
55
+ # @param [Boolean] value
56
+ # @return [Boolean]
57
+ attr_accessor :test_summary
58
+
59
+ # A block that sorts the warning results.
60
+ # An example would be `lambda { |warning| warning.message.include?("deprecated") ? 1 : 0 }` to sort results for
61
+ # deprecated warnings.
62
+ #
63
+ # @param [Block] value
64
+ # @return [Block]
65
+ attr_accessor :sort_warnings_by
66
+
46
67
  # Defines if using inline comment or not.
47
68
  # Defaults to `false`.
48
69
  # @param [Boolean] value
@@ -55,6 +76,12 @@ module Danger
55
76
  # @return [Boolean]
56
77
  attr_accessor :ignores_warnings
57
78
 
79
+ # Defines errors strict. If value is `false`, then errors will be reporting as warnings.
80
+ # Defaults to `true`
81
+ # @param [Boolean] value
82
+ # @return [Boolean]
83
+ attr_accessor :strict
84
+
58
85
  # rubocop:disable Lint/DuplicateMethods
59
86
  def project_root
60
87
  root = @project_root || Dir.pwd
@@ -66,10 +93,22 @@ module Danger
66
93
  [@ignored_files].flatten.compact
67
94
  end
68
95
 
96
+ def sort_warnings_by(&block)
97
+ @sort_warnings_by ||= block
98
+ end
99
+
69
100
  def ignored_results(&block)
70
101
  @ignored_results ||= block
71
102
  end
72
103
 
104
+ def sticky_summary
105
+ @sticky_summary || false
106
+ end
107
+
108
+ def test_summary
109
+ @test_summary.nil? ? true : @test_summary
110
+ end
111
+
73
112
  def inline_mode
74
113
  @inline_mode || false
75
114
  end
@@ -78,8 +117,14 @@ module Danger
78
117
  @ignores_warnings || false
79
118
  end
80
119
 
120
+ def strict
121
+ @strict.nil? ? true : @strict
122
+ end
123
+
81
124
  # Pick a Dangerfile plugin for a chosen request_source and cache it
82
125
  # based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
126
+ #
127
+ # @return [void]
83
128
  def plugin
84
129
  plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
85
130
  @plugin ||= plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
@@ -122,23 +167,72 @@ module Danger
122
167
  private
123
168
 
124
169
  def format_summary(xcode_summary)
170
+ messages(xcode_summary).each { |s| message(s, sticky: sticky_summary) }
171
+ all_warnings = []
125
172
  xcode_summary.actions_invocation_record.actions.each do |action|
126
173
  warnings(action).each do |result|
174
+ warning_object = nil
127
175
  if inline_mode && result.location
128
- warn(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
176
+ warning_object = Warning.new(result.message, false, result.location)
129
177
  else
130
- warn(result.message, sticky: false)
178
+ warning_object = Warning.new(result.message, false, nil)
131
179
  end
180
+ all_warnings << warning_object
132
181
  end
133
- # rubocop:disable Lint/UnreachableLoop
134
182
  errors(action).each do |result|
135
183
  if inline_mode && result.location
136
- fail(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
184
+ if strict
185
+ fail(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
186
+ else
187
+ warn(result.message, sticky: false, file: result.location.file_path, line: result.location.line)
188
+ end
137
189
  else
138
- fail(result.message, sticky: false)
190
+ if strict
191
+ fail(result.message, sticky: false)
192
+ else
193
+ warn(result.message, sticky: false)
194
+ end
139
195
  end
140
196
  end
141
- # rubocop:enable Lint/UnreachableLoop
197
+ end
198
+ sort_and_log_warnings(all_warnings)
199
+ end
200
+
201
+ def sort_and_log_warnings(all_warnings)
202
+ all_warnings = all_warnings.sort_by(&sort_warnings_by)
203
+ all_warnings.each do |warning|
204
+ if inline_mode && warning.location
205
+ warn(warning.message, sticky: warning.sticky, file: warning.location.file_path, line: warning.location.line)
206
+ else
207
+ warn(warning.message, sticky: warning.sticky)
208
+ end
209
+ end
210
+ end
211
+
212
+ def messages(xcode_summary)
213
+ if test_summary
214
+ test_messages = xcode_summary.action_test_plan_summaries.map do |test_plan_summaries|
215
+ test_plan_summaries.summaries.map do |summary|
216
+ summary.testable_summaries.map do |test_summary|
217
+ test_summary.tests.filter_map do |action_test_object|
218
+ if action_test_object.instance_of? XCResult::ActionTestSummaryGroup
219
+ subtests = action_test_object.all_subtests
220
+ subtests_duration = subtests.map(&:duration).sum
221
+ test_text_infix = subtests.count == 1 ? 'test' : 'tests'
222
+ failed_tests_count = subtests.reject { |test| test.test_status == 'Success' }.count
223
+ expected_failed_tests_count = subtests.select { |test| test.test_status == 'Expected Failure' }.count
224
+
225
+ "#{test_summary.target_name}: Executed #{subtests.count} #{test_text_infix}, " \
226
+ "with #{failed_tests_count} failures (#{expected_failed_tests_count} expected) in " \
227
+ "#{subtests_duration.round(3)} (#{action_test_object.duration.round(3)}) seconds"
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
233
+ test_messages.flatten.uniq.compact.map(&:strip)
234
+ else
235
+ []
142
236
  end
143
237
  end
144
238
 
@@ -179,13 +273,15 @@ module Danger
179
273
  end
180
274
 
181
275
  def parse_location(document_location)
182
- return nil if document_location.nil?
276
+ return nil if document_location&.url.nil?
183
277
 
184
278
  file_path = document_location.url.gsub('file://', '').split('#').first
185
279
  file_name = file_path.split('/').last
186
280
  fragment = document_location.url.split('#').last
187
281
  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
282
+ line_number = params['StartingLineNumber']
283
+ # StartingLineNumber is 0-based, but we need a 1-based value
284
+ line = line_number.nil? || line_number.empty? ? 0 : line_number.to_i + 1
189
285
  Location.new(file_name, relative_path(file_path), line)
190
286
  end
191
287
 
@@ -225,6 +321,8 @@ module Danger
225
321
  end
226
322
 
227
323
  def format_test_failure(result, producing_target, test_case_name)
324
+ return escape_reason(result.message) if result.location.nil?
325
+
228
326
  path = result.location.file_path
229
327
  path_link = format_path(path, result.location.line)
230
328
  suite_name = "#{producing_target}.#{test_case_name}"
@@ -23,6 +23,26 @@ module Danger
23
23
  expect(@dangerfile.status_report[:errors]).to eq ['summary file not found']
24
24
  end
25
25
 
26
+ describe 'summary' do
27
+ context 'enabled' do
28
+ it 'formats summary messages' do
29
+ @xcode_summary.test_summary = true
30
+ @xcode_summary.report('spec/fixtures/swiftlint.xcresult')
31
+ expect(@dangerfile.status_report[:messages]).to eq [
32
+ 'SwiftLintFrameworkTests: Executed 540 tests, with 1 failures (0 expected) in 114.029 (27.922) seconds'
33
+ ]
34
+ end
35
+ end
36
+
37
+ context 'disabled' do
38
+ it 'shows no summary messages' do
39
+ @xcode_summary.test_summary = false
40
+ @xcode_summary.report('spec/fixtures/swiftlint.xcresult')
41
+ expect(@dangerfile.status_report[:messages]).to eq []
42
+ end
43
+ end
44
+ end
45
+
26
46
  context 'reporting' do
27
47
  it 'formats compile warnings' do
28
48
  @xcode_summary.report('spec/fixtures/swiftlint.xcresult')
@@ -172,6 +192,71 @@ module Danger
172
192
  expect(result).to eq '{"warnings":19,"errors":1}'
173
193
  end
174
194
  end
195
+
196
+ context 'without strict' do
197
+ before do
198
+ @xcode_summary.strict = false
199
+ end
200
+
201
+ it 'shows errors as warnings' do
202
+ @xcode_summary.report('spec/fixtures/build_error.xcresult')
203
+ expect(@dangerfile.status_report[:warnings].count).to_not eq 0
204
+ expect(@dangerfile.status_report[:errors]).to eq []
205
+ end
206
+
207
+ it 'report warning and error counts' do
208
+ result = @xcode_summary.warning_error_count('spec/fixtures/build_error.xcresult')
209
+ expect(result).to eq '{"warnings":21,"errors":3}'
210
+ end
211
+ end
212
+
213
+ context 'with sort_warnings_by' do
214
+ before do
215
+ @xcode_summary.sort_warnings_by do |warning|
216
+ warning.message.include?('TODOs') ? 0 : 1
217
+ end
218
+ end
219
+ it 'sorts compile warnings' do
220
+ @xcode_summary.report('spec/fixtures/swiftlint.xcresult')
221
+ expect(@dangerfile.status_report[:warnings]).to eq [
222
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L492'>Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L492</a>**: Todo Violation: TODOs should be resolved (Should raise error if subnode ...). (todo)",
223
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Tests/YamsTests/SpecTests.swift#L379'>Carthage/Checkouts/Yams/Tests/YamsTests/SpecTests.swift#L379</a>**: Todo Violation: TODOs should be resolved (YAML supports keys other than ...). (todo)",
224
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Tests/YamsTests/SpecTests.swift#L714'>Carthage/Checkouts/Yams/Tests/YamsTests/SpecTests.swift#L714</a>**: Todo Violation: TODOs should be resolved (local tag parsing). (todo)",
225
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Representer.swift#L187'>Carthage/Checkouts/Yams/Sources/Yams/Representer.swift#L187</a>**: Todo Violation: TODOs should be resolved (Support `Float80`). (todo)",
226
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L405'>Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L405</a>**: Todo Violation: TODOs should be resolved (YAML supports keys other than ...). (todo)",
227
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L430'>Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L430</a>**: Todo Violation: TODOs should be resolved (Should raise error on other th...). (todo)",
228
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L450'>Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L450</a>**: Todo Violation: TODOs should be resolved (YAML supports Hashable element...). (todo)",
229
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L478'>Carthage/Checkouts/Yams/Sources/Yams/Constructor.swift#L478</a>**: Todo Violation: TODOs should be resolved (Should raise error if subnode ...). (todo)",
230
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Emitter.swift#L340'>Carthage/Checkouts/Yams/Sources/Yams/Emitter.swift#L340</a>**: Todo Violation: TODOs should be resolved (Support tags). (todo)",
231
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/SWXMLHash/Source/XMLIndexer+XMLIndexerDeserializable.swift#L538'>Carthage/Checkouts/SWXMLHash/Source/XMLIndexer+XMLIndexerDeserializable.swift#L538</a>**: 'public' modifier is redundant for instance method declared in a public extension",
232
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/SWXMLHash/Source/XMLIndexer+XMLIndexerDeserializable.swift#L552'>Carthage/Checkouts/SWXMLHash/Source/XMLIndexer+XMLIndexerDeserializable.swift#L552</a>**: 'public' modifier is redundant for instance method declared in a public extension",
233
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Tag.swift#L88'>Carthage/Checkouts/Yams/Sources/Yams/Tag.swift#L88</a>**: Legacy Hashing Violation: Prefer using the `hash(into:)` function instead of overriding `hashValue` (legacy_hashing)",
234
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Result/Result/NoError.swift#L8'>Carthage/Checkouts/Result/Result/NoError.swift#L8</a>**: Will never be executed",
235
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Tag.swift#L109'>Carthage/Checkouts/Yams/Sources/Yams/Tag.swift#L109</a>**: Legacy Hashing Violation: Prefer using the `hash(into:)` function instead of overriding `hashValue` (legacy_hashing)",
236
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Decoder.swift#L102'>Carthage/Checkouts/Yams/Sources/Yams/Decoder.swift#L102</a>**: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)",
237
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Node.swift#L191'>Carthage/Checkouts/Yams/Sources/Yams/Node.swift#L191</a>**: Legacy Hashing Violation: Prefer using the `hash(into:)` function instead of overriding `hashValue` (legacy_hashing)",
238
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Encoder.swift#L139'>Carthage/Checkouts/Yams/Sources/Yams/Encoder.swift#L139</a>**: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)",
239
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Sources/Yams/Parser.swift#L441'>Carthage/Checkouts/Yams/Sources/Yams/Parser.swift#L441</a>**: File Line Length Violation: File should contain 400 lines or less: currently contains 441 (file_length)",
240
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Tests/YamsTests/EncoderTests.swift#L924'>Carthage/Checkouts/Yams/Tests/YamsTests/EncoderTests.swift#L924</a>**: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)",
241
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Tests/YamsTests/EncoderTests.swift#L937'>Carthage/Checkouts/Yams/Tests/YamsTests/EncoderTests.swift#L937</a>**: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)",
242
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Carthage/Checkouts/Yams/Tests/YamsTests/EncoderTests.swift#L253'>Carthage/Checkouts/Yams/Tests/YamsTests/EncoderTests.swift#L253</a>**: Superfluous Disable Command Violation: 'unused_private_declaration' is not a valid SwiftLint rule. Please remove it from the disable command. (superfluous_disable_command)"
243
+ ]
244
+ end
245
+
246
+ it 'formats errors' do
247
+ @xcode_summary.report('spec/fixtures/build_error.xcresult')
248
+ expect(@dangerfile.status_report[:errors]).to eq [
249
+ 'Testing cancelled because the build failed.',
250
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Source/SwiftLintFramework/Extensions/QueuedPrint.swift#L13'>Source/SwiftLintFramework/Extensions/QueuedPrint.swift#L13</a>**: Use of unresolved identifier 'queue'",
251
+ "**<a href='https://github.com/realm/SwiftLint/blob/f211694e7def13785ff62047386437534541d7b3/Source/SwiftLintFramework/Extensions/QueuedPrint.swift#L17'>Source/SwiftLintFramework/Extensions/QueuedPrint.swift#L17</a>**: Use of unresolved identifier 'queue'"
252
+ ]
253
+ end
254
+
255
+ it 'report warning and error counts' do
256
+ result = @xcode_summary.warning_error_count('spec/fixtures/build_error.xcresult')
257
+ expect(result).to eq '{"warnings":21,"errors":3}'
258
+ end
259
+ end
175
260
  end
176
261
  end
177
262
 
metadata CHANGED
@@ -1,15 +1,15 @@
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.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diogo Tridapalli
8
8
  - Marcelo Fabri
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-11 00:00:00.000000000 Z
12
+ date: 2024-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcresult
@@ -146,9 +146,10 @@ extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
148
  - ".gitattributes"
149
+ - ".github/workflows/ruby.yml"
149
150
  - ".gitignore"
150
151
  - ".rubocop.yml"
151
- - ".travis.yml"
152
+ - ".ruby-version"
152
153
  - Gemfile
153
154
  - Gemfile.lock
154
155
  - Guardfile
@@ -296,7 +297,7 @@ homepage: https://github.com/diogot/danger-xcode_summary
296
297
  licenses:
297
298
  - MIT
298
299
  metadata: {}
299
- post_install_message:
300
+ post_install_message:
300
301
  rdoc_options: []
301
302
  require_paths:
302
303
  - lib
@@ -311,8 +312,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
312
  - !ruby/object:Gem::Version
312
313
  version: '0'
313
314
  requirements: []
314
- rubygems_version: 3.0.3
315
- signing_key:
315
+ rubygems_version: 3.4.10
316
+ signing_key:
316
317
  specification_version: 4
317
318
  summary: A [Danger](http://danger.systems) plugin that shows all build errors, warnings
318
319
  and unit tests results generated from `xcodebuild`.
data/.travis.yml DELETED
@@ -1,19 +0,0 @@
1
- language: ruby
2
- cache:
3
- directories:
4
- - bundle
5
-
6
- os: osx
7
- osx_image: xcode11
8
-
9
- rvm:
10
- - 2.6.0
11
- - 2.5.3
12
-
13
- # install bundler 2.x
14
- before_install:
15
- - gem update --system
16
- - gem install bundler
17
-
18
- script:
19
- - bundle exec rake spec