undercover 0.6.3 → 0.6.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6858f42ada692894674f818d7713d20e8239051d06547f72e721f6122dda53be
4
- data.tar.gz: ef323b826f66d68a5ad0a5a7c14f5d37d3a85344f0efe82ac457181745000fb9
3
+ metadata.gz: 2a3601cf9aa4d26cee9c04f12b44273f8a67e0e8584b020e4e9bb763e03bf24e
4
+ data.tar.gz: 8198c30de2bc16734a1575b7aa0213c25ccafe120848dad9c24257d688b7bca9
5
5
  SHA512:
6
- metadata.gz: 365149055a1553d4bc6dfde0475cd4b1bc6a3a82c7a0cb5c5fbcf7604c078e320bafcd85b783d495bc4667bff58c0ebffeb5ec76a982c61bcb366e8a9a8edc18
7
- data.tar.gz: d5d7ec83fd50f1504f38bdd9961be84d365d5f3882045a1028f3daf45cd309a5ded497941e723cf3f3ce0eb335dfba34310f69b3d5efb91b0013fc5f69cc77a8
6
+ metadata.gz: 6e6a60fad9a478c37895ae24035022a9acf86f789ce0d798194b6d13b82c7db52c9de6590a9a9d3b8a84d304f220a30ef2c8e5226bab6fa58cea96f09c3856ca
7
+ data.tar.gz: fd1ca272d59b29debe708bd2f8df2bf867dccc60484416002dbf004d21ea83370e408e7703098f8d6e2ff0345d2234a7e662f94254a7dcc339f7370bae9f9885
@@ -5,7 +5,7 @@ jobs:
5
5
  runs-on: ubuntu-latest
6
6
  strategy:
7
7
  matrix:
8
- ruby: ['3.3', '3.0']
8
+ ruby: ['3.4', '3.0']
9
9
  steps:
10
10
  - uses: actions/checkout@v4
11
11
  with:
@@ -33,7 +33,7 @@ jobs:
33
33
  steps:
34
34
  - uses: actions/download-artifact@v4
35
35
  with:
36
- name: undercover-3.3.lcov
36
+ name: undercover-3.4.lcov
37
37
  - name: Upload coverage
38
38
  run: |
