couve 0.6.0 → 0.7.0
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +16 -0
- data/lib/couve/parser.rb +10 -4
- data/lib/couve/version.rb +1 -1
- data/lib/couve.rb +27 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c6c4d593294316c9fe14a6a2d25d9029a5282c17ba53503a38b440c9b2c452f
|
|
4
|
+
data.tar.gz: bc384881652d204bc8e7cbb337beb019bd3a49db0e3e01955865ee49660791df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e90965ed10dd06d895bad918c452b5e9efeb6bc8d6b30ded117f3150c9fd1ddc51ff1e2cfbdaa4e3b28aa7bb186dc193632b6699ad0565849d38ac1f1b864272
|
|
7
|
+
data.tar.gz: d1665ba532efcc3ed7177daa9e3cd3b101775e2647000800100187dc98932fe0b9f6ca4f8d5e14e4a653b68abe77e6b2fad1e6c0c951fb3690c818843b23ad06
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.7.0] - 2026-06-05
|
|
4
|
+
|
|
5
|
+
- Add `--changed-files` to report the coverage status of a given list of files (e.g. a branch's changed files), including fully covered ones, instead of the project-wide below-100% view.
|
|
6
|
+
- Rename the report heading from "Coverage problems" to "Coverage report".
|
|
7
|
+
|
|
3
8
|
## [0.6.0] - 2026-06-04
|
|
4
9
|
|
|
5
10
|
- Add Markdown output format, selected from the output file extension (`.md`). HTML remains the default.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -65,6 +65,22 @@ couve coverage.json coverage.md # post to the PR
|
|
|
65
65
|
gh pr comment "$PR_NUMBER" --body-file coverage.md
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
### Reporting only the files you changed
|
|
69
|
+
|
|
70
|
+
By default the report lists every file in the coverage data that is below 100%. With `--changed-files` you flip that around: instead of a project-wide view, you get the coverage status of exactly the files you touched on a branch — including the ones that are fully covered.
|
|
71
|
+
|
|
72
|
+
Pass a file with one repo-relative path per line, or `-` to read the list from standard input:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
git diff --name-only origin/main...HEAD > changed.txt
|
|
76
|
+
couve coverage.json report.md --changed-files changed.txt
|
|
77
|
+
|
|
78
|
+
# or pipe the list straight in:
|
|
79
|
+
git diff --name-only origin/main...HEAD | couve coverage.json report.md --changed-files -
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Only files that appear both in the list and in the coverage data are shown; the rest of the project is left out. Coverage is still reported per file (the whole file's percentage and missed lines), not just the lines in your diff.
|
|
83
|
+
|
|
68
84
|
## Development
|
|
69
85
|
|
|
70
86
|
To contribute to Couve's development, follow these steps:
|
data/lib/couve/parser.rb
CHANGED
|
@@ -4,9 +4,15 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
module Couve
|
|
6
6
|
class Parser
|
|
7
|
-
def initialize(coverage)
|
|
7
|
+
def initialize(coverage, changed_files: nil)
|
|
8
8
|
@coverage = JSON.parse(coverage, symbolize_names: true)
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
if changed_files
|
|
11
|
+
@coverage[:source_files].select! { |file| changed_files.include?(file[:name]) }
|
|
12
|
+
else
|
|
13
|
+
@coverage[:source_files].reject! { |file| file[:covered_percent] == 100 }
|
|
14
|
+
end
|
|
15
|
+
|
|
10
16
|
@coverage[:source_files].sort_by! { |file| file[:covered_percent] }
|
|
11
17
|
end
|
|
12
18
|
|
|
@@ -16,7 +22,7 @@ module Couve
|
|
|
16
22
|
<body>
|
|
17
23
|
<div class="container mt-5">
|
|
18
24
|
<h1 class="display-5">
|
|
19
|
-
Coverage
|
|
25
|
+
Coverage report
|
|
20
26
|
</h1>
|
|
21
27
|
|
|
22
28
|
<table class="table table-hover mt-5">
|
|
@@ -47,7 +53,7 @@ module Couve
|
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
<<~MARKDOWN
|
|
50
|
-
## Coverage
|
|
56
|
+
## Coverage report
|
|
51
57
|
|
|
52
58
|
| Rating | Coverage | File | Not covered lines |
|
|
53
59
|
| :---: | ---: | :--- | :--- |
|
data/lib/couve/version.rb
CHANGED
data/lib/couve.rb
CHANGED
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "optparse"
|
|
4
|
+
|
|
3
5
|
require_relative "couve/version"
|
|
4
6
|
require_relative "couve/parser"
|
|
5
7
|
|
|
6
8
|
module Couve
|
|
7
|
-
def self.start
|
|
8
|
-
coverage_file =
|
|
9
|
-
output_file = ARGV[1]
|
|
9
|
+
def self.start(argv = ARGV)
|
|
10
|
+
coverage_file, output_file, changed_files_source = parse_arguments(argv)
|
|
10
11
|
|
|
11
12
|
coverage = File.read(coverage_file)
|
|
12
|
-
parser = Couve::Parser.new(coverage)
|
|
13
|
+
parser = Couve::Parser.new(coverage, changed_files: changed_files(changed_files_source))
|
|
13
14
|
|
|
14
15
|
report = output_file.end_with?(".md") ? parser.to_markdown : parser.to_html
|
|
15
16
|
|
|
16
|
-
File.open(output_file, "w")
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
File.open(output_file, "w") { |f| f.puts report }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.parse_arguments(argv)
|
|
21
|
+
argv = argv.dup
|
|
22
|
+
changed_files_source = nil
|
|
23
|
+
|
|
24
|
+
OptionParser.new do |opts|
|
|
25
|
+
opts.on("--changed-files PATH", "Only report the files listed in PATH (use - for stdin)") do |path|
|
|
26
|
+
changed_files_source = path
|
|
27
|
+
end
|
|
28
|
+
end.parse!(argv)
|
|
29
|
+
|
|
30
|
+
[argv[0], argv[1], changed_files_source]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.changed_files(source)
|
|
34
|
+
return nil unless source
|
|
35
|
+
|
|
36
|
+
contents = source == "-" ? $stdin.read : File.read(source)
|
|
37
|
+
|
|
38
|
+
contents.lines.map { |line| line.strip.delete_prefix("./") }.reject(&:empty?)
|
|
19
39
|
end
|
|
20
40
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: couve
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cezinha
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|