single_cov 1.8.2 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/single_cov/version.rb +1 -1
- data/lib/single_cov.rb +31 -12
- 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: 033c6118fe2eb88114dab333f21c65b789ae0841b52ecfc5d7e96ce086f1c36d
|
4
|
+
data.tar.gz: f6dbb0e79ccd6764efa21f943d1e10e31b84ba7a1bff80f4af7d92dcf3b7ea42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 939772cc7264d4ab62255b608b9ef6d493c75c6ed0e96f7e1c1d5f97e967a79bc93624c6449a5cffb5973e527a5ce9dae204e01b336e8ecb22dbea9779fd19d1
|
7
|
+
data.tar.gz: 8d101d81129a40851a00b9f7157d1e1424c0845f3f0185c64fe890b08c3f453dc11dbcd756275768d286a6817e1483205cabf18683428ecbdb884cd4877118d7
|
data/lib/single_cov/version.rb
CHANGED
data/lib/single_cov.rb
CHANGED
@@ -4,6 +4,7 @@ module SingleCov
|
|
4
4
|
MAX_OUTPUT = 40
|
5
5
|
RAILS_APP_FOLDERS = ["models", "serializers", "helpers", "controllers", "mailers", "views", "jobs", "channels"]
|
6
6
|
UNCOVERED_COMMENT_MARKER = /#.*uncovered/
|
7
|
+
PREFIXES_TO_IGNORE = [] # things to not prefix with lib/ etc
|
7
8
|
|
8
9
|
class << self
|
9
10
|
# enable coverage reporting: path to output file, changed by forking-test-runner at runtime to combine many reports
|
@@ -86,8 +87,10 @@ module SingleCov
|
|
86
87
|
if missing_complete.any?
|
87
88
|
errors << <<~MSG
|
88
89
|
The following file(s) were previously marked as having 100% SingleCov test coverage (had no `coverage:` option) but are no longer marked as such.
|
89
|
-
Please increase test coverage in these files to maintain 100% coverage and remove `coverage:` usage.
|
90
90
|
#{missing_complete.join("\n")}
|
91
|
+
Please increase test coverage in these files to maintain 100% coverage and remove `coverage:` usage.
|
92
|
+
|
93
|
+
If this test fails during a file removal, make it pass by removing all references to the removed file's path from the code base.
|
91
94
|
MSG
|
92
95
|
end
|
93
96
|
|
@@ -382,18 +385,21 @@ module SingleCov
|
|
382
385
|
raise "#{file} includes neither 'test' nor 'spec' folder ... unable to resolve"
|
383
386
|
end
|
384
387
|
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
388
|
+
without_ignored_prefixes file_part do
|
389
|
+
# rails things live in app
|
390
|
+
file_part[0...0] =
|
391
|
+
if file_part =~ /^(?:#{RAILS_APP_FOLDERS.map { |f| Regexp.escape(f) }.join('|')})\//
|
392
|
+
"app/"
|
393
|
+
elsif file_part.start_with?("lib/") # don't add lib twice
|
394
|
+
""
|
395
|
+
else # everything else lives in lib
|
396
|
+
"lib/"
|
397
|
+
end
|
393
398
|
|
394
|
-
|
395
|
-
|
396
|
-
|
399
|
+
# remove test extension
|
400
|
+
if !file_part.sub!(/_(?:test|spec)\.rb\b.*/, '.rb') && !file_part.sub!(/\/test_/, "/")
|
401
|
+
raise "Unable to remove test extension from #{file} ... /test_, _test.rb and _spec.rb are supported"
|
402
|
+
end
|
397
403
|
end
|
398
404
|
|
399
405
|
# put back the subfolder
|
@@ -429,5 +435,18 @@ module SingleCov
|
|
429
435
|
FileUtils.mkdir_p(File.dirname(report))
|
430
436
|
File.write report, data
|
431
437
|
end
|
438
|
+
|
439
|
+
# file_part is modified during yield so we have to make sure to also modify in place
|
440
|
+
def without_ignored_prefixes(file_part)
|
441
|
+
folders = file_part.split('/')
|
442
|
+
return yield unless PREFIXES_TO_IGNORE.include?(folders.first)
|
443
|
+
|
444
|
+
prefix = folders.shift
|
445
|
+
file_part.replace folders.join('/')
|
446
|
+
|
447
|
+
yield
|
448
|
+
|
449
|
+
file_part[0...0] = "#{prefix}/"
|
450
|
+
end
|
432
451
|
end
|
433
452
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: single_cov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|