danger-cobertura 1.1.1 → 1.2.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
  SHA256:
3
- metadata.gz: e3ff63ef742d2bc473a7cca55d308042faca87e9c66a7b42b5f3f4734680d810
4
- data.tar.gz: 6a249a2d6cce7d0c24579a7c252042fa534b48ac734de85c9e197ab14b07d97f
3
+ metadata.gz: 1e6fa67d8f8fec2cba6c8e40ad5439c24e65f9809b5318a599730a67d5ff09a2
4
+ data.tar.gz: 3654409caf400866f143fc18fb8f0eb45c185c7b50831e3d624963601baee55d
5
5
  SHA512:
6
- metadata.gz: 4920c92d8d897fbccb6e63e7e3c7c00c3d9fd05363274b09bd88109aa73366d1b31cec9e5575958a363489516accb9b55cf679cbd2afda610d04f6a66fc61fec
7
- data.tar.gz: 2f8181ddee4563eba773c686cd3741c4c12320493e67be51f06e93ad3d3060d37e57159c83ccf527b0aa35c38549d9e92cb87a42f324841afef985f65beee9f5
6
+ metadata.gz: 93123d1eaa127811dfa0546fa2d81ddc03e1ea65f69e69addbce48e90f8ef7d911cc869107fc35023945ad8ed79a0d4e0fbea5b3ddeb8d84a0f61be5136e6300
7
+ data.tar.gz: 99ce509910af575ceeb1ad729aa1ff145e03de7dea945a1c50aa570db1cce3ba083851a15f25fb4aaf7b80b2b38243584e6fd80e7feb1b0e8f62b7237cb3e31a
data/.codeclimate.yml CHANGED
@@ -1,5 +1,11 @@
1
+ version: "2" # required to adjust maintainability checks
2
+ checks:
3
+ method-complexity:
4
+ config:
5
+ threshold: 10
6
+
1
7
  plugins:
2
8
  rubocop:
3
9
  enabled: true
4
10
  config:
5
- file: .rubocop.yml
11
+ file: .rubocop.yml
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ pkg
5
5
  Gemfile.lock
6
6
  .vscode
7
7
  coverage
8
+ rubocop-result.json
data/.rubocop.yml CHANGED
@@ -127,7 +127,7 @@ Metrics/BlockLength:
127
127
  Style/MixinGrouping:
128
128
  Enabled: false
129
129
 
130
- Style/FileName:
130
+ Naming/FileName:
131
131
  Enabled: false
132
132
 
133
133
  Layout/IndentHeredoc:
data/.travis.yml CHANGED
@@ -10,6 +10,12 @@ rvm:
10
10
  - 2.4
11
11
  - 2.5
12
12
 
13
+ addons:
14
+ sonarcloud:
15
+ organization: "kyaak-github"
16
+ token:
17
+ secure: "d6/AIadHOG36lKQYJBJLRH1Ghv34RQchjRGJ4aNW5GaFMpQVrS/Yy7jb3hf4On/Mvqmsi3x+EwJt2R5V82t8WaHBvl8F/wdxn4uRpJC9WDiNVLnFl2vcDLDZvATVT8oG4ewN+uEKuBuQN1U1nUAUR5QIE8sNxl0sGOpGpanpmT+LclPqyBc67KhfstLRyW8miKo0lw0aYdAKuN7Ib9yuR+jkVB6/Ua7KdgfZAgbpijU3OsmwagIGM77BD3LiMrbe6G3Lsv3y8x+qLfaO9SJXaQt5lYWOxAfg1fJPjtEbtkkCGlnim7IOZsg2uZ22dlCYvVq4eHtuOdmSEDb8DnpVGpQ51CqMtS2Wm4G+xYTr49Lvr+n9YjgF7TbgqEa/PUD7IHHanw7cDsJFLS4jcBR+5wTDpZT6WHQGBMaIrVo+oFOA5GPQ9IN1byoafY+xk3D+G08yUPxE1RT00H2YEq+UkdIXKZKCekM+Yir8+0sOE1GRlGfWefu8SSq4kvvfDmvLFow3tkjiJbR99BNf8xP9fc2HOhGc0jdOETDl2gtlyq7HPfPpqALkhdUFspW+iiFhNu0XgBip5vAltN38SmPWTc4e9jBlO6wNnC32O0TKt5AJCYuI1B9gAEuiuDARx8/TQjtClHUxH0smAzqmpfOTa/KEz0GV5kJc2bDadBzeYBc="
18
+
13
19
  env:
