danger-xcode_summary 0.2.1 → 0.5.2

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
- SHA1:
3
- metadata.gz: 9083b1f9a94a9e18886d600ccc26e1431a1b40e6
4
- data.tar.gz: af442fcaaddcd6913e0c6b1087cadab547e07e70
2
+ SHA256:
3
+ metadata.gz: 53f29c0e11a10b8eccb342cc72a8d578f04a8e30290fb6805b4bd0848462bb31
4
+ data.tar.gz: f711a75b72b460f4bb4f8a5b6ca43f1d0fb4d1218e1f5f6019cf7923b70c847e
5
5
  SHA512:
6
- metadata.gz: 96d3e7856eee79099c5fa5e201f980444fd1e1debf6baaac0589887bf5185633728fe0b383a87213268ad7ddae4116dfae634527c6dbeb350ef6281449c3a1ea
7
- data.tar.gz: c4247af5ab105a800bc2d7ccd29917f978f49e03fc8aa48bd5804f294e5285ed63f9ae01534011bcc8c3198a376f314510395668d0e9b82c75c65a05b6ea566d
6
+ metadata.gz: b83113e47379c130f54d41f431d05f7374814cda752b5235e57dc409dfedea217f5079d81cf4c2cbd2e40aa438da1c5193f83fc24a1c45e0a2232f37a73b1f0c
7
+ data.tar.gz: cb9ff766abbbfcfe7c5bbed3c2a5861e9f42bfdf75c95f7f926b39512671005fe03e444532f9e29d385245fb76d4c06c9b5ab0a08d605887511c87d3f617f227
@@ -2,17 +2,13 @@
2
2
  Style/ClassCheck:
3
3
  EnforcedStyle: kind_of?
4
4
 
5
- # It's better to be more explicit about the type
6
- Style/BracesAroundHashParameters:
7
- Enabled: false
8
-
9
5
  # specs sometimes have useless assignments, which is fine
10
6
  Lint/UselessAssignment:
11
7
  Exclude:
12
8
  - '**/spec/**/*'
13
9
 
14
10
  # HoundCI doesn't like this rule
15
- Style/DotPosition:
11
+ Layout/DotPosition:
16
12
  Enabled: false
17
13
 
18
14
  # Cop supports --auto-correct.
@@ -54,8 +50,8 @@ Metrics/CyclomaticComplexity:
54
50
  Max: 17
55
51
 
56
52
  # Configuration parameters: AllowURI, URISchemes.
57
- Metrics/LineLength:
58
- Max: 120
53
+ Layout/LineLength:
54
+ Max: 130
59
55
 
60
56
  # Configuration parameters: CountKeywordArgs.
61
57
  Metrics/ParameterLists:
@@ -4,9 +4,9 @@ cache:
4
4
  - bundle
5
5
 
6
6
  rvm:
7
- - 2.0
8
- - 2.1.3
9
- - 2.3.1
7
+ - 2.6.0
8
+ - 2.5.3
9
+ - 2.4.5
10
10
 
11
11
  script:
12
- - bundle exec rake spec
12
+ - bundle exec rake spec
@@ -1,49 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-xcode_summary (0.2.1)
4
+ danger-xcode_summary (0.5.2)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.5.1)
11
- public_suffix (~> 2.0, >= 2.0.2)
12
- ast (2.3.0)
13
- claide (1.0.1)
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.1)
13
+ claide (1.0.3)
14
14
  claide-plugins (0.9.2)
15
15
  cork
16
16
  nap
17
17
  open4 (~> 1.3)
18
- coderay (1.1.1)
18
+ coderay (1.1.3)
19
19
  colored2 (3.1.2)
20
20
  cork (0.3.0)
21
21
  colored2 (~> 3.1)
22
- danger (4.3.3)
22
+ danger (8.0.2)
23
23
  claide (~> 1.0)
24
24
  claide-plugins (>= 0.9.2)
25
25
  colored2 (~> 3.1)
26
26
  cork (~> 0.1)
27
- faraday (~> 0.9)
28
- faraday-http-cache (~> 1.0)
29
- git (~> 1)
30
- kramdown (~> 1.5)
31
- octokit (~> 4.2)
27
+ faraday (>= 0.9.0, < 2.0)
28
+ faraday-http-cache (~> 2.0)
29
+ git (~> 1.7)
30
+ kramdown (~> 2.0)
31
+ kramdown-parser-gfm (~> 1.0)
32
+ no_proxy_fix
33
+ octokit (~> 4.7)
32
34
  terminal-table (~> 1)
