danger-jacoco-instacart 0.1.16 → 0.1.17
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/lib/jacoco/gem_version.rb +1 -1
- data/lib/jacoco/plugin.rb +6 -0
- data/spec/fixtures/output_g.xml +33 -0
- data/spec/jacoco_spec.rb +32 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b3e380696d9d2e8ce64b52d20baa6c09aa53259133e6b256769929e68b1d32b
|
|
4
|
+
data.tar.gz: b33b2c86616b7f93aeda7a669a3b27882a08b6a38205895636da62ae73e3a022
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ae620e33819d2e1ce7a13b3e2633071e5564ac3fe01a201b429f32364b47069fae9cb28e736f7f8a23bf94c03552d82171473df4561c070e79ff86cdcb3dd8e
|
|
7
|
+
data.tar.gz: 4e18673c11b8147510fcf5e1456b11145b8632d32de75005fcd3702e71515284ea219389ae41e4e61932d7f472454ee119d9167b4000df88ce18c664407f01ec
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
|
@@ -133,6 +133,12 @@ module Danger
|
|
|
133
133
|
|
|
134
134
|
file_content = File.read(file)
|
|
135
135
|
|
|
136
|
+
# Kotlin compiles top-level functions (e.g. @Composable funs) into a `<FileNameKt>` class.
|
|
137
|
+
# Always register it — the SAX parser skips it silently if it's absent from the XML.
|
|
138
|
+
parts = package_path.split('/')
|
|
139
|
+
kt_class_path = (parts[0..-2] + ["#{parts[-1]}Kt"]).join('/')
|
|
140
|
+
class_to_file_path_hash[kt_class_path] = file
|
|
141
|
+
|
|
136
142
|
# Look for class and interface declarations in the file
|
|
137
143
|
# Regex catches class/interface/object declarations with modifiers and generics
|
|
138
144
|
regex = /\b(?:(?:data|sealed|abstract|open|internal|private|protected|public|inline)\s+)*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.0//EN"
|
|
2
|
+
"report.dtd">
|
|
3
|
+
<report name="test_report">
|
|
4
|
+
<sessioninfo id="test-id" start="1480057517395" dump="1480057526412"/>
|
|
5
|
+
<package name="com/example">
|
|
6
|
+
<class name="com/example/TopLevelFunctionsKt">
|
|
7
|
+
<counter type="INSTRUCTION" missed="5" covered="15"/>
|
|
8
|
+
<counter type="LINE" missed="1" covered="4"/>
|
|
9
|
+
<counter type="COMPLEXITY" missed="1" covered="3"/>
|
|
10
|
+
<counter type="METHOD" missed="1" covered="3"/>
|
|
11
|
+
<counter type="CLASS" missed="0" covered="1"/>
|
|
12
|
+
</class>
|
|
13
|
+
<sourcefile name="TopLevelFunctions.kt">
|
|
14
|
+
<counter type="INSTRUCTION" missed="5" covered="15"/>
|
|
15
|
+
<counter type="LINE" missed="1" covered="4"/>
|
|
16
|
+
<counter type="COMPLEXITY" missed="1" covered="3"/>
|
|
17
|
+
<counter type="METHOD" missed="1" covered="3"/>
|
|
18
|
+
<counter type="CLASS" missed="0" covered="1"/>
|
|
19
|
+
</sourcefile>
|
|
20
|
+
<counter type="INSTRUCTION" missed="5" covered="15"/>
|
|
21
|
+
<counter type="BRANCH" missed="0" covered="0"/>
|
|
22
|
+
<counter type="LINE" missed="1" covered="4"/>
|
|
23
|
+
<counter type="COMPLEXITY" missed="1" covered="3"/>
|
|
24
|
+
<counter type="METHOD" missed="1" covered="3"/>
|
|
25
|
+
<counter type="CLASS" missed="0" covered="1"/>
|
|
26
|
+
</package>
|
|
27
|
+
<counter type="INSTRUCTION" missed="5" covered="15"/>
|
|
28
|
+
<counter type="BRANCH" missed="0" covered="0"/>
|
|
29
|
+
<counter type="LINE" missed="1" covered="4"/>
|
|
30
|
+
<counter type="COMPLEXITY" missed="1" covered="3"/>
|
|
31
|
+
<counter type="METHOD" missed="1" covered="3"/>
|
|
32
|
+
<counter type="CLASS" missed="0" covered="1"/>
|
|
33
|
+
</report>
|
data/spec/jacoco_spec.rb
CHANGED
|
@@ -385,6 +385,38 @@ module Danger
|
|
|
385
385
|
end
|
|
386
386
|
end
|
|
387
387
|
|
|
388
|
+
it 'detects top-level Kotlin functions file via the generated Kt-suffixed class' do
|
|
389
|
+
path_g = "#{File.dirname(__FILE__)}/fixtures/output_g.xml"
|
|
390
|
+
|
|
391
|
+
kotlin_file_path = 'src/kotlin/com/example/TopLevelFunctions.kt'
|
|
392
|
+
kotlin_file_content = <<~KOTLIN
|
|
393
|
+
package com.example
|
|
394
|
+
|
|
395
|
+
@Composable
|
|
396
|
+
fun FirstComposable() {}
|
|
397
|
+
|
|
398
|
+
@Composable
|
|
399
|
+
fun SecondComposable() {}
|
|
400
|
+
KOTLIN
|
|
401
|
+
|
|
402
|
+
allow(File).to receive(:exist?).and_call_original
|
|
403
|
+
allow(File).to receive(:exist?).with(kotlin_file_path).and_return(true)
|
|
404
|
+
allow(File).to receive(:read).and_call_original
|
|
405
|
+
allow(File).to receive(:read).with(kotlin_file_path).and_return(kotlin_file_content)
|
|
406
|
+
|
|
407
|
+
@my_plugin.files_to_check = [kotlin_file_path]
|
|
408
|
+
@my_plugin.minimum_project_coverage_percentage = 0
|
|
409
|
+
@my_plugin.minimum_class_coverage_percentage = 80
|
|
410
|
+
@my_plugin.minimum_composable_class_coverage_percentage = 80
|
|
411
|
+
|
|
412
|
+
class_file_hash = @my_plugin.classes(%r{/kotlin/})
|
|
413
|
+
expect(class_file_hash.keys).to include('com/example/TopLevelFunctionsKt')
|
|
414
|
+
|
|
415
|
+
@my_plugin.report path_g
|
|
416
|
+
|
|
417
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/TopLevelFunctionsKt` | 75% | 80% | :warning: |')
|
|
418
|
+
end
|
|
419
|
+
|
|
388
420
|
it 'test with kotlin multiples classes in same file' do
|
|
389
421
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
|
390
422
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-jacoco-instacart
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anton Malinskiy
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-05-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: danger-plugin-api
|
|
@@ -211,6 +211,7 @@ files:
|
|
|
211
211
|
- spec/fixtures/output_d.xml
|
|
212
212
|
- spec/fixtures/output_e.xml
|
|
213
213
|
- spec/fixtures/output_f.xml
|
|
214
|
+
- spec/fixtures/output_g.xml
|
|
214
215
|
- spec/jacoco_spec.rb
|
|
215
216
|
- spec/spec_helper.rb
|
|
216
217
|
homepage: https://github.com/alexanderbezverhni/danger-jacoco
|
|
@@ -243,5 +244,6 @@ test_files:
|
|
|
243
244
|
- spec/fixtures/output_d.xml
|
|
244
245
|
- spec/fixtures/output_e.xml
|
|
245
246
|
- spec/fixtures/output_f.xml
|
|
247
|
+
- spec/fixtures/output_g.xml
|
|
246
248
|
- spec/jacoco_spec.rb
|
|
247
249
|
- spec/spec_helper.rb
|