14
20
  global:
15
21
  - CC_TEST_REPORTER_ID=7cfcaf05ab26fd0e7088ab0b16e902559a6d0c0c6f6785fa908e20efeba53c64
@@ -21,10 +27,11 @@ before_script:
21
27
 
22
28
  script:
23
29
  - bundle exec rake spec
30
+ - sonar-scanner
24
31
 
25
32
  after_script:
26
33
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
27
-
34
+
28
35
  deploy:
29
36
  provider: rubygems
30
37
  api_key:
@@ -32,3 +39,4 @@ deploy:
32
39
  gem: danger-cobertura
33
40
  on:
34
41
  branch: master
42
+ rvm: 2.5
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.2.0] - 2019-01-21
10
+ ### Changed
11
+ - `filename_prefix` will be checked by adding the prefix to the _git_ and the _issue_ filename [Issue](https://github.com/Kyaak/danger-cobertura/issues/6)
12
+
9
13
  ## [1.1.1] - 2018-11-28
10
14
  ### Fixed
11
15
  - Add * wildcard to have parameters in `show_coverage` due to `danger local` bug [Issue](https://github.com/danger/danger/issues/1041)
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/danger-cobertura.svg)](https://badge.fury.io/rb/danger-cobertura)
2
+ [![Gem](https://img.shields.io/gem/dt/danger-cobertura.svg)](https://rubygems.org/gems/danger-cobertura)
3
+ [![Inline docs](http://inch-ci.org/github/Kyaak/danger-cobertura.svg?branch=master)](http://inch-ci.org/github/Kyaak/danger-cobertura)
2
4
  [![Build Status](https://travis-ci.org/Kyaak/danger-cobertura.svg?branch=master)](https://travis-ci.org/Kyaak/danger-cobertura)
3
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/2e657e2a49ddf9696ece/maintainability)](https://codeclimate.com/github/Kyaak/danger-cobertura/maintainability)
4
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/2e657e2a49ddf9696ece/test_coverage)](https://codeclimate.com/github/Kyaak/danger-cobertura/test_coverage)
5
- [![Inline docs](http://inch-ci.org/github/Kyaak/danger-cobertura.svg?branch=master)](http://inch-ci.org/github/Kyaak/danger-cobertura)
6
- [![Gem](https://img.shields.io/gem/dt/danger-cobertura.svg)](https://rubygems.org/gems/danger-cobertura)
7
+ [![Sonarcloud Maintainability](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
8
+ [![Sonarcloud Reliability](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
9
+ [![Sonarcloud Security](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=security_rating)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
10
+ [![Sonarcloud Coverage](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=coverage)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
7
11
 
8
12
  # danger-cobertura
9
13
 
@@ -102,7 +106,7 @@ __`report`__ - Path to the cobertura xml report, e.g. `build/reports/coverage.xm
102
106
 
103
107
  __`additional_headers`__ - Array of symbols to include in the coverage report. Available options are `:line`, `:branch`
104
108
 
105
- __`filename_prefix`__ - Path prefix to be added to the cobertura class filename attribute. e.g. `src/main/java`
109
+ __`filename_prefix`__ - Path prefix to be added to both, the cobertura issue filename and the git filename attribute. e.g. `src/main/java`, `/Users/buid/workspace/project`
106
110
 
107
111
  ## Methods
108
112
 
data/Rakefile CHANGED
@@ -17,6 +17,9 @@ end
17
17
  desc "Run RuboCop on the lib/specs directory"
18
18
  RuboCop::RakeTask.new(:rubocop) do |task|
19
19
  task.patterns = %w(lib/**/*.rb spec/**/*.rb)
20
+ task.fail_on_error = false
21
+ task.formatters = %w(json)
22
+ task.options = %w(--out rubocop-result.json)
20
23
  end
21
24
 
22
25
  desc "Ensure that the plugin passes `danger plugins lint`"
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency "oga", "~> 2.15"
26
26
 
27
27
  # General ruby development
28
- spec.add_development_dependency "bundler", "~> 1.3"
28
+ spec.add_development_dependency "bundler", ">= 1.3"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
 
31
31
  # Testing support
@@ -1,3 +1,3 @@
1
1
  module Cobertura
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "1.2.0".freeze
3
3
  end
@@ -122,7 +122,7 @@ module Danger
122
122
  # @return [Array<CoverageItem>] Filtered array of items
123
123
  def filtered_items
124
124
  @filtered_items ||= coverage_items.select do |item|
125
- target_files.include?(item_filename(item)) && !item.name.include?("$")
125
+ (include_item_prefix?(item) || include_target_prefix?(item)) && !item.name.include?("$")
126
126
  end
127
127
  end
128
128
 
@@ -130,13 +130,35 @@ module Danger
130
130
  #
131
131
  # @param item [CoverageItem] Coverage item to create the full filename.
132
132
  # @return [String] Combined filename.
133
- def item_filename(item)
134
- result = "".dup
133
+ def include_item_prefix?(item)
134
+ prefixed = "".dup
135
135
  if filename_prefix
136
- result << filename_prefix
137
- result << "/" unless filename_prefix.chars.last == "/"
136
+ prefixed << filename_prefix
137
+ prefixed << "/" unless filename_prefix.chars.last == "/"
138
138
  end
139
- result << item.filename
139
+ prefixed << item.filename
140
+
141
+ result = false
142
+ target_files.each do |target_file|
143
+ result = target_file.eql?(prefixed)
144
+ break if result
145
+ end
146
+ result
147
+ end
148
+
149
+ def include_target_prefix?(item)
150
+ result = false
151
+ target_files.each do |target_file|
152
+ prefixed = "".dup
153
+ if filename_prefix
154
+ prefixed << filename_prefix
155
+ prefixed << "/" unless filename_prefix.chars.last == "/"
156
+ end
157
+ prefixed << target_file
158
+ result = prefixed.eql?(item.filename)
159
+ break if result
160
+ end
161
+ result
140
162
  end
141
163
 
142
164
  # A getter for current modified and added files.
@@ -0,0 +1,9 @@
1
+ sonar.projectKey=Kyaak_danger-cobertura
2
+ sonar.sources=lib
3
+ sonar.tests=spec
4
+
5
+ sonar.ruby.file.suffixes=rb,ruby
6
+ sonar.ruby.coverage.reportPath=coverage/.resultset.json
7
+ sonar.ruby.coverage.framework=RSpec
8
+ sonar.ruby.rubocopConfig=.rubocop.yml
9
+ sonar.ruby.rubocop.reportPath=rubocop-result.json
@@ -271,6 +271,41 @@
271
271
  <line hits="1" number="83"/>
272
272
  </lines>
273
273
  </class>
274
+ <class branch-rate="0.75" complexity="0" filename="my_prefix_dir/sub_folder/sub_two.py" line-rate="0.9333" name="sub_two.py">
275
+ <methods/>
276
+ <lines>
277
+ <line hits="1" number="13"/>
278
+ <line hits="1" number="14"/>
279
+ <line hits="1" number="17"/>
280
+ <line hits="1" number="22"/>
281
+ <line hits="1" number="23"/>
282
+ <line hits="1" number="24"/>
283
+ <line hits="1" number="25"/>
284
+ <line hits="1" number="26"/>
285
+ <line hits="1" number="27"/>
286
+ <line hits="1" number="28"/>
287
+ <line hits="1" number="30"/>
288
+ <line hits="1" number="35"/>
289
+ <line hits="1" number="37"/>
290
+ <line hits="1" number="42"/>
291
+ <line hits="1" number="44"/>
292
+ <line hits="0" number="49"/>
293
+ <line hits="1" number="51"/>
294
+ <line hits="1" number="56"/>
295
+ <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="58" number="57"/>
296
+ <line hits="0" number="58"/>
297
+ <line hits="1" number="59"/>
298
+ <line hits="1" number="61"/>
299
+ <line hits="1" number="66"/>
300
+ <line hits="1" number="68"/>
301
+ <line hits="1" number="73"/>
302
+ <line branch="true" condition-coverage="100% (2/2)" hits="1" number="74"/>
303
+ <line hits="1" number="75"/>
304
+ <line hits="1" number="76"/>
305
+ <line hits="1" number="78"/>
306
+ <line hits="1" number="83"/>
307
+ </lines>
308
+ </class>
274
309
  <class branch-rate="0" complexity="0" filename="sub_folder/sub_three.py" line-rate="0" name="sub_three.py">
275
310
  <methods/>
276
311
  <lines>
@@ -8,6 +8,13 @@ module Danger
8
8
  expect(Danger::DangerCobertura.new(nil)).to be_a Danger::Plugin
9
9
  end
10
10
 
11
+ SUB_ONE = %w(sub_folder/sub_one.py).freeze
12
+ SUB_TWO = %w(sub_folder/sub_two.py).freeze
13
+ SUB_THREE = %w(sub_folder/sub_three.py).freeze
14
+ SUB_TWO_WARNING = "sub_two.py has less than 90.0% coverage".freeze
15
+ PREFIX = "my_prefix_dir".freeze
16
+ PREFIX_TWO = %w(my_prefix_dir/sub_folder/sub_two.py).freeze
17
+
11
18
  describe "with Dangerfile" do
12
19
  before do
13
20
  @dangerfile = testing_dangerfile
@@ -17,6 +24,12 @@ module Danger
17
24
  @dangerfile.git.stubs(:added_files).returns([])
18
25
  end
19
26
 
27
+ it "test" do
28
+ @dangerfile.git.stubs(:modified_files).returns(["Filmustage.DataApi/Filmustage.DataApi/DataAccess/Location.cs"])
29
+ @my_plugin.filename_prefix = "/Users/Martin/Desktop/filmustage-dataapi"
30
+ @my_plugin.show_coverage
31
+ end
32
+
20
33
  describe "warn_if_file_less_than" do
21
34
  it "raises error if file attribute is nil" do
22
35
  @my_plugin.report = nil
@@ -43,70 +56,76 @@ module Danger
43
56
  @dangerfile.git.stubs(:modified_files).returns(%w(sub_folder/sub_two.py top_level_one.py))
44
57
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
45
58
 
46
- expect(@dangerfile.status_report[:warnings]).to include("sub_two.py has less than 90.0% coverage")
59
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
47
60
  expect(@dangerfile.status_report[:warnings]).not_to include("top_level_one.py has less than 90.0% coverage")
48
61
  end
49
62
 
50
63
  it "does not add warn if coverage not" do
51
- @dangerfile.git.stubs(:modified_files).returns(["sub_folder/sub_two.py"])
64
+ @dangerfile.git.stubs(:modified_files).returns(SUB_TWO)
52
65
  @my_plugin.warn_if_file_less_than(percentage: 10.0)
53
66
 
54
67
  expect(@dangerfile.status_report[:warnings]).to be_empty
55
68
  end
56
69
 
57
70
  it "adds warn for modified files" do
58
- @dangerfile.git.stubs(:modified_files).returns(%w(sub_folder/sub_two.py))
71
+ @dangerfile.git.stubs(:modified_files).returns(SUB_TWO)
59
72
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
60
73
 
61
- expect(@dangerfile.status_report[:warnings]).to include("sub_two.py has less than 90.0% coverage")
74
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
62
75
  end
63
76
 
64
77
  it "adds warn for added files" do
65
- @dangerfile.git.stubs(:added_files).returns(%w(sub_folder/sub_two.py))
78
+ @dangerfile.git.stubs(:added_files).returns(SUB_TWO)
66
79
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
67
80
 
68
- expect(@dangerfile.status_report[:warnings]).to include("sub_two.py has less than 90.0% coverage")
81
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
69
82
  end
70
83
 
71
84
  it "adds warn for added and modified files" do
72
- @dangerfile.git.stubs(:added_files).returns(%w(sub_folder/sub_two.py))
73
- @dangerfile.git.stubs(:modified_files).returns(%w(sub_folder/sub_one.py))
85
+ @dangerfile.git.stubs(:added_files).returns(SUB_TWO)
86
+ @dangerfile.git.stubs(:modified_files).returns(SUB_ONE)
74
87
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
75
88
 
76
- expect(@dangerfile.status_report[:warnings]).to include("sub_two.py has less than 90.0% coverage")
89
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
77
90
  expect(@dangerfile.status_report[:warnings]).to include("sub_one.py has less than 90.0% coverage")
78
91
  end
79
92
 
80
93
  it "does not add if filename missing prefix" do
81
94
  # sub_folder/sub_two.py in xml
82
- @dangerfile.git.stubs(:added_files).returns(%w(my_prefix_dir/sub_folder/sub_two.py))
95
+ @dangerfile.git.stubs(:added_files).returns(%w(not_including/sub_folder/sub_two.py))
83
96
  expect(@my_plugin.filename_prefix).to be_nil
84
97
 
85
98
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
86
99
 
87
- expect(@dangerfile.status_report[:warnings]).not_to include("sub_two.py has less than 90.0% coverage")
100
+ expect(@dangerfile.status_report[:warnings]).not_to include(SUB_TWO_WARNING)
88
101
  end
89
102
 
90
- it "does add if filename prefix set" do
91
- # sub_folder/sub_two.py in xml
92
- @dangerfile.git.stubs(:added_files).returns(%w(my_prefix_dir/sub_folder/sub_two.py))
93
- @my_plugin.filename_prefix = "my_prefix_dir"
103
+ it "does add if issue filename prefix set" do
104
+ @dangerfile.git.stubs(:added_files).returns(PREFIX_TWO)
105
+ @my_plugin.filename_prefix = PREFIX
94
106
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
95
107
 
96
- expect(@dangerfile.status_report[:warnings]).to include("sub_two.py has less than 90.0% coverage")
108
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
109
+ end
110
+
111
+ it "does add if git filename prefix set" do
112
+ @dangerfile.git.stubs(:added_files).returns(SUB_TWO)
113
+ @my_plugin.filename_prefix = PREFIX
114
+ @my_plugin.warn_if_file_less_than(percentage: 90.0)
115
+
116
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
97
117
  end
98
118
 
99
119
  it "ignores filename prefix slash" do
100
- # sub_folder/sub_two.py in xml
101
- @dangerfile.git.stubs(:added_files).returns(%w(my_prefix_dir/sub_folder/sub_two.py))
102
- @my_plugin.filename_prefix = "my_prefix_dir/"
120
+ @dangerfile.git.stubs(:added_files).returns(PREFIX_TWO)
121
+ @my_plugin.filename_prefix = "#{PREFIX}/"
103
122
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
104
123
 
105
- expect(@dangerfile.status_report[:warnings]).to include("sub_two.py has less than 90.0% coverage")
124
+ expect(@dangerfile.status_report[:warnings]).to include(SUB_TWO_WARNING)
106
125
  end
107
126
 
108
127
  it "should not add name with $" do
109
- @dangerfile.git.stubs(:added_files).returns(%w(sub_folder/sub_three.py))
128
+ @dangerfile.git.stubs(:added_files).returns(SUB_THREE)
110
129
  @my_plugin.warn_if_file_less_than(percentage: 90.0)
111
130
 
112
131
  expect(@dangerfile.status_report[:warnings]).to include("sub_three.py has less than 90.0% coverage")
@@ -137,29 +156,29 @@ module Danger
137
156
  end
138
157
 
139
158
  it "adds coverage for modified files" do
140
- @dangerfile.git.stubs(:modified_files).returns(%w(sub_folder/sub_two.py))
159
+ @dangerfile.git.stubs(:modified_files).returns(SUB_TWO)
141
160
  @my_plugin.show_coverage
142
161
 
143
162
  expect(@dangerfile.status_report[:markdowns]).not_to be_empty
144
163
  end
145
164
 
146
165
  it "adds coverage for added files" do
147
- @dangerfile.git.stubs(:added_files).returns(%w(sub_folder/sub_two.py))
166
+ @dangerfile.git.stubs(:added_files).returns(SUB_TWO)
148
167
  @my_plugin.show_coverage
149
168
 
150
169
  expect(@dangerfile.status_report[:markdowns]).not_to be_empty
151
170
  end
152
171
 
153
172
  it "adds coverage for added and modified files" do
154
- @dangerfile.git.stubs(:added_files).returns(%w(sub_folder/sub_two.py))
155
- @dangerfile.git.stubs(:modified_files).returns(%w(sub_folder/sub_one.py))
173
+ @dangerfile.git.stubs(:added_files).returns(SUB_TWO)
174
+ @dangerfile.git.stubs(:modified_files).returns(SUB_ONE)
156
175
  @my_plugin.show_coverage
157
176
 
158
177
  expect(@dangerfile.status_report[:markdowns]).not_to be_empty
159
178
  end
160
179
 
161
180
  it "default does not add branch and line" do
162
- @dangerfile.git.stubs(:modified_files).returns(["sub_folder/sub_three.py"])
181
+ @dangerfile.git.stubs(:modified_files).returns(SUB_THREE)
163
182
  @my_plugin.show_coverage
164
183
 
165
184
  expect(@dangerfile.status_report[:markdowns][0].message).to include("File")
@@ -172,7 +191,7 @@ module Danger
172
191
  end
173
192
 
174
193
  it "additional_header line adds line rate" do
175
- @dangerfile.git.stubs(:modified_files).returns(["sub_folder/sub_three.py"])
194
+ @dangerfile.git.stubs(:modified_files).returns(SUB_THREE)
176
195
  @my_plugin.additional_headers = [:line]
177
196
  @my_plugin.show_coverage
178
197
 
@@ -186,7 +205,7 @@ module Danger
186
205
  end
187
206
 
188
207
  it "additional_header branch adds branch rate" do
189
- @dangerfile.git.stubs(:modified_files).returns(["sub_folder/sub_three.py"])
208
+ @dangerfile.git.stubs(:modified_files).returns(SUB_THREE)
190
209
  @my_plugin.additional_headers = [:branch]
191
210
  @my_plugin.show_coverage
192
211
 
@@ -200,7 +219,7 @@ module Danger
200
219
  end
201
220
 
202
221
  it "additional_header line and branch adds rate" do
203
- @dangerfile.git.stubs(:modified_files).returns(["sub_folder/sub_three.py"])
222
+ @dangerfile.git.stubs(:modified_files).returns(SUB_THREE)
204
223
  @my_plugin.additional_headers = %i(branch line)
205
224
  @my_plugin.show_coverage
206
225
 
@@ -213,8 +232,7 @@ module Danger
213
232
  end
214
233
 
215
234
  it "does not show coverage if filename prefix missing" do
216
- # sub_folder/sub_two.py in xml
217
- @dangerfile.git.stubs(:added_files).returns(%w(my_prefix_dir/sub_folder/sub_two.py))
235
+ @dangerfile.git.stubs(:added_files).returns(%w(not_including/sub_folder/sub_two.py))
218
236
  expect(@my_plugin.filename_prefix).to be_nil
219
237
 
220
238
  @my_plugin.show_coverage
@@ -222,19 +240,25 @@ module Danger
222
240
  expect(@dangerfile.status_report[:markdowns]).to be_empty
223
241
  end
224
242
 
225
- it "does show coverage if filename prefix matches" do
226
- # sub_folder/sub_two.py in xml
227
- @dangerfile.git.stubs(:added_files).returns(%w(my_prefix_dir/sub_folder/sub_two.py))
228
- @my_plugin.filename_prefix = "my_prefix_dir"
243
+ it "does show coverage if issue filename prefix matches" do
244
+ @dangerfile.git.stubs(:added_files).returns(PREFIX_TWO)
245
+ @my_plugin.filename_prefix = PREFIX
246
+ @my_plugin.show_coverage
247
+
248
+ expect(@dangerfile.status_report[:markdowns]).not_to be_empty
249
+ end
250
+
251
+ it "does show coverage if git filename prefix matches" do
252
+ @dangerfile.git.stubs(:added_files).returns(SUB_TWO)
253
+ @my_plugin.filename_prefix = PREFIX
229
254
  @my_plugin.show_coverage
230
255
 
231
256
  expect(@dangerfile.status_report[:markdowns]).not_to be_empty
232
257
  end
233
258
 
234
259
  it "ignores filename prefix slash" do
235
- # sub_folder/sub_two.py in xml
236
- @dangerfile.git.stubs(:added_files).returns(%w(my_prefix_dir/sub_folder/sub_two.py))
237
- @my_plugin.filename_prefix = "my_prefix_dir/"
260
+ @dangerfile.git.stubs(:added_files).returns(PREFIX_TWO)
261
+ @my_plugin.filename_prefix = "#{PREFIX}/"
238
262
  @my_plugin.show_coverage
239
263
 
240
264
  expect(@dangerfile.status_report[:markdowns]).not_to be_empty
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-cobertura
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyaak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2019-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.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: '1.3'
55
55
  - !ruby/object:Gem::Dependency
@@ -229,6 +229,7 @@ files:
229
229
  - lib/cobertura/plugin.rb
230
230
  - lib/danger_cobertura.rb
231
231
  - lib/danger_plugin.rb
232
+ - sonar-project.properties
232
233
  - spec/assets/coverage.xml
233
234
  - spec/cobertura_spec.rb
234
235
  - spec/helper/cobertura_helper.rb
@@ -252,8 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
253
  - !ruby/object:Gem::Version
253
254
  version: '0'
254
255
  requirements: []
255
- rubyforge_project:
256
- rubygems_version: 2.7.8
256
+ rubygems_version: 3.0.2
257
257
  signing_key:
258
258
  specification_version: 4
259
259
  summary: This plugin allows parsing of an xml coverage report generated by cobertura