39
39
  ruby -e "$(curl -s https://undercover-ci.com/uploader.rb)" -- \
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.3.3
1
+ ruby 3.4.2
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ # [0.6.4] - 2025-03-29
10
+
11
+ ### Fixed
12
+ - Fix more false positives due to source file / coverage locator issues ([#222](https://github.com/grodowski/undercover/issues/222))
13
+
9
14
  # [0.6.3] - 2024-12-23
10
15
 
11
16
  ### Fixed
@@ -20,7 +20,6 @@ module Undercover
20
20
 
21
21
  run_report(opts)
22
22
  end
23
- # rubocop:enable
24
23
 
25
24
  def self.run_report(opts)
26
25
  report = Undercover::Report.new(changeset(opts), opts).build
@@ -5,16 +5,29 @@ require 'pathname'
5
5
 
6
6
  module Undercover
7
7
  class Options # rubocop:disable Metrics/ClassLength
8
- RUN_MODE = [
9
- RUN_MODE_DIFF_STRICT = :diff_strict, # warn for changed lines
10
- # RUN_MODE_DIFF_FILES = :diff_files, # warn for changed whole files
11
- # RUN_MODE_ALL = :diff_all, # warn for allthethings
12
- # RUN_MODE_FILES = :files # warn for specific files (cli option)
8
+ DIFF_TRIGGER_MODE = [
9
+ # Default, analyse all code blocks with changed lines. Untested lines and branches will trigger warnings if they
10
+ # strictly belong to the diff.
11
+ DIFF_TRIGGER_LINE = :diff_trigger_line,
12
+ #
13
+ # Doesn't exist yet
14
+ # Analyse all code blocks with changed lines. Untested lines and branches always trigger warnings for code block.
15
+ # DIFF_TRIGGER_BLOCK = :diff_trigger_block,
16
+ # Analyse all code blocks in each changed file.
17
+ # DIFF_TRIGGER_FILE = :diff_trigger_file,
18
+ # Analyse all code blocks in all files, ignores current diff (use --include-files and --exclude-files for control)
19
+ # ALL = :all,
13
20
  ].freeze
14
21
 
15
- OUTPUT_FORMATTERS = [
16
- OUTPUT_STDOUT = :stdout, # outputs warnings to stdout with exit 1
17
- # OUTPUT_CIRCLEMATOR = :circlemator # posts warnings as review comments
22
+ FILE_SCOPE = [
23
+ # Extended scope helps identify Ruby files that are not required in the test suite.
24
+ # Warning: currently doesn't respect :nocov: syntax in files not traced by SimpleCov.
25
+ # (use --include-files and --exclude-files for control)
26
+ FILE_SCOPE_EXTENDED = :scope_extended,
27
+ #
28
+ # Doesn't exist yet
29
+ # Analyse file that appear in coverage reports. Historically, the default undercover mode.
30
+ # FILE_SCOPE_COVERAGE = :scope_coverage,
18
31
  ].freeze
19
32
 
20
33
  DEFAULT_FILE_INCLUDE_GLOBS = %w[*.rb *.rake *.ru Rakefile].freeze
@@ -25,14 +38,14 @@ module Undercover
25
38
  :git_dir,
26
39
  :compare,
27
40
  :syntax_version,
41
+ :run_mode,
42
+ :file_scope,
28
43
  :glob_allow_filters,
29
44
  :glob_reject_filters
30
45
 
31
46
  def initialize
32
- # TODO: use run modes
33
- # TODO: use formatters
34
- @run_mode = RUN_MODE_DIFF_STRICT
35
- @enabled_formatters = [OUTPUT_STDOUT]
47
+ @run_mode = DIFF_TRIGGER_LINE
48
+ @file_scope = FILE_SCOPE_EXTENDED
36
49
  # set defaults
37
50
  self.path = '.'
38
51
  self.git_dir = '.git'
@@ -10,13 +10,13 @@ module Undercover
10
10
 
11
11
  def_delegators :node, :first_line, :last_line, :name
12
12
 
13
- def initialize(node, file_cov, file_path) # rubocop:disable Metrics/MethodLength
13
+ def initialize(node, file_cov, file_path) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
14
14
  @node = node
15
15
  @coverage = file_cov.select do |ln, _|
16
16
  if first_line == last_line
17
17
  ln == first_line
18
- elsif node.empty_def?
19
- ln >= first_line
18
+ elsif node.empty_def? || node.is_a?(Imagen::Node::Block)
19
+ ln >= first_line && ln <= last_line # rubocop:disable Style/ComparableBetween
20
20
  else
21
21
  ln > first_line && ln < last_line
22
22
  end
@@ -98,11 +98,11 @@ module Undercover
98
98
  Rainbow(' hits: n/a').italic.darkgray.dark
99
99
  elsif covered.positive?
100
100
  Rainbow(formatted_line).green +
101
- Rainbow(" hits: #{covered}").italic.darkgray.dark + \
101
+ Rainbow(" hits: #{covered}").italic.darkgray.dark +
102
102
  count_covered_branches(num)
103
103
  elsif covered.zero?
104
104
  Rainbow(formatted_line).red +
105
- Rainbow(" hits: #{covered}").italic.darkgray.dark + \
105
+ Rainbow(" hits: #{covered}").italic.darkgray.dark +
106
106
  count_covered_branches(num)
107
107
  end
108
108
  end.join("\n")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Undercover
4
- VERSION = '0.6.3'
4
+ VERSION = '0.6.4'
5
5
  end
data/lib/undercover.rb CHANGED
@@ -107,8 +107,7 @@ module Undercover
107
107
  return if root_ast.children.empty?
108
108
 
109
109
  loaded_files[key] = []
110
- # TODO: children[0] ignores the lonely_method (see spec fixtures)!
111
- root_ast.children[0].find_all(->(_) { true }).each do |imagen_node|
110
+ root_ast.find_all(->(node) { !node.is_a?(Imagen::Node::Root) }).each do |imagen_node|
112
111
  loaded_files[key] << Result.new(imagen_node, coverage, filepath)
113
112
  end
114
113
  end
data/undercover.gemspec CHANGED
@@ -27,8 +27,9 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.required_ruby_version = '>= 3.0.0'
29
29
 
30
+ spec.add_dependency 'base64'
30
31
  spec.add_dependency 'bigdecimal'
31
32
  spec.add_dependency 'imagen', '>= 0.2.0'
32
33
  spec.add_dependency 'rainbow', '>= 2.1', '< 4.0'
33
- spec.add_dependency 'rugged', '>= 0.27', '< 1.8'
34
+ spec.add_dependency 'rugged', '>= 0.27', '< 1.10'
34
35
  end
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undercover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Grodowski
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-23 00:00:00.000000000 Z
10
+ date: 2025-03-29 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: bigdecimal
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +80,7 @@ dependencies:
67
80
  version: '0.27'
68
81
  - - "<"
69
82
  - !ruby/object:Gem::Version
70
- version: '1.8'
83
+ version: '1.10'
71
84
  type: :runtime
72
85
  prerelease: false
73
86
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,8 +90,7 @@ dependencies:
77
90
  version: '0.27'
78
91
  - - "<"
79
92
  - !ruby/object:Gem::Version
80
- version: '1.8'
81
- description:
93
+ version: '1.10'
82
94
  email:
83
95
  - jgrodowski@gmail.com
84
96
  executables:
@@ -121,7 +133,6 @@ licenses:
121
133
  - MIT
122
134
  metadata:
123
135
  rubygems_mfa_required: 'true'
124
- post_install_message:
125
136
  rdoc_options: []
126
137
  require_paths:
127
138
  - lib
@@ -136,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
147
  - !ruby/object:Gem::Version
137
148
  version: '0'
138
149
  requirements: []
139
- rubygems_version: 3.5.11
140
- signing_key:
150
+ rubygems_version: 3.6.2
141
151
  specification_version: 4
142
152
  summary: Actionable code coverage - detects untested code blocks in recent changes
143
153
  test_files: []