33
35
  danger-plugin-api (1.0.0)
34
36
  danger (> 2.0)
35
- diff-lcs (1.3)
36
- faraday (0.12.0.1)
37
+ diff-lcs (1.4.4)
38
+ faraday (1.0.1)
37
39
  multipart-post (>= 1.2, < 3)
38
- faraday-http-cache (1.3.1)
39
- faraday (~> 0.8)
40
- ffi (1.9.18)
40
+ faraday-http-cache (2.2.0)
41
+ faraday (>= 0.8)
42
+ ffi (1.13.1)
41
43
  formatador (0.2.5)
42
- git (1.3.0)
43
- guard (2.14.1)
44
+ git (1.7.0)
45
+ rchardet (~> 1.8)
46
+ guard (2.16.2)
44
47
  formatador (>= 0.2.4)
45
48
  listen (>= 2.7, < 4.0)
46
- lumberjack (~> 1.0)
49
+ lumberjack (>= 1.0.12, < 2.0)
47
50
  nenv (~> 0.1)
48
51
  notiffany (~> 0.0)
49
52
  pry (>= 0.9.12)
@@ -54,64 +57,75 @@ GEM
54
57
  guard (~> 2.1)
55
58
  guard-compat (~> 1.1)
56
59
  rspec (>= 2.99.0, < 4.0)
57
- kramdown (1.13.2)
60
+ kramdown (2.3.0)
61
+ rexml
62
+ kramdown-parser-gfm (1.1.0)
63
+ kramdown (~> 2.0)
58
64
  listen (3.0.7)
59
65
  rb-fsevent (>= 0.9.3)
60
66
  rb-inotify (>= 0.9.7)
61
- lumberjack (1.0.11)
62
- method_source (0.8.2)
63
- multipart-post (2.0.0)
67
+ lumberjack (1.2.6)
68
+ method_source (1.0.0)
69
+ multipart-post (2.1.1)
64
70
  nap (1.1.0)
65
71
  nenv (0.3.0)
66
- notiffany (0.1.1)
72
+ no_proxy_fix (0.1.2)
73
+ notiffany (0.1.3)
67
74
  nenv (~> 0.1)
68
75
  shellany (~> 0.0)
69
- octokit (4.7.0)
76
+ octokit (4.18.0)
77
+ faraday (>= 0.9)
70
78
  sawyer (~> 0.8.0, >= 0.5.3)
71
79
  open4 (1.3.4)
72
- parser (2.4.0.0)
73
- ast (~> 2.2)
74
- powerpack (0.1.1)
75
- pry (0.10.4)
76
- coderay (~> 1.1.0)
77
- method_source (~> 0.8.1)
78
- slop (~> 3.4)
79
- public_suffix (2.0.5)
80
- rainbow (2.2.1)
81
- rake (10.5.0)
82
- rb-fsevent (0.9.8)
83
- rb-inotify (0.9.8)
84
- ffi (>= 0.5.0)
85
- rspec (3.5.0)
86
- rspec-core (~> 3.5.0)
87
- rspec-expectations (~> 3.5.0)
88
- rspec-mocks (~> 3.5.0)
89
- rspec-core (3.5.4)
90
- rspec-support (~> 3.5.0)
91
- rspec-expectations (3.5.0)
80
+ parallel (1.19.2)
81
+ parser (2.7.1.4)
82
+ ast (~> 2.4.1)
83
+ pry (0.13.1)
84
+ coderay (~> 1.1)
85
+ method_source (~> 1.0)
86
+ public_suffix (4.0.5)
87
+ rainbow (3.0.0)
88
+ rake (13.0.1)
89
+ rb-fsevent (0.10.4)
90
+ rb-inotify (0.10.1)
91
+ ffi (~> 1.0)
92
+ rchardet (1.8.0)
93
+ regexp_parser (1.7.1)
94
+ rexml (3.2.4)
95
+ rspec (3.9.0)
96
+ rspec-core (~> 3.9.0)
97
+ rspec-expectations (~> 3.9.0)
98
+ rspec-mocks (~> 3.9.0)
99
+ rspec-core (3.9.2)
100
+ rspec-support (~> 3.9.3)
101
+ rspec-expectations (3.9.2)
92
102
  diff-lcs (>= 1.2.0, < 2.0)
93
- rspec-support (~> 3.5.0)
94
- rspec-mocks (3.5.0)
103
+ rspec-support (~> 3.9.0)
104
+ rspec-mocks (3.9.1)
95
105
  diff-lcs (>= 1.2.0, < 2.0)
