danger-simplecov_json 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +85 -0
- data/.travis.yml +12 -0
- data/.yardoc/checksums +4 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +127 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +61 -0
- data/Rakefile +23 -0
- data/danger-simplecov_json.gemspec +47 -0
- data/lib/danger_plugin.rb +1 -0
- data/lib/danger_simplecov_json.rb +1 -0
- data/lib/simplecov_json/gem_version.rb +3 -0
- data/lib/simplecov_json/plugin.rb +40 -0
- data/spec/fixtures/coverage.json +12 -0
- data/spec/simplecov_json_spec.rb +34 -0
- data/spec/spec_helper.rb +59 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1e6bc456eab94c34d595981022e381b93d1dd4b7
|
4
|
+
data.tar.gz: 17262c3681fd74ef13285775ac5635a4ee9af172
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eba6f035519df2b6e674ceb6e684d0e142acc023a0ec49efc05de866301d29186061303888024f80aa8bbf6fda9c3c94a540c379d7ee18788a2936918226689f
|
7
|
+
data.tar.gz: c969a7da112cd9f4db6766bf0ee017cabaf7503c3d067a31798b0fab98ad4cafa339c1d80fcc94566e21dbdc6eed7df71dbcc3ecebedf4a092babf3375463d39
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# kind_of? is a good way to check a type
|
2
|
+
Style/ClassCheck:
|
3
|
+
EnforcedStyle: kind_of?
|
4
|
+
|
5
|
+
# It's better to be more explicit about the type
|
6
|
+
Style/BracesAroundHashParameters:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
# specs sometimes have useless assignments, which is fine
|
10
|
+
Lint/UselessAssignment:
|
11
|
+
Exclude:
|
12
|
+
- '**/spec/**/*'
|
13
|
+
|
14
|
+
# HoundCI doesn't like this rule
|
15
|
+
Style/DotPosition:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
Lint/UnusedBlockArgument:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
# We want to allow class Fastlane::Class
|
23
|
+
Style/ClassAndModuleChildren:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Metrics/AbcSize:
|
27
|
+
Max: 60
|
28
|
+
|
29
|
+
# The %w might be confusing for new users
|
30
|
+
Style/WordArray:
|
31
|
+
MinSize: 19
|
32
|
+
|
33
|
+
# raise and fail are both okay
|
34
|
+
Style/SignalException:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# Better too much 'return' than one missing
|
38
|
+
Style/RedundantReturn:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# Having if in the same line might not always be good
|
42
|
+
Style/IfUnlessModifier:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
# Configuration parameters: CountComments.
|
46
|
+
Metrics/ClassLength:
|
47
|
+
Max: 320
|
48
|
+
|
49
|
+
Metrics/CyclomaticComplexity:
|
50
|
+
Max: 17
|
51
|
+
|
52
|
+
# Configuration parameters: AllowURI, URISchemes.
|
53
|
+
Metrics/LineLength:
|
54
|
+
Max: 120
|
55
|
+
|
56
|
+
# Configuration parameters: CountKeywordArgs.
|
57
|
+
Metrics/ParameterLists:
|
58
|
+
Max: 10
|
59
|
+
|
60
|
+
Metrics/PerceivedComplexity:
|
61
|
+
Max: 18
|
62
|
+
|
63
|
+
# Sometimes it's easier to read without guards
|
64
|
+
Style/GuardClause:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# something = if something_else
|
68
|
+
# that's confusing
|
69
|
+
Style/ConditionalAssignment:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# Better to have too much self than missing a self
|
73
|
+
Style/RedundantSelf:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Metrics/MethodLength:
|
77
|
+
Max: 60
|
78
|
+
|
79
|
+
# We're not there yet
|
80
|
+
Style/Documentation:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
# Adds complexity
|
84
|
+
Style/IfInsideElse:
|
85
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/.yardoc/checksums
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
/Users/marcelofabri/Westfield/danger-simplecov_json/lib/danger_plugin.rb 3d8b15aca7efcf6e155e7f21e8055edfa9cc0bcf
|
2
|
+
/Users/marcelofabri/Westfield/danger-simplecov_json/lib/danger_simplecov_json.rb e6db4fa774b2b1b82320166f4ab2a84c05c3df36
|
3
|
+
/Users/marcelofabri/Westfield/danger-simplecov_json/lib/simplecov_json/gem_version.rb 59c5c28e98d668077d580916b96d1dcac9e0e096
|
4
|
+
/Users/marcelofabri/Westfield/danger-simplecov_json/lib/simplecov_json/plugin.rb 4151e24a2896de8973d0b9884137ed4f61b295ce
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-simplecov_json (0.1.0)
|
5
|
+
danger (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.4.0)
|
11
|
+
ast (2.3.0)
|
12
|
+
claide (1.0.0)
|
13
|
+
claide-plugins (0.9.1)
|
14
|
+
cork
|
15
|
+
nap
|
16
|
+
open4 (~> 1.3)
|
17
|
+
coderay (1.1.1)
|
18
|
+
colored (1.2)
|
19
|
+
cork (0.2.0)
|
20
|
+
colored (~> 1.2)
|
21
|
+
danger (2.1.6)
|
22
|
+
claide (~> 1.0)
|
23
|
+
claide-plugins (> 0.9.0)
|
24
|
+
colored (~> 1.2)
|
25
|
+
cork (~> 0.1)
|
26
|
+
faraday (~> 0)
|
27
|
+
faraday-http-cache (~> 1.0)
|
28
|
+
git (~> 1)
|
29
|
+
kramdown (~> 1.5)
|
30
|
+
octokit (~> 4.2)
|
31
|
+
terminal-table (~> 1)
|
32
|
+
diff-lcs (1.2.5)
|
33
|
+
faraday (0.9.2)
|
34
|
+
multipart-post (>= 1.2, < 3)
|
35
|
+
faraday-http-cache (1.3.1)
|
36
|
+
faraday (~> 0.8)
|
37
|
+
ffi (1.9.14)
|
38
|
+
formatador (0.2.5)
|
39
|
+
git (1.3.0)
|
40
|
+
guard (2.14.0)
|
41
|
+
formatador (>= 0.2.4)
|
42
|
+
listen (>= 2.7, < 4.0)
|
43
|
+
lumberjack (~> 1.0)
|
44
|
+
nenv (~> 0.1)
|
45
|
+
notiffany (~> 0.0)
|
46
|
+
pry (>= 0.9.12)
|
47
|
+
shellany (~> 0.0)
|
48
|
+
thor (>= 0.18.1)
|
49
|
+
guard-compat (1.2.1)
|
50
|
+
guard-rspec (4.7.2)
|
51
|
+
guard (~> 2.1)
|
52
|
+
guard-compat (~> 1.1)
|
53
|
+
rspec (>= 2.99.0, < 4.0)
|
54
|
+
kramdown (1.12.0)
|
55
|
+
listen (3.0.7)
|
56
|
+
rb-fsevent (>= 0.9.3)
|
57
|
+
rb-inotify (>= 0.9.7)
|
58
|
+
lumberjack (1.0.10)
|
59
|
+
method_source (0.8.2)
|
60
|
+
multipart-post (2.0.0)
|
61
|
+
nap (1.1.0)
|
62
|
+
nenv (0.3.0)
|
63
|
+
notiffany (0.1.0)
|
64
|
+
nenv (~> 0.1)
|
65
|
+
shellany (~> 0.0)
|
66
|
+
octokit (4.3.0)
|
67
|
+
sawyer (~> 0.7.0, >= 0.5.3)
|
68
|
+
open4 (1.3.4)
|
69
|
+
parser (2.3.1.2)
|
70
|
+
ast (~> 2.2)
|
71
|
+
powerpack (0.1.1)
|
72
|
+
pry (0.10.3)
|
73
|
+
coderay (~> 1.1.0)
|
74
|
+
method_source (~> 0.8.1)
|
75
|
+
slop (~> 3.4)
|
76
|
+
rainbow (2.1.0)
|
77
|
+
rake (10.5.0)
|
78
|
+
rb-fsevent (0.9.7)
|
79
|
+
rb-inotify (0.9.7)
|
80
|
+
ffi (>= 0.5.0)
|
81
|
+
rspec (3.4.0)
|
82
|
+
rspec-core (~> 3.4.0)
|
83
|
+
rspec-expectations (~> 3.4.0)
|
84
|
+
rspec-mocks (~> 3.4.0)
|
85
|
+
rspec-core (3.4.4)
|
86
|
+
rspec-support (~> 3.4.0)
|
87
|
+
rspec-expectations (3.4.0)
|
88
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
+
rspec-support (~> 3.4.0)
|
90
|
+
rspec-mocks (3.4.1)
|
91
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
92
|
+
rspec-support (~> 3.4.0)
|
93
|
+
rspec-support (3.4.1)
|
94
|
+
rubocop (0.42.0)
|
95
|
+
parser (>= 2.3.1.1, < 3.0)
|
96
|
+
powerpack (~> 0.1)
|
97
|
+
rainbow (>= 1.99.1, < 3.0)
|
98
|
+
ruby-progressbar (~> 1.7)
|
99
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
100
|
+
ruby-progressbar (1.8.1)
|
101
|
+
sawyer (0.7.0)
|
102
|
+
addressable (>= 2.3.5, < 2.5)
|
103
|
+
faraday (~> 0.8, < 0.10)
|
104
|
+
shellany (0.0.1)
|
105
|
+
slop (3.6.0)
|
106
|
+
terminal-table (1.6.0)
|
107
|
+
thor (0.19.1)
|
108
|
+
unicode-display_width (1.1.0)
|
109
|
+
yard (0.8.7.6)
|
110
|
+
|
111
|
+
PLATFORMS
|
112
|
+
ruby
|
113
|
+
|
114
|
+
DEPENDENCIES
|
115
|
+
bundler (~> 1.3)
|
116
|
+
danger-simplecov_json!
|
117
|
+
guard (~> 2.14)
|
118
|
+
guard-rspec (~> 4.7)
|
119
|
+
listen (= 3.0.7)
|
120
|
+
pry
|
121
|
+
rake (~> 10.0)
|
122
|
+
rspec (~> 3.4)
|
123
|
+
rubocop (~> 0.41)
|
124
|
+
yard (~> 0.8)
|
125
|
+
|
126
|
+
BUNDLED WITH
|
127
|
+
1.12.5
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A guardfile for making Danger Plugins
|
2
|
+
# For more info see https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# To run, use `bundle exec guard`.
|
5
|
+
|
6
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
7
|
+
require 'guard/rspec/dsl'
|
8
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
+
|
10
|
+
# RSpec files
|
11
|
+
rspec = dsl.rspec
|
12
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_files)
|
15
|
+
|
16
|
+
# Ruby files
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Marcelo Fabri <marcelofabrimf@gmail.com>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# danger-simplecov_json
|
2
|
+
|
3
|
+
Report your Ruby app test suite code coverage in [Danger](https://github.com/danger/danger).
|
4
|
+
|
5
|
+
Before using this plugin, you need to setup your project to use [SimpleCov](https://github.com/colszowka/simplecov)
|
6
|
+
to get code coverage information and [simplecov-json](https://github.com/vicentllongo/simplecov-json) to format
|
7
|
+
it as JSON.
|
8
|
+
|
9
|
+
## How does it look?
|
10
|
+
|
11
|
+
<table>
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th width="50"></th>
|
15
|
+
<th width="100%" data-kind="Message">
|
16
|
+
1 Message
|
17
|
+
</th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
<tbody>
|
21
|
+
|
22
|
+
<tr>
|
23
|
+
<td>:book:</td>
|
24
|
+
<td data-sticky="true">Code coverage is now at 99.15% (1512/1525 lines)</td>
|
25
|
+
</tr>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
|
31
|
+
Add this line to your Gemfile:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
gem 'danger-simplecov_json'
|
35
|
+
```
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
Just add this line to your `Dangerfile`:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
simplecov.report 'coverage/coverage.json'
|
43
|
+
```
|
44
|
+
|
45
|
+
You can also make the message not [sticky](http://danger.systems/reference.html):
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
simplecov.report('coverage/coverage.json', sticky: false)
|
49
|
+
```
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
MIT
|
54
|
+
|
55
|
+
## Development
|
56
|
+
|
57
|
+
1. Clone this repo
|
58
|
+
2. Run `bundle install` to setup dependencies.
|
59
|
+
3. Run `bundle exec rake spec` to run the tests.
|
60
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
61
|
+
5. Make your changes.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:specs)
|
6
|
+
|
7
|
+
task default: :specs
|
8
|
+
|
9
|
+
task :spec do
|
10
|
+
Rake::Task['specs'].invoke
|
11
|
+
Rake::Task['rubocop'].invoke
|
12
|
+
Rake::Task['spec_docs'].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run RuboCop on the lib/specs directory'
|
16
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
17
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Ensure that the plugin passes `danger plugins lint`'
|
21
|
+
task :spec_docs do
|
22
|
+
sh 'bundle exec danger plugins lint'
|
23
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'simplecov_json/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-simplecov_json'
|
8
|
+
spec.version = SimpleCovJson::VERSION
|
9
|
+
spec.authors = ['Marcelo Fabri']
|
10
|
+
spec.email = ['marcelofabrimf@gmail.com']
|
11
|
+
spec.description = 'Report your Ruby app test suite code coverage with Danger.'
|
12
|
+
spec.summary = 'A Danger plugin to report code coverage generated by SimpleCov in JSON format.'
|
13
|
+
spec.homepage = 'https://github.com/marcelofabri/danger-simplecov_json'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'danger', '~> 2.0'
|
22
|
+
|
23
|
+
# General ruby development
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
|
27
|
+
# Testing support
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
|
+
|
30
|
+
# Linting code and docs
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.41'
|
32
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
33
|
+
|
34
|
+
# Makes testing easy via `bundle exec guard`
|
35
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
36
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
37
|
+
|
38
|
+
# If you want to work on older builds of ruby
|
39
|
+
spec.add_development_dependency 'listen', '3.0.7'
|
40
|
+
|
41
|
+
# This gives you the chance to run a REPL inside your test
|
42
|
+
# via
|
43
|
+
# require 'pry'
|
44
|
+
# binding.pry
|
45
|
+
# This will stop test execution and let you inspect the results
|
46
|
+
spec.add_development_dependency 'pry'
|
47
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'simplecov_json/plugin'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'simplecov_json/gem_version'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Danger
|
2
|
+
# Report your Ruby app test suite code coverage.
|
3
|
+
#
|
4
|
+
# You can use [simplecov](https://github.com/colszowka/simplecov) to
|
5
|
+
# gather code coverage data and a
|
6
|
+
# [json formatter](https://github.com/vicentllongo/simplecov-json) so
|
7
|
+
# this plugin can parse it.
|
8
|
+
#
|
9
|
+
# @example Report code coverage
|
10
|
+
#
|
11
|
+
# simplecov.report_coverage('coverage/coverage.json')
|
12
|
+
#
|
13
|
+
# @see marcelofabri/danger-simplecov_json
|
14
|
+
# @tags ruby, code-coverage, simplecov
|
15
|
+
#
|
16
|
+
class DangerSimpleCovJson < Plugin
|
17
|
+
# Parse a JSON code coverage file and report that information as a
|
18
|
+
# message in Danger.
|
19
|
+
# @return [void]
|
20
|
+
#
|
21
|
+
def report(coverage_path, sticky: true)
|
22
|
+
if File.exist? coverage_path
|
23
|
+
coverage_json = JSON.parse(File.read(coverage_path), symbolize_names: true)
|
24
|
+
metrics = coverage_json[:metrics]
|
25
|
+
percentage = metrics[:covered_percent]
|
26
|
+
lines = metrics[:covered_lines]
|
27
|
+
total_lines = metrics[:total_lines]
|
28
|
+
|
29
|
+
formatted_percentage = format('%.02f', percentage)
|
30
|
+
message("Code coverage is now at #{formatted_percentage}% (#{lines}/#{total_lines} lines)", sticky: sticky)
|
31
|
+
else
|
32
|
+
fail('Code coverage data not found')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.instance_name
|
37
|
+
'simplecov'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
describe Danger::DangerSimpleCovJson do
|
5
|
+
it 'should be a plugin' do
|
6
|
+
expect(Danger::DangerSimpleCovJson.new(nil)).to be_a Danger::Plugin
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'with Dangerfile' do
|
10
|
+
before do
|
11
|
+
@dangerfile = testing_dangerfile
|
12
|
+
@simplecov = @dangerfile.simplecov
|
13
|
+
end
|
14
|
+
|
15
|
+
# Some examples for writing tests
|
16
|
+
# You should replace these with your own.
|
17
|
+
|
18
|
+
it 'Shows code coverage report' do
|
19
|
+
monday_date = Date.parse('2016-07-11')
|
20
|
+
allow(Date).to receive(:today).and_return monday_date
|
21
|
+
|
22
|
+
@simplecov.report('spec/fixtures/coverage.json')
|
23
|
+
|
24
|
+
expect(@dangerfile.status_report[:messages]).to eq(['Code coverage is now at 99.15% (1512/1525 lines)'])
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'Fails if code coverage not found' do
|
28
|
+
@simplecov.report('spec/fixtures/missing_file.json')
|
29
|
+
|
30
|
+
expect(@dangerfile.status_report[:errors]).to eq(['Code coverage data not found'])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
|
4
|
+
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'pry'
|
8
|
+
|
9
|
+
require 'rspec'
|
10
|
+
require 'danger'
|
11
|
+
|
12
|
+
# Use coloured output, it's the best.
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.filter_gems_from_backtrace 'bundler'
|
15
|
+
config.color = true
|
16
|
+
config.tty = true
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'danger_plugin'
|
20
|
+
|
21
|
+
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
|
22
|
+
# If you are expanding these files, see if it's already been done ^.
|
23
|
+
|
24
|
+
# A silent version of the user interface,
|
25
|
+
# it comes with an extra function `.string` which will
|
26
|
+
# strip all ANSI colours from the string.
|
27
|
+
|
28
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
29
|
+
def testing_ui
|
30
|
+
@output = StringIO.new
|
31
|
+
def @output.winsize
|
32
|
+
[20, 9999]
|
33
|
+
end
|
34
|
+
|
35
|
+
cork = Cork::Board.new(out: @output)
|
36
|
+
def cork.string
|
37
|
+
out.string.gsub(/\e\[([;\d]+)?m/, '')
|
38
|
+
end
|
39
|
+
cork
|
40
|
+
end
|
41
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
42
|
+
|
43
|
+
# Example environment (ENV) that would come from
|
44
|
+
# running a PR on TravisCI
|
45
|
+
def testing_env
|
46
|
+
{
|
47
|
+
'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
|
48
|
+
'TRAVIS_PULL_REQUEST' => '800',
|
49
|
+
'TRAVIS_REPO_SLUG' => 'artsy/eigen',
|
50
|
+
'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
|
51
|
+
'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# A stubbed out Dangerfile for use in tests
|
56
|
+
def testing_dangerfile
|
57
|
+
env = Danger::EnvironmentManager.new(testing_env)
|
58
|
+
Danger::Dangerfile.new(env, testing_ui)
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danger-simplecov_json
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcelo Fabri
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: danger
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.41'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.41'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.8'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.8'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.14'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.14'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.7'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: listen
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.0.7
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.0.7
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Report your Ruby app test suite code coverage with Danger.
|
154
|
+
email:
|
155
|
+
- marcelofabrimf@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rubocop.yml"
|
162
|
+
- ".travis.yml"
|
163
|
+
- ".yardoc/checksums"
|
164
|
+
- ".yardoc/object_types"
|
165
|
+
- ".yardoc/objects/root.dat"
|
166
|
+
- ".yardoc/proxy_types"
|
167
|
+
- Gemfile
|
168
|
+
- Gemfile.lock
|
169
|
+
- Guardfile
|
170
|
+
- LICENSE.txt
|
171
|
+
- README.md
|
172
|
+
- Rakefile
|
173
|
+
- danger-simplecov_json.gemspec
|
174
|
+
- lib/danger_plugin.rb
|
175
|
+
- lib/danger_simplecov_json.rb
|
176
|
+
- lib/simplecov_json/gem_version.rb
|
177
|
+
- lib/simplecov_json/plugin.rb
|
178
|
+
- spec/fixtures/coverage.json
|
179
|
+
- spec/simplecov_json_spec.rb
|
180
|
+
- spec/spec_helper.rb
|
181
|
+
homepage: https://github.com/marcelofabri/danger-simplecov_json
|
182
|
+
licenses:
|
183
|
+
- MIT
|
184
|
+
metadata: {}
|
185
|
+
post_install_message:
|
186
|
+
rdoc_options: []
|
187
|
+
require_paths:
|
188
|
+
- lib
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
199
|
+
requirements: []
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 2.6.0
|
202
|
+
signing_key:
|
203
|
+
specification_version: 4
|
204
|
+
summary: A Danger plugin to report code coverage generated by SimpleCov in JSON format.
|
205
|
+
test_files:
|
206
|
+
- spec/fixtures/coverage.json
|
207
|
+
- spec/simplecov_json_spec.rb
|
208
|
+
- spec/spec_helper.rb
|
209
|
+
has_rdoc:
|