danger-xcode_summary 0.3.0 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -7
- data/.travis.yml +3 -4
- data/Gemfile.lock +95 -69
- data/README.md +17 -3
- data/danger-xcode_summary.gemspec +4 -2
- data/lib/danger_plugin.rb +2 -0
- data/lib/danger_xcode_summary.rb +2 -0
- data/lib/xcode_summary/gem_version.rb +3 -1
- data/lib/xcode_summary/plugin.rb +71 -30
- data/spec/fixtures/warnings_errors.json +32 -0
- data/spec/spec_helper.rb +9 -4
- data/spec/xcode_summary_spec.rb +52 -19
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3207822c2dfeb0e69985f941835fa80d06ed3d0ae43e27576a2bcc72bfe8aea3
|
4
|
+
data.tar.gz: 17cb5713024a7874cf08d0f1fb1708bfacf53d865f889eaa1b76dbe2fa28342f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee02ac8c805c7f49a739e4384b656cfe24e81c04f2ff0ae108b0e78616d4b84a5ed846fa9784af99801016254434fe027541b1f4044f26265e31363de25147d
|
7
|
+
data.tar.gz: ba9211234bc2a64d42fbabee964bbe55ad12e18a48b6e6f7df53d4dee15809c20bb7e4615e66cf669d49ed4e86378cd7678c2f8b3f164b101f1a1e3cafb880ea
|
data/.rubocop.yml
CHANGED
@@ -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
|
-
|
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
|
-
|
58
|
-
Max:
|
53
|
+
Layout/LineLength:
|
54
|
+
Max: 130
|
59
55
|
|
60
56
|
# Configuration parameters: CountKeywordArgs.
|
61
57
|
Metrics/ParameterLists:
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,49 +1,63 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-xcode_summary (0.3
|
4
|
+
danger-xcode_summary (0.5.3)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
11
|
-
public_suffix (
|
12
|
-
ast (2.
|
13
|
-
claide (1.0.
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
ast (2.4.2)
|
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.
|
18
|
+
coderay (1.1.3)
|
19
19
|
colored2 (3.1.2)
|
20
20
|
cork (0.3.0)
|
21
21
|
colored2 (~> 3.1)
|
22
|
-
danger (
|
22
|
+
danger (8.2.3)
|
23
23
|
claide (~> 1.0)
|
24
24
|
claide-plugins (>= 0.9.2)
|
25
25
|
colored2 (~> 3.1)
|
26
26
|
cork (~> 0.1)
|
27
|
-
faraday (
|
28
|
-
faraday-http-cache (~>
|
29
|
-
git (~> 1)
|
30
|
-
kramdown (~>
|
31
|
-
|
32
|
-
|
27
|
+
faraday (>= 0.9.0, < 2.0)
|
28
|
+
faraday-http-cache (~> 2.0)
|
29
|
+
git (~> 1.7)
|
30
|
+
kramdown (~> 2.3)
|
31
|
+
kramdown-parser-gfm (~> 1.0)
|
32
|
+
no_proxy_fix
|
33
|
+
octokit (~> 4.7)
|
34
|
+
terminal-table (>= 1, < 4)
|
33
35
|
danger-plugin-api (1.0.0)
|
34
36
|
danger (> 2.0)
|
35
|
-
diff-lcs (1.
|
36
|
-
faraday (
|
37
|
+
diff-lcs (1.4.4)
|
38
|
+
faraday (1.4.2)
|
39
|
+
faraday-em_http (~> 1.0)
|
40
|
+
faraday-em_synchrony (~> 1.0)
|
41
|
+
faraday-excon (~> 1.1)
|
42
|
+
faraday-net_http (~> 1.0)
|
43
|
+
faraday-net_http_persistent (~> 1.1)
|
37
44
|
multipart-post (>= 1.2, < 3)
|
38
|
-
|
39
|
-
|
40
|
-
|
45
|
+
ruby2_keywords (>= 0.0.4)
|
46
|
+
faraday-em_http (1.0.0)
|
47
|
+
faraday-em_synchrony (1.0.0)
|
48
|
+
faraday-excon (1.1.0)
|
49
|
+
faraday-http-cache (2.2.0)
|
50
|
+
faraday (>= 0.8)
|
51
|
+
faraday-net_http (1.0.1)
|
52
|
+
faraday-net_http_persistent (1.1.0)
|
53
|
+
ffi (1.15.1)
|
41
54
|
formatador (0.2.5)
|
42
|
-
git (1.
|
43
|
-
|
55
|
+
git (1.8.1)
|
56
|
+
rchardet (~> 1.8)
|
57
|
+
guard (2.17.0)
|
44
58
|
formatador (>= 0.2.4)
|
45
59
|
listen (>= 2.7, < 4.0)
|
46
|
-
lumberjack (
|
60
|
+
lumberjack (>= 1.0.12, < 2.0)
|
47
61
|
nenv (~> 0.1)
|
48
62
|
notiffany (~> 0.0)
|
49
63
|
pry (>= 0.9.12)
|
@@ -54,80 +68,92 @@ GEM
|
|
54
68
|
guard (~> 2.1)
|
55
69
|
guard-compat (~> 1.1)
|
56
70
|
rspec (>= 2.99.0, < 4.0)
|
57
|
-
kramdown (
|
71
|
+
kramdown (2.3.1)
|
72
|
+
rexml
|
73
|
+
kramdown-parser-gfm (1.1.0)
|
74
|
+
kramdown (~> 2.0)
|
58
75
|
listen (3.0.7)
|
59
76
|
rb-fsevent (>= 0.9.3)
|
60
77
|
rb-inotify (>= 0.9.7)
|
61
|
-
lumberjack (1.
|
62
|
-
method_source (0.
|
63
|
-
multipart-post (2.
|
78
|
+
lumberjack (1.2.8)
|
79
|
+
method_source (1.0.0)
|
80
|
+
multipart-post (2.1.1)
|
64
81
|
nap (1.1.0)
|
65
82
|
nenv (0.3.0)
|
66
|
-
|
83
|
+
no_proxy_fix (0.1.2)
|
84
|
+
notiffany (0.1.3)
|
67
85
|
nenv (~> 0.1)
|
68
86
|
shellany (~> 0.0)
|
69
|
-
octokit (4.
|
87
|
+
octokit (4.21.0)
|
88
|
+
faraday (>= 0.9)
|
70
89
|
sawyer (~> 0.8.0, >= 0.5.3)
|
71
90
|
open4 (1.3.4)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
pry (0.
|
76
|
-
coderay (~> 1.1
|
77
|
-
method_source (~> 0
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
rb-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
rspec-
|
89
|
-
|
90
|
-
rspec-
|
91
|
-
rspec-
|
91
|
+
parallel (1.20.1)
|
92
|
+
parser (3.0.1.1)
|
93
|
+
ast (~> 2.4.1)
|
94
|
+
pry (0.14.1)
|
95
|
+
coderay (~> 1.1)
|
96
|
+
method_source (~> 1.0)
|
97
|
+
public_suffix (4.0.6)
|
98
|
+
rainbow (3.0.0)
|
99
|
+
rake (13.0.3)
|
100
|
+
rb-fsevent (0.11.0)
|
101
|
+
rb-inotify (0.10.1)
|
102
|
+
ffi (~> 1.0)
|
103
|
+
rchardet (1.8.0)
|
104
|
+
regexp_parser (2.1.1)
|
105
|
+
rexml (3.2.5)
|
106
|
+
rspec (3.10.0)
|
107
|
+
rspec-core (~> 3.10.0)
|
108
|
+
rspec-expectations (~> 3.10.0)
|
109
|
+
rspec-mocks (~> 3.10.0)
|
110
|
+
rspec-core (3.10.1)
|
111
|
+
rspec-support (~> 3.10.0)
|
112
|
+
rspec-expectations (3.10.1)
|
92
113
|
diff-lcs (>= 1.2.0, < 2.0)
|
93
|
-
rspec-support (~> 3.
|
94
|
-
rspec-mocks (3.
|
114
|
+
rspec-support (~> 3.10.0)
|
115
|
+
rspec-mocks (3.10.2)
|
95
116
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
-
rspec-support (~> 3.
|
97
|
-
rspec-support (3.
|
98
|
-
rubocop (
|
99
|
-
|
100
|
-
|
101
|
-
rainbow (>=
|
117
|
+
rspec-support (~> 3.10.0)
|
118
|
+
rspec-support (3.10.2)
|
119
|
+
rubocop (1.15.0)
|
120
|
+
parallel (~> 1.10)
|
121
|
+
parser (>= 3.0.0.0)
|
122
|
+
rainbow (>= 2.2.2, < 4.0)
|
123
|
+
regexp_parser (>= 1.8, < 3.0)
|
124
|
+
rexml
|
125
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
102
126
|
ruby-progressbar (~> 1.7)
|
103
|
-
unicode-display_width (
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
127
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
128
|
+
rubocop-ast (1.5.0)
|
129
|
+
parser (>= 3.0.1.1)
|
130
|
+
ruby-progressbar (1.11.0)
|
131
|
+
ruby2_keywords (0.0.4)
|
132
|
+
sawyer (0.8.2)
|
133
|
+
addressable (>= 2.3.5)
|
134
|
+
faraday (> 0.8, < 2.0)
|
108
135
|
shellany (0.0.1)
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
yard (0.9.8)
|
136
|
+
terminal-table (3.0.1)
|
137
|
+
unicode-display_width (>= 1.1.1, < 3)
|
138
|
+
thor (1.1.0)
|
139
|
+
unicode-display_width (2.0.0)
|
140
|
+
yard (0.9.26)
|
115
141
|
|
116
142
|
PLATFORMS
|
117
143
|
ruby
|
118
144
|
|
119
145
|
DEPENDENCIES
|
120
|
-
bundler (
|
146
|
+
bundler (>= 2.2.10)
|
121
147
|
danger
|
122
148
|
danger-xcode_summary!
|
123
149
|
guard (~> 2.14)
|
124
150
|
guard-rspec (~> 4.7)
|
125
151
|
listen (= 3.0.7)
|
126
152
|
pry
|
127
|
-
rake (~>
|
153
|
+
rake (~> 13.0)
|
128
154
|
rspec (~> 3.4)
|
129
155
|
rubocop
|
130
156
|
yard
|
131
157
|
|
132
158
|
BUNDLED WITH
|
133
|
-
|
159
|
+
2.2.17
|
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,19 +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 = '
|
104
|
+
xcode_summary.ignored_files = 'Pods/**'
|
103
105
|
|
104
106
|
# Ignoring specific warnings
|
105
107
|
xcode_summary.ignored_results { |result|
|
106
|
-
result.message.start_with 'ld' # Ignore ld_warnings
|
108
|
+
result.message.start_with? 'ld' # Ignore ld_warnings
|
107
109
|
}
|
108
110
|
|
109
111
|
xcode_summary.report 'xcodebuild.json'
|
110
112
|
```
|
111
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
|
+
|
112
120
|
You can use `inline_mode`.
|
113
121
|
When this value is enabled, each warnings and errors are commented on each lines.
|
114
122
|
|
@@ -118,6 +126,12 @@ xcode_summary.inline_mode = true
|
|
118
126
|
xcode_summary.report 'xcodebuild.json'
|
119
127
|
```
|
120
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
|
+
|
121
135
|
## License
|
122
136
|
|
123
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
|
-
spec.add_development_dependency 'bundler', '
|
28
|
-
spec.add_development_dependency 'rake', '~>
|
29
|
+
spec.add_development_dependency 'bundler', '>= 2.2.10'
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
29
31
|
|
30
32
|
# Testing support
|
31
33
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
data/lib/danger_plugin.rb
CHANGED
data/lib/danger_xcode_summary.rb
CHANGED
data/lib/xcode_summary/plugin.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
|
3
5
|
module Danger
|
@@ -60,6 +62,13 @@ module Danger
|
|
60
62
|
# @return [Boolean]
|
61
63
|
attr_accessor :inline_mode
|
62
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
|
63
72
|
def project_root
|
64
73
|
root = @project_root || Dir.pwd
|
65
74
|
root += '/' unless root.end_with? '/'
|
@@ -86,6 +95,18 @@ module Danger
|
|
86
95
|
@inline_mode || false
|
87
96
|
end
|
88
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
|
+
|
89
110
|
# Reads a file with JSON Xcode summary and reports it.
|
90
111
|
#
|
91
112
|
# @param [String] file_path Path for Xcode summary in JSON format.
|
@@ -99,6 +120,22 @@ module Danger
|
|
99
120
|
end
|
100
121
|
end
|
101
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
|
+
|
102
139
|
private
|
103
140
|
|
104
141
|
def format_summary(xcode_summary)
|
@@ -110,6 +147,7 @@ module Danger
|
|
110
147
|
warn(result.message, sticky: false)
|
111
148
|
end
|
112
149
|
end
|
150
|
+
# rubocop:disable Lint/UnreachableLoop
|
113
151
|
errors(xcode_summary).each do |result|
|
114
152
|
if inline_mode && result.location
|
115
153
|
fail(result.message, sticky: false, file: result.location.file_name, line: result.location.line)
|
@@ -117,6 +155,7 @@ module Danger
|
|
117
155
|
fail(result.message, sticky: false)
|
118
156
|
end
|
119
157
|
end
|
158
|
+
# rubocop:enable Lint/UnreachableLoop
|
120
159
|
end
|
121
160
|
|
122
161
|
def messages(xcode_summary)
|
@@ -130,6 +169,10 @@ module Danger
|
|
130
169
|
end
|
131
170
|
|
132
171
|
def warnings(xcode_summary)
|
172
|
+
if ignores_warnings
|
173
|
+
return []
|
174
|
+
end
|
175
|
+
|
133
176
|
warnings = [
|
134
177
|
xcode_summary.fetch(:warnings, []).map { |message| Result.new(message, nil) },
|
135
178
|
xcode_summary.fetch(:ld_warnings, []).map { |message| Result.new(message, nil) },
|
@@ -164,9 +207,10 @@ module Danger
|
|
164
207
|
errors.delete_if(&ignored_results)
|
165
208
|
end
|
166
209
|
|
167
|
-
def parse_location(
|
168
|
-
file_path, line, _column =
|
169
|
-
|
210
|
+
def parse_location(input)
|
211
|
+
file_path, line, _column = input[:file_path].split(':')
|
212
|
+
file_name = relative_path(file_path)
|
213
|
+
Location.new(file_name, file_path, line.to_i)
|
170
214
|
end
|
171
215
|
|
172
216
|
def parse_test_location(failure)
|
@@ -176,27 +220,24 @@ module Danger
|
|
176
220
|
end
|
177
221
|
|
178
222
|
def format_path(path)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
plugin.html_link(path)
|
223
|
+
if plugin
|
224
|
+
clean_path, line = parse_filename(path)
|
225
|
+
path = "#{clean_path}#L#{line}" if clean_path && line
|
226
|
+
plugin.html_link(path)
|
227
|
+
else
|
228
|
+
path
|
229
|
+
end
|
188
230
|
end
|
189
231
|
|
190
232
|
def parse_filename(path)
|
191
233
|
regex = /^(.*?):(\d*):?\d*$/
|
192
234
|
match = path.match(regex)
|
193
|
-
|
194
|
-
match.captures
|
195
|
-
end
|
235
|
+
match&.captures
|
196
236
|
end
|
197
237
|
|
198
238
|
def relative_path(path)
|
199
239
|
return nil if project_root.nil?
|
240
|
+
|
200
241
|
path.gsub(project_root, '')
|
201
242
|
end
|
202
243
|
|
@@ -210,38 +251,38 @@ module Danger
|
|
210
251
|
reason.gsub('>', '\>').gsub('<', '\<')
|
211
252
|
end
|
212
253
|
|
213
|
-
def format_compile_warning(
|
214
|
-
path = relative_path(
|
254
|
+
def format_compile_warning(input)
|
255
|
+
path = relative_path(input[:file_path])
|
215
256
|
return nil if should_ignore_warning?(path)
|
216
257
|
|
217
258
|
path_link = format_path(path)
|
218
259
|
|
219
|
-
warning = "**#{path_link}**: #{escape_reason(
|
220
|
-
if
|
260
|
+
warning = "**#{path_link}**: #{escape_reason(input[:reason])} <br />"
|
261
|
+
if input[:line] && !input[:line].empty?
|
221
262
|
"#{warning}" \
|
222
263
|
"```\n" \
|
223
|
-
"#{
|
264
|
+
"#{input[:line]}\n" \
|
224
265
|
'```'
|
225
266
|
else
|
226
267
|
warning
|
227
268
|
end
|
228
269
|
end
|
229
270
|
|
230
|
-
def format_format_file_missing_error(
|
231
|
-
path = relative_path(
|
271
|
+
def format_format_file_missing_error(input)
|
272
|
+
path = relative_path(input[:file_path])
|
232
273
|
path_link = format_path(path)
|
233
|
-
"**#{escape_reason(
|
274
|
+
"**#{escape_reason(input[:reason])}**: #{path_link}"
|
234
275
|
end
|
235
276
|
|
236
|
-
def format_undefined_symbols(
|
237
|
-
"#{
|
238
|
-
"> Symbol: #{
|
239
|
-
"> Referenced from: #{
|
277
|
+
def format_undefined_symbols(input)
|
278
|
+
"#{input[:message]} <br />" \
|
279
|
+
"> Symbol: #{input[:symbol]} <br />" \
|
280
|
+
"> Referenced from: #{input[:reference]}"
|
240
281
|
end
|
241
282
|
|
242
|
-
def format_duplicate_symbols(
|
243
|
-
"#{
|
244
|
-
"> #{
|
283
|
+
def format_duplicate_symbols(input)
|
284
|
+
"#{input[:message]} <br />" \
|
285
|
+
"> #{input[:file_paths].map { |path| path.split('/').last }.join('<br /> ')}"
|
245
286
|
end
|
246
287
|
|
247
288
|
def format_test_failure(suite_name, failure)
|
@@ -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
|
+
}
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
|
-
ROOT = Pathname.new(File.expand_path('
|
3
|
-
$LOAD_PATH.unshift(
|
4
|
-
$LOAD_PATH.unshift(
|
4
|
+
ROOT = Pathname.new(File.expand_path('..', __dir__))
|
5
|
+
$LOAD_PATH.unshift("#{ROOT}lib".to_s)
|
6
|
+
$LOAD_PATH.unshift("#{ROOT}spec".to_s)
|
5
7
|
|
6
8
|
require 'bundler/setup'
|
7
9
|
require 'pry'
|
@@ -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
|
|
data/spec/xcode_summary_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
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,8 @@ 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
|
91
92
|
'**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
|
93
|
+
"<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/MyWeightTests/Tests.swift#L86'>MyWeight/MyWeightTests/Tests.swift#L86</a>"
|
94
94
|
]
|
95
95
|
end
|
96
96
|
|
@@ -102,6 +102,11 @@ module Danger
|
|
102
102
|
]
|
103
103
|
end
|
104
104
|
|
105
|
+
it 'report waring and error counts' do
|
106
|
+
result = @xcode_summary.warning_error_count('spec/fixtures/summary.json')
|
107
|
+
expect(result).to eq '{"warnings":2,"errors":0}'
|
108
|
+
end
|
109
|
+
|
105
110
|
context 'with inline_mode' do
|
106
111
|
before do
|
107
112
|
@xcode_summary.inline_mode = true
|
@@ -124,13 +129,13 @@ module Danger
|
|
124
129
|
expect(@xcode_summary).to have_received(:warn).with(
|
125
130
|
instance_of(String),
|
126
131
|
sticky: false,
|
127
|
-
file: 'Bla.m',
|
132
|
+
file: 'MyWeight/Bla.m',
|
128
133
|
line: 32
|
129
134
|
)
|
130
135
|
expect(@xcode_summary).to have_received(:warn).with(
|
131
136
|
instance_of(String),
|
132
137
|
sticky: false,
|
133
|
-
file: 'ISO8601DateFormatter.m',
|
138
|
+
file: 'MyWeight/Pods/ISO8601DateFormatter/ISO8601DateFormatter.m',
|
134
139
|
line: 176
|
135
140
|
)
|
136
141
|
end
|
@@ -150,6 +155,38 @@ module Danger
|
|
150
155
|
@xcode_summary.report('spec/fixtures/ld_warnings.json')
|
151
156
|
expect(@dangerfile.status_report[:warnings]).to eq ['another warning']
|
152
157
|
end
|
158
|
+
|
159
|
+
it 'report warning and error counts with no errors' do
|
160
|
+
result = @xcode_summary.warning_error_count('spec/fixtures/errors.json')
|
161
|
+
expect(result).to eq '{"warnings":0,"errors":1}'
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'report waring and error counts with no warnings' do
|
165
|
+
result = @xcode_summary.warning_error_count('spec/fixtures/ld_warnings.json')
|
166
|
+
expect(result).to eq '{"warnings":1,"errors":0}'
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context 'with ignores_warnings' do
|
171
|
+
before do
|
172
|
+
@xcode_summary.ignores_warnings = true
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'asserts no ld warnings' do
|
176
|
+
@xcode_summary.report('spec/fixtures/ld_warnings.json')
|
177
|
+
expect(@dangerfile.status_report[:warnings]).to eq []
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'asserts no errors' do
|
181
|
+
@xcode_summary.report('spec/fixtures/warnings_errors.json')
|
182
|
+
expect(@dangerfile.status_report[:warnings]).to eq []
|
183
|
+
expect(@dangerfile.status_report[:errors]).to eq ['some error', 'another error']
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'report warning and error counts with no warning' do
|
187
|
+
result = @xcode_summary.warning_error_count('spec/fixtures/warnings_errors.json')
|
188
|
+
expect(result).to eq '{"warnings":0,"errors":2}'
|
189
|
+
end
|
153
190
|
end
|
154
191
|
end
|
155
192
|
end
|
@@ -159,18 +196,14 @@ module Danger
|
|
159
196
|
before do
|
160
197
|
@dangerfile = testing_bitbucket_dangerfile
|
161
198
|
@xcode_summary = @dangerfile.xcode_summary
|
162
|
-
# rubocop:disable LineLength
|
163
199
|
@xcode_summary.env.request_source.pr_json = JSON.parse(IO.read('spec/fixtures/bitbucket_pr.json'), symbolize_names: true)
|
164
|
-
# rubocop:enable LineLength
|
165
200
|
@xcode_summary.project_root = '/Users/diogo/src/danger-xcode_summary'
|
166
201
|
end
|
167
202
|
|
168
203
|
describe 'where request source' do
|
169
204
|
it 'should be bitbucket' do
|
170
|
-
path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb
|
171
|
-
|
172
|
-
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>"
|
173
|
-
# rubocop:enable LineLength
|
205
|
+
path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb:3')
|
206
|
+
expect(path).to eq 'lib/xcode_summary/plugin.rb:3'
|
174
207
|
end
|
175
208
|
end
|
176
209
|
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.3
|
4
|
+
version: 0.5.3
|
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:
|
12
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: danger-plugin-api
|
@@ -29,30 +29,30 @@ dependencies:
|
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 2.2.10
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 2.2.10
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
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: '
|
55
|
+
version: '13.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- spec/fixtures/summary_messages.json
|
154
154
|
- spec/fixtures/summary_with_empty_line.json
|
155
155
|
- spec/fixtures/test_errors.json
|
156
|
+
- spec/fixtures/warnings_errors.json
|
156
157
|
- spec/spec_helper.rb
|
157
158
|
- spec/xcode_summary_spec.rb
|
158
159
|
homepage: https://github.com/diogot/danger-xcode_summary
|
@@ -167,15 +168,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
168
|
requirements:
|
168
169
|
- - ">="
|
169
170
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
171
|
+
version: 2.4.0
|
171
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
173
|
requirements:
|
173
174
|
- - ">="
|
174
175
|
- !ruby/object:Gem::Version
|
175
176
|
version: '0'
|
176
177
|
requirements: []
|
177
|
-
|
178
|
-
rubygems_version: 2.4.5.2
|
178
|
+
rubygems_version: 3.0.3
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: A [Danger](http://danger.systems) plugin that shows all build errors, warnings
|
@@ -189,5 +189,6 @@ test_files:
|
|
189
189
|
- spec/fixtures/summary_messages.json
|
190
190
|
- spec/fixtures/summary_with_empty_line.json
|
191
191
|
- spec/fixtures/test_errors.json
|
192
|
+
- spec/fixtures/warnings_errors.json
|
192
193
|
- spec/spec_helper.rb
|
193
194
|
- spec/xcode_summary_spec.rb
|