96
- rspec-support (~> 3.5.0)
97
- rspec-support (3.5.0)
98
- rubocop (0.48.1)
99
- parser (>= 2.3.3.1, < 3.0)
100
- powerpack (~> 0.1)
101
- rainbow (>= 1.99.1, < 3.0)
106
+ rspec-support (~> 3.9.0)
107
+ rspec-support (3.9.3)
108
+ rubocop (0.86.0)
109
+ parallel (~> 1.10)
110
+ parser (>= 2.7.0.1)
111
+ rainbow (>= 2.2.2, < 4.0)
112
+ regexp_parser (>= 1.7)
113
+ rexml
114
+ rubocop-ast (>= 0.0.3, < 1.0)
102
115
  ruby-progressbar (~> 1.7)
103
- unicode-display_width (~> 1.0, >= 1.0.1)
104
- ruby-progressbar (1.8.1)
105
- sawyer (0.8.1)
106
- addressable (>= 2.3.5, < 2.6)
107
- faraday (~> 0.8, < 1.0)
116
+ unicode-display_width (>= 1.4.0, < 2.0)
117
+ rubocop-ast (0.1.0)
118
+ parser (>= 2.7.0.1)
119
+ ruby-progressbar (1.10.1)
120
+ sawyer (0.8.2)
121
+ addressable (>= 2.3.5)
122
+ faraday (> 0.8, < 2.0)
108
123
  shellany (0.0.1)
109
- slop (3.6.0)
110
- terminal-table (1.7.3)
111
- unicode-display_width (~> 1.1.1)
112
- thor (0.19.4)
113
- unicode-display_width (1.1.3)
114
- yard (0.9.8)
124
+ terminal-table (1.8.0)
125
+ unicode-display_width (~> 1.1, >= 1.1.1)
126
+ thor (1.0.1)
127
+ unicode-display_width (1.7.0)
128
+ yard (0.9.25)
115
129
 
116
130
  PLATFORMS
117
131
  ruby
@@ -124,10 +138,10 @@ DEPENDENCIES
124
138
  guard-rspec (~> 4.7)
125
139
  listen (= 3.0.7)
126
140
  pry
127
- rake (~> 10.0)
141
+ rake (~> 13.0)
128
142
  rspec (~> 3.4)
129
143
  rubocop
130
144
  yard
131
145
 
132
146
  BUNDLED WITH
