circleci-coverage_reporter 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +9 -1
- data/Gemfile +1 -0
- data/README.md +10 -19
- data/Rakefile +1 -1
- data/bin/rspec +18 -0
- data/bin/rubocop +18 -0
- data/bin/yard +18 -0
- data/lib/circleci/coverage_reporter/artifact.rb +8 -4
- data/lib/circleci/coverage_reporter/build.rb +9 -0
- data/lib/circleci/coverage_reporter/client.rb +13 -2
- data/lib/circleci/coverage_reporter/configuration.rb +7 -31
- data/lib/circleci/coverage_reporter/report.rb +43 -29
- data/lib/circleci/coverage_reporter/reporters/base.rb +119 -0
- data/lib/circleci/coverage_reporter/reporters/flow.rb +32 -0
- data/lib/circleci/coverage_reporter/reporters/link.rb +51 -0
- data/lib/circleci/coverage_reporter/reporters/rubycritic.rb +33 -0
- data/lib/circleci/coverage_reporter/reporters/simplecov.rb +32 -0
- data/lib/circleci/coverage_reporter/result.rb +12 -0
- data/lib/circleci/coverage_reporter/runner.rb +3 -9
- data/lib/circleci/coverage_reporter/vcs/base.rb +23 -0
- data/lib/circleci/coverage_reporter/vcs/github.rb +39 -0
- data/lib/circleci/coverage_reporter/version.rb +1 -1
- data/lib/circleci/coverage_reporter.rb +4 -4
- metadata +13 -20
- data/lib/circleci/coverage_reporter/abstract_build_result.rb +0 -24
- data/lib/circleci/coverage_reporter/abstract_current_result.rb +0 -45
- data/lib/circleci/coverage_reporter/abstract_reporter.rb +0 -56
- data/lib/circleci/coverage_reporter/abstract_result.rb +0 -21
- data/lib/circleci/coverage_reporter/abstract_vcs_client.rb +0 -21
- data/lib/circleci/coverage_reporter/flow/build_result.rb +0 -23
- data/lib/circleci/coverage_reporter/flow/current_result.rb +0 -23
- data/lib/circleci/coverage_reporter/flow/reporter.rb +0 -37
- data/lib/circleci/coverage_reporter/github_client.rb +0 -35
- data/lib/circleci/coverage_reporter/link/current_result.rb +0 -28
- data/lib/circleci/coverage_reporter/link/reporter.rb +0 -35
- data/lib/circleci/coverage_reporter/reports_renderer.rb +0 -24
- data/lib/circleci/coverage_reporter/rubycritic/build_result.rb +0 -23
- data/lib/circleci/coverage_reporter/rubycritic/current_result.rb +0 -29
- data/lib/circleci/coverage_reporter/rubycritic/reporter.rb +0 -37
- data/lib/circleci/coverage_reporter/simplecov/build_result.rb +0 -23
- data/lib/circleci/coverage_reporter/simplecov/current_result.rb +0 -23
- data/lib/circleci/coverage_reporter/simplecov/reporter.rb +0 -37
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
require_relative '../abstract_reporter'
|
4
|
-
require_relative 'build_result'
|
5
|
-
require_relative 'current_result'
|
6
|
-
|
7
|
-
module CircleCI
|
8
|
-
module CoverageReporter
|
9
|
-
module RubyCritic
|
10
|
-
class Reporter < AbstractReporter
|
11
|
-
DEFAULT_PATH = 'rubycritic'.freeze
|
12
|
-
|
13
|
-
# @note Implement {AbstractReporter#name}
|
14
|
-
# @return [String]
|
15
|
-
def name
|
16
|
-
'RubyCritic'
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
# @note Implement {AbstractReporter#create_build_result}
|
22
|
-
# @param build [Build, nil]
|
23
|
-
# @return [BuildResult, nil]
|
24
|
-
def create_build_result(build)
|
25
|
-
return unless build
|
26
|
-
BuildResult.new(path, build)
|
27
|
-
end
|
28
|
-
|
29
|
-
# @note Implement {AbstractReporter#create_current_result}
|
30
|
-
# @return [CurrentResult]
|
31
|
-
def create_current_result
|
32
|
-
CurrentResult.new(path)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative '../abstract_build_result'
|
2
|
-
|
3
|
-
module CircleCI
|
4
|
-
module CoverageReporter
|
5
|
-
module SimpleCov
|
6
|
-
class BuildResult < AbstractBuildResult
|
7
|
-
# @note Implement {AbstractResult#coverage}
|
8
|
-
# @return [Float]
|
9
|
-
def coverage
|
10
|
-
last_run_json = find_artifact('.last_run.json') or return Float::NAN
|
11
|
-
JSON.parse(last_run_json.body)['result']['covered_percent'].to_f
|
12
|
-
end
|
13
|
-
|
14
|
-
# @note Implement {AbstractResult#url}
|
15
|
-
# @return [String]
|
16
|
-
def url
|
17
|
-
index_html = find_artifact('index.html') or return '#'
|
18
|
-
index_html.url
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative '../abstract_current_result'
|
2
|
-
|
3
|
-
module CircleCI
|
4
|
-
module CoverageReporter
|
5
|
-
module SimpleCov
|
6
|
-
class CurrentResult < AbstractCurrentResult
|
7
|
-
# @note Implement {AbstractResult#coverage}
|
8
|
-
# @return [Float]
|
9
|
-
def coverage
|
10
|
-
JSON.parse(File.read(join('.last_run.json')))['result']['covered_percent'].to_f
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
# @note Implementation for {AbstractCurrentResult#html_file_name}
|
16
|
-
# @return [String]
|
17
|
-
def html_file_name
|
18
|
-
'index.html'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
require_relative '../abstract_reporter'
|
4
|
-
require_relative 'build_result'
|
5
|
-
require_relative 'current_result'
|
6
|
-
|
7
|
-
module CircleCI
|
8
|
-
module CoverageReporter
|
9
|
-
module SimpleCov
|
10
|
-
class Reporter < AbstractReporter
|
11
|
-
DEFAULT_PATH = 'coverage'.freeze
|
12
|
-
|
13
|
-
# @note Implement {AbstractReporter#name}
|
14
|
-
# @return [String]
|
15
|
-
def name
|
16
|
-
'SimpleCov'
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
# @note Implement {AbstractReporter#create_build_result}
|
22
|
-
# @param build [Build, nil]
|
23
|
-
# @return [BuildResult, nil]
|
24
|
-
def create_build_result(build)
|
25
|
-
return unless build
|
26
|
-
BuildResult.new(path, build)
|
27
|
-
end
|
28
|
-
|
29
|
-
# @note Implement {AbstractReporter#create_current_result}
|
30
|
-
# @return [CurrentResult]
|
31
|
-
def create_current_result
|
32
|
-
CurrentResult.new(path)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|