This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ def self.start
6
6
require "simplecov"
7
7
::SimpleCov . add_filter 'vendor'
8
8
::SimpleCov . formatter = Formatter
9
- ::SimpleCov . start ( configuration . profile )
9
+ ::SimpleCov . start ( configuration . profile ) do
10
+ skip_token CodeClimate ::TestReporter . configuration . skip_token
11
+ end
10
12
end
11
13
end
12
14
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ def profile
33
33
@profile ||= "test_frameworks"
34
34
end
35
35
36
+ def skip_token
37
+ @skip_token ||= "nocov"
38
+ end
39
+
36
40
private
37
41
38
42
def default_logger
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Formatter
13
13
def format ( result )
14
14
return true unless CodeClimate ::TestReporter . run?
15
15
16
- print "Coverage = #{ round ( result . covered_percent , 2 ) } %. "
16
+ print "Coverage = #{ result . source_files . covered_percent . round ( 2 ) } %. "
17
17
18
18
payload = to_payload ( result )
19
19
PayloadValidator . validate ( payload )
@@ -63,8 +63,8 @@ def to_payload(result)
63
63
repo_token : ENV [ "CODECLIMATE_REPO_TOKEN" ] ,
64
64
source_files : source_files ,
65
65
run_at : result . created_at . to_i ,
66
- covered_percent : round ( result . covered_percent , 2 ) ,
67
- covered_strength : round ( result . covered_strength , 2 ) ,
66
+ covered_percent : result . source_files . covered_percent . round ( 2 ) ,
67
+ covered_strength : result . source_files . covered_strength . round ( 2 ) ,
68
68
line_counts : totals ,
69
69
partial : partial? ,
70
70
git : Git . info ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module CodeClimate::TestReporter
14
14
expect ( CodeClimate ::TestReporter . configuration . logger . level ) . to eq Logger ::INFO
15
15
expect ( CodeClimate ::TestReporter . configuration . profile ) . to eq ( 'test_frameworks' )
16
16
expect ( CodeClimate ::TestReporter . configuration . path_prefix ) . to be_nil
17
+ expect ( CodeClimate ::TestReporter . configuration . skip_token ) . to eq ( 'nocov' )
17
18
end
18
19
end
19
20
Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ module CodeClimate::TestReporter
6
6
let ( :project_path ) { "spec/tmp" }
7
7
let ( :project_file ) { "fake_project.rb" }
8
8
let ( :formatter ) { Formatter . new }
9
+ let ( :source_files ) {
10
+ double (
11
+ :covered_percent => 24.3 ,
12
+ :covered_strength => 33.2 ,
13
+ )
14
+ }
9
15
let ( :files ) {
10
16
[
11
17
double (
@@ -25,6 +31,7 @@ module CodeClimate::TestReporter
25
31
:covered_percent => 24.3 ,
26
32
:covered_strength => 33.2 ,
27
33
:files => files ,
34
+ :source_files => source_files ,
28
35
:created_at => Time . at ( 1379704336 ) ,
29
36
:command_name => "rspec"
30
37
)
You can’t perform that action at this time.
0 commit comments