133
- 1.14.6
147
+ 1.17.2
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](LICENSE.txt)
4
4
  [![Gem Version](https://badge.fury.io/rb/danger-xcode_summary.svg)](https://badge.fury.io/rb/danger-xcode_summary)
5
5
  [![Build Status](https://travis-ci.org/diogot/danger-xcode_summary.svg?branch=master)](https://travis-ci.org/diogot/danger-xcode_summary)
6
- [![Dependency Status](https://dependencyci.com/github/diogot/danger-xcode_summary/badge)](https://dependencyci.com/github/diogot/danger-xcode_summary)
7
6
 
8
7
  A [Danger](http://danger.systems) plugin that shows all build errors, warnings and unit tests results generated from `xcodebuild`.
9
8
 
@@ -11,6 +10,8 @@ You need to use [xcpretty](https://github.com/supermarin/xcpretty) with
11
10
  [xcpretty-json-formatter](https://github.com/marcelofabri/xcpretty-json-formatter)
12
11
  to generate a JSON file that this plugin can read.
13
12
 
13
+ **Using [danger-swift](https://github.com/danger/swift)**? You may want to take a look at [danger-swift-xcodesummary](https://github.com/f-meloni/danger-swift-xcodesummary).
14
+
14
15
  ## How does it look?
15
16
 
16
17
  <table>
@@ -96,13 +97,26 @@ xcode_summary.report 'xcodebuild.json'
96
97
  ```
97
98
 
98
99
  You can also ignore warnings from certain files by setting `ignored_files`:
100
+ Warning: `ignored_files` patterns applied on relative paths.
99
101
 
100
102
  ```ruby
101
103
  # Ignoring warnings from Pods
102
- xcode_summary.ignored_files = '**/Pods/**'
104
+ xcode_summary.ignored_files = 'Pods/**'
105
+
106
+ # Ignoring specific warnings
107
+ xcode_summary.ignored_results { |result|
108
+ result.message.start_with? 'ld' # Ignore ld_warnings
109
+ }
110
+
103
111
  xcode_summary.report 'xcodebuild.json'
104
112
  ```
105
113
 
114
+ You can use `ignores_warnings` to supress warnings and shows only errors.
115
+
116
+ ```ruby
117
+ xcode_summary.ignores_warnings = true
118
+ ```
119
+
106
120
  You can use `inline_mode`.
107
121
  When this value is enabled, each warnings and errors are commented on each lines.
108
122
 
@@ -112,6 +126,12 @@ xcode_summary.inline_mode = true
112
126
  xcode_summary.report 'xcodebuild.json'
113
127
  ```
114
128
 
129
+ 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}:
130
+
131
+ ```ruby
132
+ result = xcode_summary.warning_error_count 'xcodebuild.json'
133
+ ```
134
+
115
135
  ## License
116
136
 
117
137
  danger-xcode_summary is released under the MIT license. See [LICENSE.txt](LICENSE.txt) for details.
@@ -21,11 +21,13 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
  spec.require_paths = ['lib']
23
23
 
24
+ spec.required_ruby_version = ">= 2.4.0"
25
+
24
26
  spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
25
27
 
26
28
  # General ruby development
27
29
  spec.add_development_dependency 'bundler', '~> 1.3'
28
- spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rake', '~> 13.0'
29
31
 
30
32
  # Testing support
31
33
  spec.add_development_dependency 'rspec', '~> 3.4'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xcode_summary/plugin'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xcode_summary/gem_version'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module XcodeSummary
2
- VERSION = '0.2.1'.freeze
4
+ VERSION = '0.5.2'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module Danger
@@ -35,6 +37,13 @@ module Danger
35
37
  # @return [[String]]
36
38
  attr_accessor :ignored_files
37
39
 
40
+ # A block that filters specific results.
41
+ # An example would be `lambda { |result| result.message.start_with?('ld') }` to ignore results for ld_warnings.
42
+ #
43
+ # @param [Block value
44
+ # @return [Block]
45
+ attr_accessor :ignored_results
46
+
38
47
  # Defines if the test summary will be sticky or not.
39
48
  # Defaults to `false`.
40
49
  # @param [Boolean] value
@@ -53,6 +62,13 @@ module Danger
53
62
  # @return [Boolean]
54
63
  attr_accessor :inline_mode
55
64
 
65
+ # Defines if warnings should be included or not
66
+ # Defaults to `false`.
67
+ # @param [Boolean] value
68
+ # @return [Boolean]
69
+ attr_accessor :ignores_warnings
70
+
71
+ # rubocop:disable Lint/DuplicateMethods
56
72
  def project_root
57
73
  root = @project_root || Dir.pwd
58
74
  root += '/' unless root.end_with? '/'
@@ -63,6 +79,10 @@ module Danger
63
79
  [@ignored_files].flatten.compact
64
80
  end
65
81
 
82
+ def ignored_results(&block)
83
+ @ignored_results ||= block
84
+ end
85
+
66
86
  def sticky_summary
67
87
  @sticky_summary || false
68
88
  end
@@ -75,6 +95,18 @@ module Danger
75
95
  @inline_mode || false
76
96
  end
77
97
 
98
+ def ignores_warnings
99
+ @ignores_warnings || false
100
+ end
101
+
102
+ # Pick a Dangerfile plugin for a chosen request_source and cache it
103
+ # based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
104
+ def plugin
105
+ plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
106
+ @plugin ||= plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
107
+ end
108
+ # rubocop:enable Lint/DuplicateMethods
109
+
78
110
  # Reads a file with JSON Xcode summary and reports it.
79
111
  #
80
112
  # @param [String] file_path Path for Xcode summary in JSON format.
@@ -88,6 +120,22 @@ module Danger
88
120
  end
89
121
  end
90
122
 
123
+ # Reads a file with JSON Xcode summary and reports its warning and error count.
124
+ #
125
+ # @param [String] file_path Path for Xcode summary in JSON format.
126
+ # @return [String] JSON string with warningCount and errorCount
127
+ def warning_error_count(file_path)
128
+ if File.file?(file_path)
129
+ xcode_summary = JSON.parse(File.read(file_path), symbolize_names: true)
130
+ warning_count = warnings(xcode_summary).count
131
+ error_count = errors(xcode_summary).count
132
+ result = { warnings: warning_count, errors: error_count }
133
+ result.to_json
134
+ else
135
+ fail 'summary file not found'
136
+ end
137
+ end
138
+
91
139
  private
92
140
 
93
141
  def format_summary(xcode_summary)
@@ -119,17 +167,22 @@ module Danger
119
167
  end
120
168
 
121
169
  def warnings(xcode_summary)
122
- [
170
+ if ignores_warnings
171
+ return []
172
+ end
173
+
174
+ warnings = [
123
175
  xcode_summary.fetch(:warnings, []).map { |message| Result.new(message, nil) },
124
176
  xcode_summary.fetch(:ld_warnings, []).map { |message| Result.new(message, nil) },
125
177
  xcode_summary.fetch(:compile_warnings, {}).map do |h|
126
178
  Result.new(format_compile_warning(h), parse_location(h))
127
179
  end
128
180
  ].flatten.uniq.compact.reject { |result| result.message.nil? }
181
+ warnings.delete_if(&ignored_results)
129
182
  end
130
183
 
131
184
  def errors(xcode_summary)
132
- [
185
+ errors = [
133
186
  xcode_summary.fetch(:errors, []).map { |message| Result.new(message, nil) },
134
187
  xcode_summary.fetch(:compile_errors, {}).map do |h|
135
188
  Result.new(format_compile_warning(h), parse_location(h))
@@ -149,11 +202,12 @@ module Danger
149
202
  end
150
203
  end
151
204
  ].flatten.uniq.compact.reject { |result| result.message.nil? }
205
+ errors.delete_if(&ignored_results)
152
206
  end
153
207
 
154
- def parse_location(h)
155
- file_path, line, _column = h[:file_path].split(':')
156
- Location.new(h[:file_name], file_path, line.to_i)
208
+ def parse_location(input)
209
+ file_path, line, _column = input[:file_path].split(':')
210
+ Location.new(input[:file_name], file_path, line.to_i)
157
211
  end
158
212
 
159
213
  def parse_test_location(failure)
@@ -163,27 +217,24 @@ module Danger
163
217
  end
164
218
 
165
219
  def format_path(path)
166
- clean_path, line = parse_filename(path)
167
- path = clean_path + '#L' + line if clean_path && line
168
-
169
- # Pick a Dangerfile plugin for a chosen request_source
170
- # based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
171
- plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin }
172
- plugin = plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first
173
-
174
- plugin.html_link(path)
220
+ if plugin
221
+ clean_path, line = parse_filename(path)
222
+ path = clean_path + '#L' + line if clean_path && line
223
+ plugin.html_link(path)
224
+ else
225
+ path
226
+ end
175
227
  end
176
228
 
177
229
  def parse_filename(path)
178
230
  regex = /^(.*?):(\d*):?\d*$/
179
231
  match = path.match(regex)
180
- if match
181
- match.captures
182
- end
232
+ match&.captures
183
233
  end
184
234
 
185
235
  def relative_path(path)
186
236
  return nil if project_root.nil?
237
+
187
238
  path.gsub(project_root, '')
188
239
  end
189
240
 
@@ -197,38 +248,38 @@ module Danger
197
248
  reason.gsub('>', '\>').gsub('<', '\<')
198
249
  end
199
250
 
200
- def format_compile_warning(h)
201
- path = relative_path(h[:file_path])
251
+ def format_compile_warning(input)
252
+ path = relative_path(input[:file_path])
202
253
  return nil if should_ignore_warning?(path)
203
254
 
204
255
  path_link = format_path(path)
205
256
 
206
- warning = "**#{path_link}**: #{escape_reason(h[:reason])} <br />"
207
- if h[:line] && !h[:line].empty?
257
+ warning = "**#{path_link}**: #{escape_reason(input[:reason])} <br />"
258
+ if input[:line] && !input[:line].empty?
208
259
  "#{warning}" \
209
260
  "```\n" \
210
- "#{h[:line]}\n" \
261
+ "#{input[:line]}\n" \
211
262
  '```'
212
263
  else
213
264
  warning
214
265
  end
215
266
  end
216
267
 
217
- def format_format_file_missing_error(h)
218
- path = relative_path(h[:file_path])
268
+ def format_format_file_missing_error(input)
269
+ path = relative_path(input[:file_path])
219
270
  path_link = format_path(path)
220
- "**#{escape_reason(h[:reason])}**: #{path_link}"
271
+ "**#{escape_reason(input[:reason])}**: #{path_link}"
221
272
  end
222
273
 
223
- def format_undefined_symbols(h)
224
- "#{h[:message]} <br />" \
225
- "> Symbol: #{h[:symbol]} <br />" \
226
- "> Referenced from: #{h[:reference]}"
274
+ def format_undefined_symbols(input)
275
+ "#{input[:message]} <br />" \
276
+ "> Symbol: #{input[:symbol]} <br />" \
277
+ "> Referenced from: #{input[:reference]}"
227
278
  end
228
279
 
229
- def format_duplicate_symbols(h)
230
- "#{h[:message]} <br />" \
231
- "> #{h[:file_paths].map { |path| path.split('/').last }.join('<br /> ')}"
280
+ def format_duplicate_symbols(input)
281
+ "#{input[:message]} <br />" \
282
+ "> #{input[:file_paths].map { |path| path.split('/').last }.join('<br /> ')}"
232
283
  end
233
284
 
234
285
  def format_test_failure(suite_name, failure)
@@ -0,0 +1,31 @@
1
+ {
2
+ "warnings": [
3
+
4
+ ],
5
+ "ld_warnings": [
6
+ "some warning",
7
+ "another warning"
8
+ ],
9
+ "compile_warnings": [
10
+
11
+ ],
12
+ "errors": [
13
+
14
+ ],
15
+ "compile_errors": [
16
+
17
+ ],
18
+ "file_missing_errors": [
19
+
20
+ ],
21
+ "undefined_symbols_errors": [
22
+
23
+ ],
24
+ "duplicate_symbols_errors": [
25
+
26
+ ],
27
+ "tests_failures": {
28
+ },
29
+ "tests_summary_messages": [
30
+ ]
31
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "warnings": [
3
+ "some warning",
4
+ "another warning"
5
+ ],
6
+ "ld_warnings": [
7
+
8
+ ],
9
+ "compile_warnings": [
10
+
11
+ ],
12
+ "errors": [
13
+ "some error",
14
+ "another error"
15
+ ],
16
+ "compile_errors": [
17
+
18
+ ],
19
+ "file_missing_errors": [
20
+
21
+ ],
22
+ "undefined_symbols_errors": [
23
+
24
+ ],
25
+ "duplicate_symbols_errors": [
26
+
27
+ ],
28
+ "tests_failures": {
29
+ },
30
+ "tests_summary_messages": [
31
+ ]
32
+ }
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
- ROOT = Pathname.new(File.expand_path('../../', __FILE__))
4
+ ROOT = Pathname.new(File.expand_path('..', __dir__))
3
5
  $LOAD_PATH.unshift((ROOT + 'lib').to_s)
4
6
  $LOAD_PATH.unshift((ROOT + 'spec').to_s)
5
7
 
@@ -55,9 +57,12 @@ end
55
57
  def testing_bitbucket_env
56
58
  {
57
59
  'GIT_URL' => 'https://github.com/diogot/danger-xcode_summary.git',
60
+ 'CHANGE_ID' => '4d4c0f31857e3185b51b6865a0700525bc0cb2bb',
58
61
  'JENKINS_URL' => 'http://jenkins.server.com/',
59
62
  'DANGER_BITBUCKETCLOUD_USERNAME' => 'username',
60
- 'DANGER_BITBUCKETCLOUD_PASSWORD' => 'password'
63
+ 'DANGER_BITBUCKETCLOUD_PASSWORD' => 'password',
64
+ 'DANGER_BITBUCKETCLOUD_UUID' => 'c91be865-efc6-49a6-93c5-24e1267c479b',
65
+ 'ghprbPullId' => '2080'
61
66
  }
62
67
  end
63
68
 
@@ -1,4 +1,6 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('spec_helper', __dir__)
2
4
 
3
5
  module Danger
4
6
  describe Danger::DangerXcodeSummary do
@@ -52,19 +54,19 @@ module Danger
52
54
  it 'formats compile warnings' do
53
55
  @xcode_summary.report('spec/fixtures/summary.json')
54
56
  expect(@dangerfile.status_report[:warnings]).to eq [
55
- # rubocop:disable LineLength
57
+ # rubocop:disable Layout/LineLength
56
58
  "**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/Bla.m#L32'>MyWeight/Bla.m#L32</a>**: Value stored to 'theme' is never read <br />```\n theme = *ptr++;\n```",
57
59
  "**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/Pods/ISO8601DateFormatter/ISO8601DateFormatter.m#L176'>MyWeight/Pods/ISO8601DateFormatter/ISO8601DateFormatter.m#L176</a>**: 'NSUndefinedDateComponent' is deprecated: first deprecated in iOS 8.0 - Use NSDateComponentUndefined instead [-Wdeprecated-declarations] <br />```\n month_or_week = NSUndefinedDateComponent,\n```"
58
- # rubocop:enable LineLength
60
+ # rubocop:enable Layout/LineLength
59
61
  ]
60
62
  end
61
63
 
62
64
  it 'formats compile warnings with empty line' do
63
65
  @xcode_summary.report('spec/fixtures/summary_with_empty_line.json')
64
66
  expect(@dangerfile.status_report[:warnings]).to eq [
65
- # rubocop:disable LineLength
67
+ # rubocop:disable Layout/LineLength
66
68
  "**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/Users/marcelofabri/Developer/MyAwesomeProject/MyAwesomeProject/Classes/AppDelegate.swift#L10001'>/Users/marcelofabri/Developer/MyAwesomeProject/MyAwesomeProject/Classes/AppDelegate.swift#L10001</a>**: File should contain 400 lines or less: currently contains 10001 <br />"
67
- # rubocop:enable LineLength
69
+ # rubocop:enable Layout/LineLength
68
70
  ]
69
71
  end
70
72
 
@@ -72,9 +74,9 @@ module Danger
72
74
  @xcode_summary.ignored_files = '**/Pods/**'
73
75
  @xcode_summary.report('spec/fixtures/summary.json')
74
76
  expect(@dangerfile.status_report[:warnings]).to eq [
75
- # rubocop:disable LineLength
76
- "**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/Bla.m#L32'>MyWeight/Bla.m#L32</a>**: Value stored to 'theme' is never read <br />```\n theme = *ptr++;\n```",
77
- # rubocop:enable LineLength
77
+ # rubocop:disable Layout/LineLength
78
+ "**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/Bla.m#L32'>MyWeight/Bla.m#L32</a>**: Value stored to 'theme' is never read <br />```\n theme = *ptr++;\n```"
79
+ # rubocop:enable Layout/LineLength
78
80
  ]
79
81
  end
80
82
 
@@ -87,10 +89,10 @@ module Danger
87
89
  it 'formats test errors' do
88
90
  @xcode_summary.report('spec/fixtures/test_errors.json')
89
91
  expect(@dangerfile.status_report[:errors]).to eq [
90
- # rubocop:disable LineLength
92
+ # rubocop:disable Layout/LineLength
91
93
  '**MyWeight.MyWeightSpec**: works_with_success, expected to eventually not be nil, got \<nil\> <br /> ' \
92
- "<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/MyWeightTests/Tests.swift#L86'>MyWeight/MyWeightTests/Tests.swift#L86</a>",
93
- # rubocop:enable LineLength
94
+ "<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/MyWeightTests/Tests.swift#L86'>MyWeight/MyWeightTests/Tests.swift#L86</a>"
95
+ # rubocop:enable Layout/LineLength
94
96
  ]
95
97
  end
96
98
 
@@ -102,6 +104,11 @@ module Danger
102
104
  ]
103
105
  end
104
106
 
107
+ it 'report waring and error counts' do
108
+ result = @xcode_summary.warning_error_count('spec/fixtures/summary.json')
109
+ expect(result).to eq '{"warnings":2,"errors":0}'
110
+ end
111
+
105
112
  context 'with inline_mode' do
106
113
  before do
107
114
  @xcode_summary.inline_mode = true
@@ -135,6 +142,54 @@ module Danger
135
142
  )
136
143
  end
137
144
  end
145
+
146
+ context 'with ignored_results' do
147
+ before do
148
+ @xcode_summary.ignored_results { |result| result.message.start_with? 'some' }
149
+ end
150
+
151
+ it 'asserts no errors' do
152
+ @xcode_summary.report('spec/fixtures/errors.json')
153
+ expect(@dangerfile.status_report[:errors]).to eq ['another error']
154
+ end
155
+
156
+ it 'asserts no warnings' do
157
+ @xcode_summary.report('spec/fixtures/ld_warnings.json')
158
+ expect(@dangerfile.status_report[:warnings]).to eq ['another warning']
159
+ end
160
+
161
+ it 'report warning and error counts with no errors' do
162
+ result = @xcode_summary.warning_error_count('spec/fixtures/errors.json')
163
+ expect(result).to eq '{"warnings":0,"errors":1}'
164
+ end
165
+
166
+ it 'report waring and error counts with no warnings' do
167
+ result = @xcode_summary.warning_error_count('spec/fixtures/ld_warnings.json')
168
+ expect(result).to eq '{"warnings":1,"errors":0}'
169
+ end
170
+ end
171
+
172
+ context 'with ignores_warnings' do
173
+ before do
174
+ @xcode_summary.ignores_warnings = true
175
+ end
176
+
177
+ it 'asserts no ld warnings' do
178
+ @xcode_summary.report('spec/fixtures/ld_warnings.json')
179
+ expect(@dangerfile.status_report[:warnings]).to eq []
180
+ end
181
+
182
+ it 'asserts no errors' do
183
+ @xcode_summary.report('spec/fixtures/warnings_errors.json')
184
+ expect(@dangerfile.status_report[:warnings]).to eq []
185
+ expect(@dangerfile.status_report[:errors]).to eq ['some error', 'another error']
186
+ end
187
+
188
+ it 'report warning and error counts with no warning' do
189
+ result = @xcode_summary.warning_error_count('spec/fixtures/warnings_errors.json')
190
+ expect(result).to eq '{"warnings":0,"errors":2}'
191
+ end
192
+ end
138
193
  end
139
194
  end
140
195
 
@@ -143,18 +198,14 @@ module Danger
143
198
  before do
144
199
  @dangerfile = testing_bitbucket_dangerfile
145
200
  @xcode_summary = @dangerfile.xcode_summary
146
- # rubocop:disable LineLength
147
201
  @xcode_summary.env.request_source.pr_json = JSON.parse(IO.read('spec/fixtures/bitbucket_pr.json'), symbolize_names: true)
148
- # rubocop:enable LineLength
149
202
  @xcode_summary.project_root = '/Users/diogo/src/danger-xcode_summary'
150
203
  end
151
204
 
152
205
  describe 'where request source' do
153
206
  it 'should be bitbucket' do
154
- path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb#L3')
155
- # rubocop:disable LineLength
156
- expect(path).to eq "<a href='https://github.com/diogot/danger-xcode_summary/lib/xcode_summary/plugin.rb?at=4d4c0f31857e3185b51b6865a0700525bc0cb2bb#L3'>lib/xcode_summary/plugin.rb</a>"
157
- # rubocop:enable LineLength
207
+ path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb:3')
208
+ expect(path).to eq 'lib/xcode_summary/plugin.rb:3'
158
209
  end
159
210
  end
160
211
  end
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: 0.2.1
4
+ version: 0.5.2
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: 2017-05-10 00:00:00.000000000 Z
12
+ date: 2020-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: danger-plugin-api
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '10.0'
48
+ version: '13.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '10.0'
55
+ version: '13.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -147,11 +147,13 @@ files:
147
147
  - lib/xcode_summary/plugin.rb
148
148
  - spec/fixtures/bitbucket_pr.json
149
149
  - spec/fixtures/errors.json
150
+ - spec/fixtures/ld_warnings.json
150
151
  - spec/fixtures/pr_json.json
151
152
  - spec/fixtures/summary.json
152
153
  - spec/fixtures/summary_messages.json
153
154
  - spec/fixtures/summary_with_empty_line.json
154
155
  - spec/fixtures/test_errors.json
156
+ - spec/fixtures/warnings_errors.json
155
157
  - spec/spec_helper.rb
156
158
  - spec/xcode_summary_spec.rb
157
159
  homepage: https://github.com/diogot/danger-xcode_summary
@@ -166,15 +168,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
168
  requirements:
167
169
  - - ">="
168
170
  - !ruby/object:Gem::Version
169
- version: '0'
171
+ version: 2.4.0
170
172
  required_rubygems_version: !ruby/object:Gem::Requirement
171
173
  requirements:
172
174
  - - ">="
173
175
  - !ruby/object:Gem::Version
174
176
  version: '0'
175
177
  requirements: []
176
- rubyforge_project:
177
- rubygems_version: 2.4.5.2
178
+ rubygems_version: 3.0.3
178
179
  signing_key:
179
180
  specification_version: 4
180
181
  summary: A [Danger](http://danger.systems) plugin that shows all build errors, warnings
@@ -182,10 +183,12 @@ summary: A [Danger](http://danger.systems) plugin that shows all build errors, w
182
183
  test_files:
183
184
  - spec/fixtures/bitbucket_pr.json
184
185
  - spec/fixtures/errors.json
186
+ - spec/fixtures/ld_warnings.json
185
187
  - spec/fixtures/pr_json.json
186
188
  - spec/fixtures/summary.json
187
189
  - spec/fixtures/summary_messages.json
188
190
  - spec/fixtures/summary_with_empty_line.json
189
191
  - spec/fixtures/test_errors.json
192
+ - spec/fixtures/warnings_errors.json
190
193
  - spec/spec_helper.rb
191
194
  - spec/xcode_summary_spec.rb