relevance-rcov 0.8.4.1 → 0.8.5
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.
- data/Rakefile +0 -7
- data/bin/rcov +207 -200
- data/lib/rcov/formatters/base_formatter.rb +1 -0
- data/lib/rcov/formatters/failure_report.rb +12 -0
- data/lib/rcov/formatters/text_summary.rb +1 -5
- data/lib/rcov/formatters.rb +2 -4
- data/lib/rcov/version.rb +2 -2
- metadata +2 -1
data/Rakefile
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
# This Rakefile serves as an example of how to use Rcov::RcovTask.
|
2
|
-
# Take a look at the RDoc documentation (or readme_for_rake) for further
|
3
|
-
# information.
|
4
|
-
|
5
1
|
$:.unshift "lib" if File.directory? "lib"
|
6
2
|
require 'rcov/rcovtask'
|
7
3
|
require 'rcov/version'
|
@@ -10,9 +6,6 @@ require 'rake/rdoctask'
|
|
10
6
|
require 'rake/gempackagetask'
|
11
7
|
require 'rake/clean'
|
12
8
|
|
13
|
-
puts "************\n#{ENV["PATH"]}\n************\n"
|
14
|
-
puts "************\n#{RUBY_VERSION}\n************"
|
15
|
-
|
16
9
|
# Use the specified rcov executable instead of the one in $PATH
|
17
10
|
# (this way we get a sort of informal functional test).
|
18
11
|
# This could also be specified from the command like, e.g.
|
data/bin/rcov
CHANGED
@@ -36,6 +36,7 @@ options.spec_only = false
|
|
36
36
|
options.sort = :name
|
37
37
|
options.sort_reverse = false
|
38
38
|
options.output_threshold = 101
|
39
|
+
options.failure_threshold = nil
|
39
40
|
options.replace_prog_name = false
|
40
41
|
options.callsites = false
|
41
42
|
options.crossrefs = false
|
@@ -76,216 +77,221 @@ opts = OptionParser.new do |opts|
|
|
76
77
|
rcov #{Rcov::VERSION} #{Rcov::RELEASE_DATE}
|
77
78
|
Usage: rcov [options] <script1.rb> [script2.rb] [-- --extra-options]
|
78
79
|
EOF
|
79
|
-
|
80
|
-
|
80
|
+
opts.separator ""
|
81
|
+
opts.separator "Options:"
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
83
|
+
opts.on("-o", "--output PATH", "Destination directory.") do |dir|
|
84
|
+
options.destdir = dir
|
85
|
+
end
|
86
|
+
|
87
|
+
opts.on("-I", "--include PATHS", "Prepend PATHS to $: (colon separated list)") do |paths|
|
88
|
+
options.loadpaths = paths.split(/:/)
|
89
|
+
end
|
90
|
+
|
91
|
+
opts.on("--[no-]comments", "Mark all comments by default.", "(default: --no-comments)") do |comments_run_p|
|
92
|
+
options.comments_run_by_default = comments_run_p
|
93
|
+
end
|
94
|
+
|
95
|
+
opts.on("--test-unit-only", "Only trace code executed inside TestCases.") do
|
96
|
+
deprecated("--test-unit-only")
|
97
|
+
end
|
98
|
+
|
99
|
+
opts.on("--spec-only", "Only trace code executed inside RSpec specs.") do
|
100
|
+
deprecated("--spec-only")
|
101
|
+
end
|
102
|
+
|
103
|
+
opts.on("-n", "--no-color", "Create colorblind-safe output.") do
|
104
|
+
options.color = false
|
105
|
+
end
|
106
|
+
|
107
|
+
opts.on("-i", "--include-file PATTERNS",
|
108
|
+
"Generate info for files matching a",
|
109
|
+
"pattern (comma-separated regexp list)") do |list|
|
110
|
+
begin
|
111
|
+
regexps = list.split(/,/).map{|x| Regexp.new(x) }
|
112
|
+
options.include += regexps
|
113
|
+
rescue RegexpError => e
|
114
|
+
raise OptionParser::InvalidArgument, e.message
|
104
115
|
end
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
regexps = list.split(/,/).map{|x| Regexp.new(x) }
|
111
|
-
options.include += regexps
|
112
|
-
rescue RegexpError => e
|
113
|
-
raise OptionParser::InvalidArgument, e.message
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
opts.on("-x", "--exclude PATTERNS", "Don't generate info for files matching a","pattern (comma-separated regexp list)") do |list|
|
118
|
-
begin
|
119
|
-
regexps = list.split(/,/).map{|x| Regexp.new x}
|
116
|
+
end
|
117
|
+
|
118
|
+
opts.on("-x", "--exclude PATTERNS", "Don't generate info for files matching a","pattern (comma-separated regexp list)") do |list|
|
119
|
+
begin
|
120
|
+
regexps = list.split(/,/).map{|x| Regexp.new x}
|
120
121
|
options.skip += regexps
|
121
|
-
|
122
|
+
rescue RegexpError => e
|
122
123
|
raise OptionParser::InvalidArgument, e.message
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
opts.on("--exclude-only PATTERNS", "Skip info only for files matching the", "given patterns.") do |list|
|
127
|
-
begin
|
128
|
-
options.skip = list.split(/,/).map{|x| Regexp.new(x) }
|
129
|
-
rescue RegexpError => e
|
130
|
-
raise OptionParser::InvalidArgument, e.message
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
opts.on("--rails", "Skip config/, environment/ and vendor/.") do
|
135
|
-
options.skip.concat [%r{\bvendor/},%r{\bconfig/},%r{\benvironment/}]
|
136
|
-
end
|
137
|
-
|
138
|
-
opts.on("--[no-]callsites", "Show callsites in generated XHTML report.", "(somewhat slower; disabled by default)") do |val|
|
139
|
-
options.callsites = val
|
140
|
-
end
|
141
|
-
|
142
|
-
opts.on("--[no-]xrefs", "Generate fully cross-referenced report.", "(includes --callsites)") do |val|
|
143
|
-
options.crossrefs = val
|
144
|
-
options.callsites ||= val
|
145
124
|
end
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
125
|
+
end
|
126
|
+
|
127
|
+
opts.on("--exclude-only PATTERNS", "Skip info only for files matching the", "given patterns.") do |list|
|
128
|
+
begin
|
129
|
+
options.skip = list.split(/,/).map{|x| Regexp.new(x) }
|
130
|
+
rescue RegexpError => e
|
131
|
+
raise OptionParser::InvalidArgument, e.message
|
150
132
|
end
|
151
|
-
|
152
|
-
|
133
|
+
end
|
134
|
+
|
135
|
+
opts.on("--rails", "Skip config/, environment/ and vendor/.") do
|
136
|
+
options.skip.concat [%r{\bvendor/},%r{\bconfig/},%r{\benvironment/}]
|
137
|
+
end
|
138
|
+
|
139
|
+
opts.on("--[no-]callsites", "Show callsites in generated XHTML report.", "(somewhat slower; disabled by default)") do |val|
|
140
|
+
options.callsites = val
|
141
|
+
end
|
142
|
+
|
143
|
+
opts.on("--[no-]xrefs", "Generate fully cross-referenced report.", "(includes --callsites)") do |val|
|
144
|
+
options.crossrefs = val
|
145
|
+
options.callsites ||= val
|
146
|
+
end
|
147
|
+
|
148
|
+
opts.on("-p", "--profile", "Generate bogo-profiling info.") do
|
149
|
+
options.profiling = true
|
150
|
+
options.destdir ||= "profiling"
|
151
|
+
end
|
152
|
+
|
153
|
+
opts.on("-r", "--range RANGE", Float, "Color scale range for profiling info (dB).") do |val|
|
153
154
|
options.range = val
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
155
|
+
end
|
156
|
+
|
157
|
+
opts.on("-a", "--annotate", "Generate annotated source code.") do
|
158
|
+
options.html = false
|
159
|
+
options.textmode = :annotate
|
160
|
+
options.crossrefs = true
|
161
|
+
options.callsites = true
|
162
|
+
options.skip = [ %r!/test/unit/! ]
|
163
|
+
end
|
164
|
+
|
165
|
+
opts.on("-T", "--text-report", "Dump detailed plain-text report to stdout.", "(filename, LoC, total lines, coverage)") do
|
166
|
+
options.textmode = :report
|
167
|
+
end
|
168
|
+
|
169
|
+
opts.on("-t", "--text-summary", "Dump plain-text summary to stdout.") do
|
170
|
+
options.textmode = :summary
|
171
|
+
end
|
172
|
+
|
173
|
+
opts.on("--text-counts", "Dump execution counts in plaintext.") do
|
174
|
+
options.textmode = :counts
|
175
|
+
end
|
176
|
+
|
177
|
+
opts.on("--text-coverage", "Dump coverage info to stdout, using", "ANSI color sequences unless -n.") do
|
178
|
+
options.textmode = :coverage
|
179
|
+
end
|
180
|
+
|
181
|
+
opts.on("--gcc", "Dump uncovered line in GCC error format.") do
|
182
|
+
options.gcc_output = true
|
183
|
+
end
|
184
|
+
|
185
|
+
opts.on("--aggregate FILE", "Aggregate data from previous runs",
|
186
|
+
"in FILE. Overwrites FILE with the",
|
187
|
+
"merged data. FILE is created if",
|
188
|
+
"necessary.") do |file|
|
189
|
+
options.aggregate_file = file
|
190
|
+
end
|
191
|
+
|
192
|
+
opts.on("-D [FILE]", "--text-coverage-diff [FILE]",
|
193
|
+
"Compare code coverage with saved state",
|
194
|
+
"in FILE, defaults to coverage.info.",
|
195
|
+
"Implies --comments.") do |file|
|
196
|
+
options.textmode = :coverage_diff
|
197
|
+
options.comments_run_by_default = true
|
198
|
+
if options.coverage_diff_save
|
199
|
+
raise "You shouldn't use --save and --text-coverage-diff at a time."
|
200
|
+
end
|
201
|
+
options.coverage_diff_mode = :compare
|
202
|
+
options.coverage_diff_file = file if file && !file.empty?
|
203
|
+
end
|
204
|
+
|
205
|
+
opts.on("--save [FILE]", "Save coverage data to FILE,", "for later use with rcov -D.", "(default: coverage.info)") do |file|
|
206
|
+
options.coverage_diff_save = true
|
207
|
+
options.coverage_diff_mode = :record
|
208
|
+
if options.textmode == :coverage_diff
|
209
|
+
raise "You shouldn't use --save and --text-coverage-diff at a time."
|
210
|
+
end
|
211
|
+
options.coverage_diff_file = file if file && !file.empty?
|
212
|
+
end
|
213
|
+
|
214
|
+
opts.on("--[no-]html", "Generate HTML output.", "(default: --html)") do |val|
|
215
|
+
options.html = val
|
216
|
+
end
|
217
|
+
|
218
|
+
opts.on("--sort CRITERION", [:name, :loc, :coverage], "Sort files in the output by the specified", "field (name, loc, coverage)") do |criterion|
|
219
|
+
options.sort = criterion
|
220
|
+
end
|
221
|
+
|
222
|
+
opts.on("--sort-reverse", "Reverse files in the output.") do
|
223
|
+
options.sort_reverse = true
|
224
|
+
end
|
225
|
+
|
226
|
+
opts.on("--threshold INT", "Only list files with coverage < INT %.", "(default: 101)") do |threshold|
|
227
|
+
begin
|
228
|
+
threshold = Integer(threshold)
|
229
|
+
raise if threshold <= 0 || threshold > 101
|
230
|
+
rescue Exception
|
231
|
+
raise OptionParser::InvalidArgument, threshold
|
232
|
+
end
|
233
|
+
options.output_threshold = threshold
|
234
|
+
end
|
235
|
+
|
236
|
+
opts.on("--failure-threshold [INT]", "Fail if the coverage is below the threshold", "(default: 100)") do |threshold|
|
237
|
+
options.failure_threshold = (threshold || 100).to_i
|
238
|
+
options.textmode = :failure_report
|
239
|
+
end
|
238
240
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
241
|
+
opts.on("--charset CHARSET", "Charset used in Content-Type declaration of HTML reports.") do |c|
|
242
|
+
options.charset = c
|
243
|
+
end
|
244
|
+
|
245
|
+
opts.on("--only-uncovered", "Same as --threshold 100") do
|
246
|
+
options.output_threshold = 100
|
247
|
+
end
|
248
|
+
|
249
|
+
opts.on("--replace-progname", "Replace $0 when loading the .rb files.") do
|
250
|
+
options.replace_prog_name = true
|
251
|
+
end
|
252
|
+
|
253
|
+
opts.on("-w", "Turn warnings on (like ruby).") do
|
254
|
+
$VERBOSE = true
|
255
|
+
end
|
256
|
+
|
257
|
+
opts.on("--no-rcovrt", "Do not use the optimized C runtime.", "(will run 30-300 times slower)") do
|
258
|
+
$rcov_do_not_use_rcovrt = true
|
259
|
+
end
|
260
|
+
|
261
|
+
opts.on("--diff-cmd PROGNAME", "Use PROGNAME for --text-coverage-diff.",
|
262
|
+
"(default: diff)") do |cmd|
|
263
|
+
options.diff_cmd = cmd
|
264
|
+
end
|
265
|
+
|
266
|
+
opts.separator ""
|
267
|
+
|
268
|
+
opts.on_tail("-h", "--help", "Show extended help message") do
|
269
|
+
require 'pp'
|
270
|
+
puts opts
|
271
|
+
puts <<EOF
|
266
272
|
|
267
273
|
Files matching any of the following regexps will be omitted in the report(s):
|
268
274
|
#{PP.pp(options.skip, "").chomp}
|
269
275
|
EOF
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
276
|
+
puts EXTRA_HELP
|
277
|
+
exit
|
278
|
+
end
|
279
|
+
|
280
|
+
opts.on_tail("--report-cov-bug SELECTOR", "Report coverage analysis bug for the",
|
281
|
+
"method specified by SELECTOR", "(format: Foo::Bar#method, A::B.method)") do |selector|
|
282
|
+
case selector
|
283
|
+
when /([^.]+)(#|\.)(.*)/ then options.report_cov_bug_for = selector
|
284
|
+
else
|
285
|
+
raise OptionParser::InvalidArgument, selector
|
286
|
+
end
|
287
|
+
options.textmode = nil
|
288
|
+
options.html = false
|
289
|
+
options.callsites = true
|
290
|
+
end
|
291
|
+
opts.on_tail("--version", "Show version") do
|
292
|
+
puts "rcov " + Rcov::VERSION + " " + Rcov::RELEASE_DATE
|
293
|
+
exit
|
294
|
+
end
|
289
295
|
end
|
290
296
|
|
291
297
|
$ORIGINAL_ARGV = ARGV.clone
|
@@ -370,7 +376,8 @@ make_formatter = lambda do |klass|
|
|
370
376
|
:diff_cmd => options.diff_cmd,
|
371
377
|
:comments_run_by_default => options.comments_run_by_default,
|
372
378
|
:gcc_output => options.gcc_output,
|
373
|
-
:charset => options.charset
|
379
|
+
:charset => options.charset,
|
380
|
+
:failure_threshold => options.failure_threshold
|
374
381
|
)
|
375
382
|
end
|
376
383
|
|
@@ -385,7 +392,7 @@ end
|
|
385
392
|
textual_formatters = { :counts => Rcov::FullTextReport, :coverage => Rcov::FullTextReport,
|
386
393
|
:gcc => Rcov::FullTextReport, :annotate => Rcov::RubyAnnotation,
|
387
394
|
:summary => Rcov::TextSummary, :report => Rcov::TextReport,
|
388
|
-
:coverage_diff => Rcov::TextCoverageDiff }
|
395
|
+
:coverage_diff => Rcov::TextCoverageDiff, :failure_report => Rcov::FailureReport }
|
389
396
|
|
390
397
|
if textual_formatters[options.textmode]
|
391
398
|
formatters << make_formatter[textual_formatters[options.textmode]]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Rcov
|
2
|
+
class FailureReport < TextSummary # :nodoc:
|
3
|
+
def execute
|
4
|
+
puts summary
|
5
|
+
coverage = code_coverage * 100
|
6
|
+
if coverage < @failure_threshold
|
7
|
+
puts "You failed to satisfy the coverage theshold of #{@failure_threshold}%"
|
8
|
+
exit(1)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Rcov
|
2
|
-
|
3
2
|
class TextSummary < BaseFormatter # :nodoc:
|
4
|
-
|
5
3
|
def execute
|
6
4
|
puts summary
|
7
5
|
end
|
@@ -9,7 +7,5 @@ module Rcov
|
|
9
7
|
def summary
|
10
8
|
"%.1f%% %d file(s) %d Lines %d LOC" % [code_coverage * 100, @files.size, num_lines, num_code_lines]
|
11
9
|
end
|
12
|
-
|
13
10
|
end
|
14
|
-
|
15
|
-
end
|
11
|
+
end
|
data/lib/rcov/formatters.rb
CHANGED
@@ -5,11 +5,9 @@ require 'rcov/formatters/text_report'
|
|
5
5
|
require 'rcov/formatters/text_coverage_diff'
|
6
6
|
require 'rcov/formatters/full_text_report'
|
7
7
|
require 'rcov/formatters/html_coverage'
|
8
|
+
require 'rcov/formatters/failure_report'
|
8
9
|
|
9
10
|
module Rcov
|
10
|
-
|
11
11
|
module Formatters
|
12
|
-
|
13
12
|
end
|
14
|
-
|
15
|
-
end
|
13
|
+
end
|
data/lib/rcov/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relevance-rcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Relevance
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- lib/rcov/formatters/text_coverage_diff.rb
|
38
38
|
- lib/rcov/formatters/text_report.rb
|
39
39
|
- lib/rcov/formatters/text_summary.rb
|
40
|
+
- lib/rcov/formatters/failure_report.rb
|
40
41
|
- lib/rcov/templates/index.html.erb
|
41
42
|
- lib/rcov/templates/detail.html.erb
|
42
43
|
- lib/rcov/templates/screen.css
|