danger-code_coverage 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/danger-code_coverage.gemspec +1 -1
- data/lib/code_coverage/gem_version.rb +1 -1
- data/lib/code_coverage/plugin.rb +3 -2
- data/spec/code_coverage_spec.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f951b48390fd47e430b9454eeb47ed4194162c4d18b4fe1754ba9e808e38c271
|
4
|
+
data.tar.gz: b542a4473db470c8d08560d8d8975fbfd434ec96868031283241cdd43653f064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de0610354f92718bcd63a2f97f8dafefd017d0ffb5d4620608ae1ddced52aaffcca0156eae6c12e94dfa2a6c99200cae87945a1f5f95dfc6b8af7d02b54dfedc
|
7
|
+
data.tar.gz: 000ad24ce437e14e9db515e923c64312cc73ff9e34b0d7bd79e8c24753cfa207c06fbfd23451df073c3a731efcc99a188c62a50769c8e53cd83b36b2af4c8472
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.0.2] - 2019-6-22
|
8
|
+
### Changed
|
9
|
+
- Search for files in subdirectories
|
10
|
+
|
7
11
|
## [0.0.1] - 2019-6-22
|
8
12
|
### Added
|
9
13
|
- Initial project
|
@@ -7,7 +7,7 @@ require('code_coverage/gem_version.rb')
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'danger-code_coverage'
|
9
9
|
spec.version = CodeCoverage::VERSION
|
10
|
-
spec.authors = ['
|
10
|
+
spec.authors = ['Kyaak']
|
11
11
|
spec.email = ['kyaak.dev@gmail.com']
|
12
12
|
spec.description = 'Danger plugin for Jenkins-Code-Coverage-Api plugin.'
|
13
13
|
spec.summary = 'Read Jenkins code-coverage reports and comment pull request with coverage for changed files.'
|
data/lib/code_coverage/plugin.rb
CHANGED
@@ -54,7 +54,7 @@ module Danger
|
|
54
54
|
items = coverage_items
|
55
55
|
items.select! { |item| file_in_changeset?(item.file) }
|
56
56
|
items.each(&method(:update_item))
|
57
|
-
items.sort_by!{|item| -item.total}
|
57
|
+
items.sort_by! { |item| -item.total }
|
58
58
|
items.each(&method(:add_entry))
|
59
59
|
|
60
60
|
return if @table.size.zero?
|
@@ -134,7 +134,8 @@ module Danger
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def file_in_changeset?(file)
|
137
|
-
target_files.
|
137
|
+
result = target_files.select { |value| value =~ %r{.*#{file}} }
|
138
|
+
!result.empty?
|
138
139
|
end
|
139
140
|
|
140
141
|
def target_files
|
data/spec/code_coverage_spec.rb
CHANGED
@@ -14,6 +14,7 @@ module Danger
|
|
14
14
|
before do
|
15
15
|
@dangerfile = testing_dangerfile
|
16
16
|
@plugin = @dangerfile.code_coverage
|
17
|
+
mock_target_files([])
|
17
18
|
end
|
18
19
|
|
19
20
|
describe 'report' do
|
@@ -115,6 +116,27 @@ module Danger
|
|
115
116
|
expect(second[1]).to(include('MainActivity3.java'))
|
116
117
|
expect(third[1]).to(include('MainActivity.java'))
|
117
118
|
end
|
119
|
+
|
120
|
+
it 'finds changed file in subdirectory' do
|
121
|
+
mock_coverage_json('/assets/coverage_jacoco_single.json')
|
122
|
+
mock_target_files(['src/main/java/com/example/kyaak/myapplication/MainActivity.java'])
|
123
|
+
|
124
|
+
@plugin.report
|
125
|
+
markdowns = @dangerfile.status_report[:markdowns]
|
126
|
+
expect(markdowns.length).to(be(1))
|
127
|
+
lines = markdowns.first.message.split("\n")
|
128
|
+
entries = lines[4].split('|')
|
129
|
+
expect(entries[1]).to(eq('com/example/kyaak/myapplication/MainActivity.java'))
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'does not include file not in changeset' do
|
133
|
+
mock_coverage_json('/assets/coverage_jacoco_single.json')
|
134
|
+
mock_target_files(['src/main/java/com/example/kyaak/myapplication/NotFound.java'])
|
135
|
+
|
136
|
+
@plugin.report
|
137
|
+
markdowns = @dangerfile.status_report[:markdowns]
|
138
|
+
expect(markdowns.length).to(be(0))
|
139
|
+
end
|
118
140
|
end
|
119
141
|
end
|
120
142
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-code_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Kyaak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|