danger-xcode_summary 0.2.1 → 0.3.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
  SHA1:
3
- metadata.gz: 9083b1f9a94a9e18886d600ccc26e1431a1b40e6
4
- data.tar.gz: af442fcaaddcd6913e0c6b1087cadab547e07e70
3
+ metadata.gz: 5c8ef354ef9c12bcc5723808141d089f5d4fd05b
4
+ data.tar.gz: 2981e63d2cc178680dced1007ecfe7887e7b4475
5
5
  SHA512:
6
- metadata.gz: 96d3e7856eee79099c5fa5e201f980444fd1e1debf6baaac0589887bf5185633728fe0b383a87213268ad7ddae4116dfae634527c6dbeb350ef6281449c3a1ea
7
- data.tar.gz: c4247af5ab105a800bc2d7ccd29917f978f49e03fc8aa48bd5804f294e5285ed63f9ae01534011bcc8c3198a376f314510395668d0e9b82c75c65a05b6ea566d
6
+ metadata.gz: 5fdc7f726b98a2f83ee3167a6455cc000e31a60309f48f63604d64338db0caa68cd2c4f16f988dd1ca51d11c8acb87eb3a6917459be8035c332f7e15d462ba95
7
+ data.tar.gz: cf9c0a266144a0e6eb6af5cbc190a7e25289a68426e52c381cb442677e951837463e5ce62a16e14b065a85814fcef2d2cbd4f2db0cc462e26d52beac8c65258b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-xcode_summary (0.2.1)
4
+ danger-xcode_summary (0.3.0)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -100,6 +100,12 @@ You can also ignore warnings from certain files by setting `ignored_files`:
100
100
  ```ruby
101
101
  # Ignoring warnings from Pods
102
102
  xcode_summary.ignored_files = '**/Pods/**'
103
+
104
+ # Ignoring specific warnings
105
+ xcode_summary.ignored_results { |result|
106
+ result.message.start_with 'ld' # Ignore ld_warnings
107
+ }
108
+
103
109
  xcode_summary.report 'xcodebuild.json'
104
110
  ```
105
111
 
@@ -1,3 +1,3 @@
1
1
  module XcodeSummary
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -35,6 +35,13 @@ module Danger
35
35
  # @return [[String]]
36
36
  attr_accessor :ignored_files
37
37
 
38
+ # A block that filters specific results.
39
+ # An example would be `lambda { |result| result.message.start_with?('ld') }` to ignore results for ld_warnings.
40
+ #
41
+ # @param [Block value
42
+ # @return [Block]
43
+ attr_accessor :ignored_results
44
+
38
45
  # Defines if the test summary will be sticky or not.
39
46
  # Defaults to `false`.
40
47
  # @param [Boolean] value
@@ -63,6 +70,10 @@ module Danger
63
70
  [@ignored_files].flatten.compact
64
71
  end
65
72
 
73
+ def ignored_results(&block)
74
+ @ignored_results ||= block
75
+ end
76
+
66
77
  def sticky_summary
67
78
  @sticky_summary || false
68
79
  end
@@ -119,17 +130,18 @@ module Danger
119
130
  end
120
131
 
121
132
  def warnings(xcode_summary)
122
- [
133
+ warnings = [
123
134
  xcode_summary.fetch(:warnings, []).map { |message| Result.new(message, nil) },
124
135
  xcode_summary.fetch(:ld_warnings, []).map { |message| Result.new(message, nil) },
125
136
  xcode_summary.fetch(:compile_warnings, {}).map do |h|
126
137
  Result.new(format_compile_warning(h), parse_location(h))
127
138
  end
128
139
  ].flatten.uniq.compact.reject { |result| result.message.nil? }
140
+ warnings.delete_if(&ignored_results)
129
141
  end
130
142
 
131
143
  def errors(xcode_summary)
132
- [
144
+ errors = [
133
145
  xcode_summary.fetch(:errors, []).map { |message| Result.new(message, nil) },
134
146
  xcode_summary.fetch(:compile_errors, {}).map do |h|
135
147
  Result.new(format_compile_warning(h), parse_location(h))
@@ -149,6 +161,7 @@ module Danger
149
161
  end
150
162
  end
151
163
  ].flatten.uniq.compact.reject { |result| result.message.nil? }
164
+ errors.delete_if(&ignored_results)
152
165
  end
153
166
 
154
167
  def parse_location(h)
@@ -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
+ }
@@ -135,6 +135,22 @@ module Danger
135
135
  )
136
136
  end
137
137
  end
138
+
139
+ context 'with ignored_results' do
140
+ before do
141
+ @xcode_summary.ignored_results { |result| result.message.start_with? 'some' }
142
+ end
143
+
144
+ it 'asserts no errors' do
145
+ @xcode_summary.report('spec/fixtures/errors.json')
146
+ expect(@dangerfile.status_report[:errors]).to eq ['another error']
147
+ end
148
+
149
+ it 'asserts no warnings' do
150
+ @xcode_summary.report('spec/fixtures/ld_warnings.json')
151
+ expect(@dangerfile.status_report[:warnings]).to eq ['another warning']
152
+ end
153
+ end
138
154
  end
139
155
  end
140
156
 
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.3.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: 2017-05-10 00:00:00.000000000 Z
12
+ date: 2017-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: danger-plugin-api
@@ -147,6 +147,7 @@ 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
@@ -182,6 +183,7 @@ 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