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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/CHANGELOG.md +9 -1
  4. data/Gemfile +1 -0
  5. data/README.md +10 -19
  6. data/Rakefile +1 -1
  7. data/bin/rspec +18 -0
  8. data/bin/rubocop +18 -0
  9. data/bin/yard +18 -0
  10. data/lib/circleci/coverage_reporter/artifact.rb +8 -4
  11. data/lib/circleci/coverage_reporter/build.rb +9 -0
  12. data/lib/circleci/coverage_reporter/client.rb +13 -2
  13. data/lib/circleci/coverage_reporter/configuration.rb +7 -31
  14. data/lib/circleci/coverage_reporter/report.rb +43 -29
  15. data/lib/circleci/coverage_reporter/reporters/base.rb +119 -0
  16. data/lib/circleci/coverage_reporter/reporters/flow.rb +32 -0
  17. data/lib/circleci/coverage_reporter/reporters/link.rb +51 -0
  18. data/lib/circleci/coverage_reporter/reporters/rubycritic.rb +33 -0
  19. data/lib/circleci/coverage_reporter/reporters/simplecov.rb +32 -0
  20. data/lib/circleci/coverage_reporter/result.rb +12 -0
  21. data/lib/circleci/coverage_reporter/runner.rb +3 -9
  22. data/lib/circleci/coverage_reporter/vcs/base.rb +23 -0
  23. data/lib/circleci/coverage_reporter/vcs/github.rb +39 -0
  24. data/lib/circleci/coverage_reporter/version.rb +1 -1
  25. data/lib/circleci/coverage_reporter.rb +4 -4
  26. metadata +13 -20
  27. data/lib/circleci/coverage_reporter/abstract_build_result.rb +0 -24
  28. data/lib/circleci/coverage_reporter/abstract_current_result.rb +0 -45
  29. data/lib/circleci/coverage_reporter/abstract_reporter.rb +0 -56
  30. data/lib/circleci/coverage_reporter/abstract_result.rb +0 -21
  31. data/lib/circleci/coverage_reporter/abstract_vcs_client.rb +0 -21
  32. data/lib/circleci/coverage_reporter/flow/build_result.rb +0 -23
  33. data/lib/circleci/coverage_reporter/flow/current_result.rb +0 -23
  34. data/lib/circleci/coverage_reporter/flow/reporter.rb +0 -37
  35. data/lib/circleci/coverage_reporter/github_client.rb +0 -35
  36. data/lib/circleci/coverage_reporter/link/current_result.rb +0 -28
  37. data/lib/circleci/coverage_reporter/link/reporter.rb +0 -35
  38. data/lib/circleci/coverage_reporter/reports_renderer.rb +0 -24
  39. data/lib/circleci/coverage_reporter/rubycritic/build_result.rb +0 -23
  40. data/lib/circleci/coverage_reporter/rubycritic/current_result.rb +0 -29
  41. data/lib/circleci/coverage_reporter/rubycritic/reporter.rb +0 -37
  42. data/lib/circleci/coverage_reporter/simplecov/build_result.rb +0 -23
  43. data/lib/circleci/coverage_reporter/simplecov/current_result.rb +0 -23
  44. 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