danger-jacoco 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +20 -0
- data/Gemfile +2 -0
- data/Guardfile +2 -0
- data/Rakefile +2 -0
- data/danger-jacoco.gemspec +11 -9
- data/lib/jacoco/gem_version.rb +1 -1
- data/lib/jacoco/plugin.rb +7 -10
- data/lib/jacoco/sax_parser.rb +9 -10
- data/spec/jacoco_spec.rb +7 -7
- data/spec/spec_helper.rb +2 -2
- metadata +12 -12
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4d5975aa9e605034d57f94ae6c1e83b5b9ba5f9b21be614a3266c5b8d70a36d
|
4
|
+
data.tar.gz: 98ee2072a867384ae8d732cfef8dcda6b201a8da7706e2361481fa5add96bda4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07e545a038ee4ea8c7aa81c77ef96a1b62756513f90cb9994d762b9f5605689e02eb2a4c2d56c7dfb15b1177e9b9e700f51f4dc44162a7663350031b28f84511
|
7
|
+
data.tar.gz: 6138c222b2bcd09bf9c4e1744e256065bf9c1ac5e3d33c1b080252ccd0e7e50dfc2ab4dc92264bb8e32ab4428ab8887f5a7acbad715e9e8cca9cda210ac3b487
|
@@ -0,0 +1,20 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: weekly
|
7
|
+
time: "19:00"
|
8
|
+
open-pull-requests-limit: 10
|
9
|
+
ignore:
|
10
|
+
- dependency-name: listen
|
11
|
+
versions:
|
12
|
+
- 3.4.1
|
13
|
+
- 3.5.0
|
14
|
+
- dependency-name: rubocop
|
15
|
+
versions:
|
16
|
+
- 1.10.0
|
17
|
+
- 1.11.0
|
18
|
+
- 1.12.0
|
19
|
+
- 1.8.1
|
20
|
+
- 1.9.1
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
data/Rakefile
CHANGED
data/danger-jacoco.gemspec
CHANGED
@@ -1,22 +1,24 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'jacoco/gem_version
|
5
|
+
require 'jacoco/gem_version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'danger-jacoco'
|
8
9
|
spec.version = Jacoco::VERSION
|
9
10
|
spec.authors = ['Anton Malinskiy']
|
10
11
|
spec.email = ['anton@malinskiy.com']
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
12
|
+
spec.description = 'A short description of danger-jacoco.'
|
13
|
+
spec.summary = 'A longer description of danger-jacoco.'
|
13
14
|
spec.homepage = 'https://github.com/Malinskiy/danger-jacoco'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
16
|
-
spec.files = `git ls-files`.split(
|
17
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ['lib']
|
21
|
+
spec.required_ruby_version = '>= 2.6'
|
20
22
|
|
21
23
|
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
22
24
|
spec.add_runtime_dependency 'nokogiri-happymapper', '~> 0.6'
|
@@ -29,15 +31,15 @@ Gem::Specification.new do |spec|
|
|
29
31
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
30
32
|
|
31
33
|
# Linting code and docs
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 1.14'
|
35
|
+
spec.add_development_dependency 'yard', '~> 0.9'
|
34
36
|
|
35
37
|
# Makes testing easy via `bundle exec guard`
|
36
38
|
spec.add_development_dependency 'guard', '~> 2.14'
|
37
39
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
38
40
|
|
39
41
|
# If you want to work on older builds of ruby
|
40
|
-
spec.add_development_dependency 'listen', '3.
|
42
|
+
spec.add_development_dependency 'listen', '3.5.1'
|
41
43
|
|
42
44
|
# This gives you the chance to run a REPL inside your tests
|
43
45
|
# via:
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
@@ -20,12 +20,8 @@ module Danger
|
|
20
20
|
# @tags jacoco, coverage, java, android, kotlin
|
21
21
|
#
|
22
22
|
class DangerJacoco < Plugin # rubocop:disable Metrics/ClassLength
|
23
|
-
attr_accessor :minimum_project_coverage_percentage
|
24
|
-
|
25
|
-
attr_accessor :files_extension
|
26
|
-
attr_accessor :minimum_package_coverage_map
|
27
|
-
attr_accessor :minimum_class_coverage_map
|
28
|
-
attr_accessor :fail_no_coverage_data_found
|
23
|
+
attr_accessor :minimum_project_coverage_percentage, :minimum_class_coverage_percentage, :files_extension,
|
24
|
+
:minimum_package_coverage_map, :minimum_class_coverage_map, :fail_no_coverage_data_found, :title
|
29
25
|
|
30
26
|
# Initialize the plugin with configured parameters or defaults
|
31
27
|
def setup
|
@@ -34,6 +30,7 @@ module Danger
|
|
34
30
|
@minimum_package_coverage_map = {} unless minimum_package_coverage_map
|
35
31
|
@minimum_class_coverage_map = {} unless minimum_class_coverage_map
|
36
32
|
@files_extension = ['.kt', '.java'] unless files_extension
|
33
|
+
@title = 'JaCoCo' unless title
|
37
34
|
end
|
38
35
|
|
39
36
|
# Parses the xml output of jacoco to Ruby model classes
|
@@ -62,7 +59,7 @@ module Danger
|
|
62
59
|
# Java => blah/blah/java/slashed_package/Source.java
|
63
60
|
# Kotlin => blah/blah/kotlin/slashed_package/Source.kt
|
64
61
|
#
|
65
|
-
def report(path, report_url = '', delimiter = %r{
|
62
|
+
def report(path, report_url = '', delimiter = %r{/java/|/kotlin/}, fail_no_coverage_data_found: true)
|
66
63
|
@fail_no_coverage_data_found = fail_no_coverage_data_found
|
67
64
|
|
68
65
|
setup
|
@@ -73,7 +70,7 @@ module Danger
|
|
73
70
|
|
74
71
|
total_covered = total_coverage(path)
|
75
72
|
|
76
|
-
report_markdown = "###
|
73
|
+
report_markdown = "### #{title} Code Coverage #{total_covered[:covered]}% #{total_covered[:status]}\n"
|
77
74
|
report_markdown += "| Class | Covered | Meta | Status |\n"
|
78
75
|
report_markdown += "|:---|:---:|:---:|:---:|\n"
|
79
76
|
class_coverage_above_minimum = markdown_class(parser, report_markdown, report_url)
|
@@ -166,7 +163,7 @@ module Danger
|
|
166
163
|
if counter.nil?
|
167
164
|
no_coverage_data_found_message = "No coverage data found for #{jacoco_class.name}"
|
168
165
|
|
169
|
-
raise no_coverage_data_found_message if @fail_no_coverage_data_found.
|
166
|
+
raise no_coverage_data_found_message if @fail_no_coverage_data_found.instance_of?(TrueClass)
|
170
167
|
|
171
168
|
warn no_coverage_data_found_message
|
172
169
|
end
|
@@ -206,7 +203,7 @@ module Danger
|
|
206
203
|
if report_url.empty?
|
207
204
|
"`#{class_name}`"
|
208
205
|
else
|
209
|
-
report_filepath = class_name.gsub(%r{/(?=[^/]*/.)}, '.')
|
206
|
+
report_filepath = "#{class_name.gsub(%r{/(?=[^/]*/.)}, '.')}.html"
|
210
207
|
"[`#{class_name}`](#{report_url + report_filepath})"
|
211
208
|
end
|
212
209
|
end
|
data/lib/jacoco/sax_parser.rb
CHANGED
@@ -5,10 +5,10 @@ require 'nokogiri'
|
|
5
5
|
module Jacoco
|
6
6
|
# Sax parser for quickly finding class elements in Jacoco report
|
7
7
|
class SAXParser < Nokogiri::XML::SAX::Document
|
8
|
-
attr_accessor :class_names
|
9
|
-
attr_accessor :classes
|
8
|
+
attr_accessor :class_names, :classes
|
10
9
|
|
11
10
|
def initialize(classes)
|
11
|
+
super()
|
12
12
|
@class_names = classes
|
13
13
|
@classes = []
|
14
14
|
@current_class = nil
|
@@ -40,14 +40,13 @@ module Jacoco
|
|
40
40
|
def start_class(attrs)
|
41
41
|
@subelement_index = 0
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
43
|
+
return unless @class_names.include?(Hash[attrs]['name'])
|
44
|
+
|
45
|
+
c = Jacoco::Class.new
|
46
|
+
c.name = Hash[attrs]['name']
|
47
|
+
c.counters = []
|
48
|
+
@current_class = c
|
49
|
+
@classes.push c
|
51
50
|
end
|
52
51
|
|
53
52
|
def characters(string); end
|
data/spec/jacoco_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# rubocop:disable LineLength
|
4
|
-
# rubocop:disable ModuleLength
|
5
|
-
# rubocop:disable BlockLength
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
# rubocop:disable Metrics/ModuleLength
|
5
|
+
# rubocop:disable Metrics/BlockLength
|
6
6
|
|
7
7
|
require File.expand_path('spec_helper', __dir__)
|
8
8
|
|
@@ -37,7 +37,7 @@ module Danger
|
|
37
37
|
|
38
38
|
expect(@dangerfile.status_report[:errors]).to eq(['Total coverage of 32.9%. Improve this to at least 50%',
|
39
39
|
'Class coverage is below minimum. Improve to at least 0%'])
|
40
|
-
expect(@dangerfile.status_report[:markdowns][0].message).to include('###
|
40
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 32.9% :warning:')
|
41
41
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Meta | Status |')
|
42
42
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
|
43
43
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
@@ -162,6 +162,6 @@ module Danger
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
-
# rubocop:enable LineLength
|
166
|
-
# rubocop:enable ModuleLength
|
167
|
-
# rubocop:enable BlockLength
|
165
|
+
# rubocop:enable Layout/LineLength
|
166
|
+
# rubocop:enable Metrics/ModuleLength
|
167
|
+
# rubocop:enable Metrics/BlockLength
|
data/spec/spec_helper.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'pathname'
|
4
4
|
ROOT = Pathname.new(File.expand_path('..', __dir__))
|
5
|
-
$LOAD_PATH.unshift(
|
6
|
-
$LOAD_PATH.unshift(
|
5
|
+
$LOAD_PATH.unshift("#{ROOT}lib".to_s)
|
6
|
+
$LOAD_PATH.unshift("#{ROOT}spec".to_s)
|
7
7
|
|
8
8
|
require 'bundler/setup'
|
9
9
|
require 'pry'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-jacoco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Malinskiy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.14'
|
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
|
-
version: '
|
96
|
+
version: '1.14'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 3.
|
145
|
+
version: 3.5.1
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 3.
|
152
|
+
version: 3.5.1
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pry
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,11 +171,11 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
+
- ".github/dependabot.yml"
|
174
175
|
- ".github/workflows/ci.yaml"
|
175
176
|
- ".github/workflows/release.yaml"
|
176
177
|
- ".gitignore"
|
177
178
|
- ".rubocop.yml"
|
178
|
-
- ".travis.yml"
|
179
179
|
- Gemfile
|
180
180
|
- Guardfile
|
181
181
|
- LICENSE.txt
|
@@ -205,7 +205,7 @@ homepage: https://github.com/Malinskiy/danger-jacoco
|
|
205
205
|
licenses:
|
206
206
|
- MIT
|
207
207
|
metadata: {}
|
208
|
-
post_install_message:
|
208
|
+
post_install_message:
|
209
209
|
rdoc_options: []
|
210
210
|
require_paths:
|
211
211
|
- lib
|
@@ -213,15 +213,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
213
|
requirements:
|
214
214
|
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version: '
|
216
|
+
version: '2.6'
|
217
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
218
|
requirements:
|
219
219
|
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
rubygems_version: 3.0.
|
224
|
-
signing_key:
|
223
|
+
rubygems_version: 3.0.9
|
224
|
+
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: A longer description of danger-jacoco.
|
227
227
|
test_files:
|