slather 1.5.3 → 1.5.4

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: 7076d37f3f4d2def4ef6b6ebc7fc20c9e1f2a73d
4
- data.tar.gz: 423bc4d66018625fd6445d7a7d222a4d22245440
3
+ metadata.gz: 85bd28fb85384c55a8d1ccca96ce1067758a8ed3
4
+ data.tar.gz: 0e3da68c2cef51e2d974e895a0075a571c33ea3a
5
5
  SHA512:
6
- metadata.gz: f72e95195791a16ab9a796752d06ec66267dab0fe4c96fb3f15e9d7b7dd215071485f7b3b91305e8ad493fc47270e46f9fca8c680bef5321c38f97ef503970f5
7
- data.tar.gz: 2a32b0ed0c230677add51df7e8923d186ca657d8112b058d82e23ed729a4f625f15b93f5b2a53f8f337070d3928c3c0625fd0312828020df5d845246cf26ea9e
6
+ metadata.gz: f0103efd0bfedfa1010b1928906ede06c1f05c31fec37633ce457d776f37eb55a0e7508346614ffc47e336fcc1121ab556044dc09a1c74b8fdde1296526f15ea
7
+ data.tar.gz: 3d04ed191e03d65be018ed1b1d7187ac25cd964bf4e7cc394fbf253732d5744652fc1f1785ee2c7b156185e92a9f42532a6f09cf1aa70d224c73bbb3a5d7d7f3
data/CHANGELOG.md CHANGED
@@ -2,7 +2,17 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## v1.6.0
5
+ ## v1.5.4
6
+
7
+ * Fix calculation of branch coverage when a class has no branches
8
+ [Julian Krumow](https://github.com/tarbrain)
9
+ [#40](https://github.com/venmo/slather/pull/40)
10
+
11
+ * Always consider empty files as 100% tested
12
+ [Boris Bügling](https://github.com/neonichu)
13
+ [#45](https://github.com/venmo/slather/pull/45)
14
+
15
+ ## v1.5.2
6
16
 
7
17
  * Add an option to define the output directory for cobertura xml reports
8
18
  [Julian Krumow](https://github.com/tarbrain)
data/README.md CHANGED
@@ -14,6 +14,8 @@ Generate test coverage reports for Xcode projects & hook it into CI.
14
14
  | [Parsimmon](https://github.com/ayanonagon/Parsimmon) | [![Parsimmon Coverage](https://coveralls.io/repos/ayanonagon/Parsimmon/badge.png?branch=master)](https://coveralls.io/r/ayanonagon/Parsimmon?branch=master) |
15
15
  | [VENCore](https://github.com/venmo/VENCore) | [![VENCore Coverage](https://coveralls.io/repos/venmo/VENCore/badge.png?branch=master)](https://coveralls.io/r/venmo/VENCore?branch=master) |
16
16
  | [CGFloatType](https://github.com/kylef/CGFloatType) | [![CGFloatType Coverage](https://coveralls.io/repos/kylef/CGFloatType/badge.png?branch=master)](https://coveralls.io/r/kylef/CGFloatType?branch=master) |
17
+ | [DAZABTest](https://github.com/dasmer/DAZABTest) | [![DAZABTest Coverage](https://coveralls.io/repos/dasmer/DAZABTest/badge.png?branch=master)](https://coveralls.io/r/dasmer/DAZABTest?branch=master) |
18
+ | [TBStateMachine](https://github.com/tarbrain/TBStateMachine) | [![TBStateMachine Coverage](https://coveralls.io/repos/tarbrain/TBStateMachine/badge.png?branch=master)](https://coveralls.io/r/tarbrain/TBStateMachine?branch=master) |
17
19
 
18
20
  ## Installation
19
21
 
@@ -102,7 +102,11 @@ module Slather
102
102
  end
103
103
 
104
104
  def percentage_lines_tested
105
- rate_lines_tested * 100
105
+ if num_lines_testable == 0
106
+ 100
107
+ else
108
+ rate_lines_tested * 100
109
+ end
106
110
  end
107
111
 
108
112
  def branch_coverage_data
@@ -38,9 +38,10 @@ module Slather
38
38
  def create_xml_report(coverage_files)
39
39
  total_project_lines = 0
40
40
  total_project_lines_tested = 0
41
- total_project_line_rate = 0.0
41
+ total_project_line_rate = '%.16f' % 1.0
42
42
  total_project_branches = 0
43
43
  total_project_branches_tested = 0
44
+ total_project_branch_rate = '%.16f' % 1.0
44
45
 
45
46
  create_empty_xml_report
46
47
  coverage_node = @doc.root
@@ -58,9 +59,10 @@ module Slather
58
59
 
59
60
  total_package_lines = 0
60
61
  total_package_lines_tested = 0
61
- total_package_lines_rate = 0.0
62
+ total_package_lines_rate = '%.16f' % 1.0
62
63
  total_package_branches = 0
63
64
  total_package_branches_tested = 0
65
+ total_package_branch_rate = '%.16f' % 1.0
64
66
 
65
67
  package_coverage_files.each do |package_coverage_file|
66
68
  class_node = create_class_node(package_coverage_file)
@@ -71,8 +73,13 @@ module Slather
71
73
  total_package_branches_tested += package_coverage_file.num_branches_tested
72
74
  end
73
75
 
74
- total_package_line_rate = '%.16f' % (total_package_lines_tested / total_package_lines.to_f)
75
- total_package_branch_rate = '%.16f' % (total_package_branches_tested / total_package_branches.to_f)
76
+ if (total_package_lines > 0)
77
+ total_package_line_rate = '%.16f' % (total_package_lines_tested / total_package_lines.to_f)
78
+ end
79
+
80
+ if (total_package_branches > 0)
81
+ total_package_branch_rate = '%.16f' % (total_package_branches_tested / total_package_branches.to_f)
82
+ end
76
83
 
77
84
  package_node['line-rate'] = total_package_line_rate
78
85
  package_node['branch-rate'] = total_package_branch_rate
@@ -84,8 +91,13 @@ module Slather
84
91
  total_project_branches_tested += total_package_branches_tested
85
92
  end
86
93
 
87
- total_project_line_rate = '%.16f' % (total_project_lines_tested / total_project_lines.to_f)
88
- total_project_branch_rate = '%.16f' % (total_project_branches_tested / total_project_branches.to_f)
94
+ if (total_project_lines > 0)
95
+ total_project_line_rate = '%.16f' % (total_project_lines_tested / total_project_lines.to_f)
96
+ end
97
+
98
+ if (total_project_branches > 0)
99
+ total_project_branch_rate = '%.16f' % (total_project_branches_tested / total_project_branches.to_f)
100
+ end
89
101
 
90
102
  coverage_node['line-rate'] = total_project_line_rate
91
103
  coverage_node['branch-rate'] = total_project_branch_rate
@@ -106,8 +118,9 @@ module Slather
106
118
  class_node = Nokogiri::XML::Node.new "class", @doc
107
119
  class_node['name'] = filename
108
120
  class_node['filename'] = filepath
109
- class_node['line-rate'] = '%.16f' % coverage_file.rate_lines_tested
110
- class_node['branch-rate'] = '1.0'
121
+ class_node['line-rate'] = '%.16f' % [(coverage_file.num_lines_testable > 0) ? coverage_file.rate_lines_tested : 1.0]
122
+ class_node['branch-rate'] = '%.16f' % [(coverage_file.num_branches_testable > 0) ? coverage_file.rate_branches_tested : 1.0]
123
+ class_node['complexity'] = '0.0'
111
124
 
112
125
  methods_node = Nokogiri::XML::Node.new "methods", @doc
113
126
  methods_node.parent = class_node
@@ -117,13 +130,10 @@ module Slather
117
130
  coverage_file.cleaned_gcov_data.split("\n").each do |line|
118
131
  line_segments = line.split(':')
119
132
  if coverage_file.coverage_for_line(line)
120
- line_number = line_segments[1].strip.to_i
121
133
  line_node = create_line_node(line, coverage_file)
122
134
  line_node.parent = lines_node
123
135
  end
124
136
  end
125
- class_node['branch-rate'] = '%.16f' % [coverage_file.rate_branches_tested]
126
- class_node['complexity'] = '0.0'
127
137
  class_node
128
138
  end
129
139
 
@@ -1,3 +1,3 @@
1
1
  module Slather
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
@@ -48,7 +48,7 @@
48
48
  <line number="43" branch="false" hits="2"/>
49
49
  </lines>
50
50
  </class>
51
- <class name="Empty" filename="spec/fixtures/fixtures/more_files/Empty.m" line-rate="0.0000000000000000" branch-rate="0.0000000000000000" complexity="0.0">
51
+ <class name="Empty" filename="spec/fixtures/fixtures/more_files/Empty.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
52
52
  <methods/>
53
53
  <lines/>
54
54
  </class>
@@ -69,9 +69,9 @@
69
69
  </class>
70
70
  </classes>
71
71
  </package>
72
- <package name="spec.fixtures.fixtures" line-rate="0.5000000000000000" branch-rate="NaN" complexity="0.0">
72
+ <package name="spec.fixtures.fixtures" line-rate="0.5000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
73
73
  <classes>
74
- <class name="fixtures" filename="spec/fixtures/fixtures/fixtures.m" line-rate="0.5000000000000000" branch-rate="0.0000000000000000" complexity="0.0">
74
+ <class name="fixtures" filename="spec/fixtures/fixtures/fixtures.m" line-rate="0.5000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
75
75
  <methods/>
76
76
  <lines>
77
77
  <line number="15" branch="false" hits="1"/>
@@ -84,7 +84,7 @@
84
84
  </package>
85
85
  <package name="spec.fixtures.fixturesTests" line-rate="1.0000000000000000" branch-rate="0.0333333333333333" complexity="0.0">
86
86
  <classes>
87
- <class name="BranchesTests" filename="spec/fixtures/fixturesTests/BranchesTests.m" line-rate="1.0000000000000000" branch-rate="0.0000000000000000" complexity="0.0">
87
+ <class name="BranchesTests" filename="spec/fixtures/fixturesTests/BranchesTests.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
88
88
  <methods/>
89
89
  <lines>
90
90
  <line number="19" branch="false" hits="2"/>
@@ -99,7 +99,7 @@
99
99
  <line number="36" branch="false" hits="1"/>
100
100
  </lines>
101
101
  </class>
102
- <class name="fixturesTests" filename="spec/fixtures/fixturesTests/fixturesTests.m" line-rate="1.0000000000000000" branch-rate="0.0000000000000000" complexity="0.0">
102
+ <class name="fixturesTests" filename="spec/fixtures/fixturesTests/fixturesTests.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
103
103
  <methods/>
104
104
  <lines>
105
105
  <line number="20" branch="false" hits="1"/>
@@ -144,9 +144,9 @@ OBJC
144
144
  expect(line_coverage_file.percentage_lines_tested).to eq(50)
145
145
  end
146
146
 
147
- it "should return 0" do
147
+ it "should return 100 if no testable lines" do
148
148
  line_coverage_file.stub(:num_lines_testable).and_return(0)
149
- expect(line_coverage_file.percentage_lines_tested).to eq(0)
149
+ expect(line_coverage_file.percentage_lines_tested).to eq(100)
150
150
  end
151
151
  end
152
152
  end
@@ -18,7 +18,7 @@ describe Slather::CoverageService::SimpleOutput do
18
18
  ["spec/fixtures/fixtures/fixtures.m: 2 of 4 lines (50.00%)",
19
19
  "spec/fixtures/fixtures/more_files/peekaview.m: 0 of 6 lines (0.00%)",
20
20
  "spec/fixtures/fixtures/more_files/Branches.m: 10 of 20 lines (50.00%)",
21
- "spec/fixtures/fixtures/more_files/Empty.m: 0 of 0 lines (0.00%)",
21
+ "spec/fixtures/fixtures/more_files/Empty.m: 0 of 0 lines (100.00%)",
22
22
  "spec/fixtures/fixturesTests/fixturesTests.m: 7 of 7 lines (100.00%)",
23
23
  "spec/fixtures/fixturesTests/peekaviewTests.m: 6 of 6 lines (100.00%)",
24
24
  "spec/fixtures/fixturesTests/BranchesTests.m: 10 of 10 lines (100.00%)",
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slather
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-25 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.9'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.9'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: cocoapods
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.34'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.34'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: json_spec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.1.4
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.1.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: clamp
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0.6'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.6'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: xcodeproj
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.20.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.20.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: nokogiri
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
145
  version: 1.6.3
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.6.3
153
153
  description:
@@ -158,9 +158,9 @@ executables:
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - ".coveralls.yml"
162
- - ".gitignore"
163
- - ".travis.yml"
161
+ - .coveralls.yml
162
+ - .gitignore
163
+ - .travis.yml
164
164
  - CHANGELOG.md
165
165
  - Gemfile
166
166
  - LICENSE.txt
@@ -217,17 +217,17 @@ require_paths:
217
217
  - lib
218
218
  required_ruby_version: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - ">="
220
+ - - '>='
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - ">="
225
+ - - '>='
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
229
  rubyforge_project:
230
- rubygems_version: 2.2.2
230
+ rubygems_version: 2.0.14
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: Test coverage reports for Xcode projects