coco 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.markdown +8 -0
- data/Gemfile.lock +50 -0
- data/README.markdown +17 -1
- data/VERSION +1 -1
- data/lib/coco.rb +4 -3
- data/lib/coco/configuration.rb +1 -0
- data/lib/coco/cover/coverage_result.rb +15 -11
- data/lib/coco/formatter/colored_string.rb +4 -0
- data/lib/coco/formatter/console_formatter.rb +16 -6
- data/lib/coco/formatter/formatter.rb +7 -1
- data/template/css/coco.css +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 370bbcc5a7090bd6ad4ce42f2b7a339a6cc7f4c9
|
4
|
+
data.tar.gz: 588bd8101244a9802da80a2bc42641f3c180ea61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 325a23f885d4c9342aad6f3006244952c74566f79463167f6027f32529d1ca0e405005de0b83896e5c60b2b3d9cbe6037ace7958cdd879449cde0552084ad845
|
7
|
+
data.tar.gz: e6aa3b9764732984c806d196c6eccae802590da1fc05bc6ea483aec4f10c5b41addebfcc19fe8a6c0e32801a53f9c26fce912739dd41252b2be98b9460d484cd
|
data/Changelog.markdown
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
v0.12.0 (2014-08-09)
|
2
|
+
=================================================
|
3
|
+
|
4
|
+
* Allows display of file whose coverage is more than threshold in the
|
5
|
+
console.
|
6
|
+
* Highlights hitted lines on mouse over in the HTML report.
|
7
|
+
|
8
|
+
|
1
9
|
v0.11.0 (2014-05-24)
|
2
10
|
=================================================
|
3
11
|
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
coco (0.12.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
flay (2.4.0)
|
11
|
+
ruby_parser (~> 3.0)
|
12
|
+
sexp_processor (~> 4.0)
|
13
|
+
rainbow (2.0.0)
|
14
|
+
rake (10.3.2)
|
15
|
+
reek (1.3.7)
|
16
|
+
rainbow
|
17
|
+
ruby2ruby (~> 2.0.8)
|
18
|
+
ruby_parser (~> 3.3)
|
19
|
+
sexp_processor
|
20
|
+
rspec (2.14.1)
|
21
|
+
rspec-core (~> 2.14.0)
|
22
|
+
rspec-expectations (~> 2.14.0)
|
23
|
+
rspec-mocks (~> 2.14.0)
|
24
|
+
rspec-core (2.14.8)
|
25
|
+
rspec-expectations (2.14.5)
|
26
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
27
|
+
rspec-mocks (2.14.6)
|
28
|
+
ruby2ruby (2.0.8)
|
29
|
+
ruby_parser (~> 3.1)
|
30
|
+
sexp_processor (~> 4.0)
|
31
|
+
ruby_parser (3.6.1)
|
32
|
+
sexp_processor (~> 4.1)
|
33
|
+
sexp_processor (4.4.3)
|
34
|
+
tomparse (0.4.2)
|
35
|
+
yard (0.8.7.3)
|
36
|
+
yard-tomdoc (0.7.1)
|
37
|
+
tomparse (>= 0.4.0)
|
38
|
+
yard
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
bundler (~> 1.3)
|
45
|
+
coco!
|
46
|
+
flay (~> 2.4)
|
47
|
+
rake (~> 10.1)
|
48
|
+
reek (~> 1.3)
|
49
|
+
rspec (~> 2.14)
|
50
|
+
yard-tomdoc (~> 0.7)
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
coco [![Build Status](https://travis-ci.org/lkdjiin/coco.png)](https://travis-ci.org/lkdjiin/coco) [![Gem Version](https://badge.fury.io/rb/coco.png)](http://badge.fury.io/rb/coco) [![Inline docs](http://inch-
|
1
|
+
coco [![Build Status](https://travis-ci.org/lkdjiin/coco.png)](https://travis-ci.org/lkdjiin/coco) [![Gem Version](https://badge.fury.io/rb/coco.png)](http://badge.fury.io/rb/coco) [![Inline docs](http://inch-ci.org/github/lkdjiin/coco.png)](http://inch-ci.org/github/lkdjiin/coco) [![Dependency Status](https://gemnasium.com/lkdjiin/coco.svg)](https://gemnasium.com/lkdjiin/coco)
|
2
2
|
==============================
|
3
3
|
|
4
4
|
Code coverage tool for ruby 1.9.3, 2.0 and 2.1.
|
@@ -92,6 +92,19 @@ See [more examples](https://github.com/lkdjiin/coco/wiki) on the wiki.
|
|
92
92
|
Advanced configuration
|
93
93
|
---------------------------------
|
94
94
|
|
95
|
+
### See coverage of all files in the console
|
96
|
+
|
97
|
+
By default, Coco will display only the files with a coverage above the
|
98
|
+
threshold. And as the threshold is 100% by default, nothing will be
|
99
|
+
displayed if your test suite is 100% covered. This could be annoying for
|
100
|
+
some people, or worst, you could even feel like Coco doing something the
|
101
|
+
wrong way.
|
102
|
+
|
103
|
+
So, to display in green the covered files,
|
104
|
+
put this in your `.coco.yml` configuration file:
|
105
|
+
|
106
|
+
:exclude_above_threshold: false
|
107
|
+
|
95
108
|
### When to start coco, and when not to start it
|
96
109
|
For projects whose complete test suite runs in a matter of seconds,
|
97
110
|
running code coverage with every test is fine.
|
@@ -183,3 +196,6 @@ Contributors
|
|
183
196
|
[Daniel Rice](https://github.com/BigNerdRanchDan)
|
184
197
|
|
185
198
|
[Gioele](https://github.com/gioele)
|
199
|
+
|
200
|
+
[TiteiKo](https://github.com/TiteiKo)
|
201
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.12.0
|
data/lib/coco.rb
CHANGED
@@ -26,9 +26,10 @@ at_exit do
|
|
26
26
|
sources = Coco::SourceLister.new(config).list
|
27
27
|
uncovered = Coco::UncoveredLister.new(sources, result.all_from_domain).list
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
puts
|
29
|
+
console_formatter = Coco::ConsoleFormatter.new(covered, uncovered,
|
30
|
+
config[:threshold])
|
31
|
+
puts console_formatter.format(config[:single_line_report])
|
32
|
+
puts console_formatter.link if config[:show_link_in_terminal]
|
32
33
|
|
33
34
|
html_files = Coco::HtmlFormatter.new(covered).format
|
34
35
|
Coco::HtmlFilesWriter.new(html_files).write
|
data/lib/coco/configuration.rb
CHANGED
@@ -30,6 +30,7 @@ module Coco
|
|
30
30
|
self[:single_line_report] = false
|
31
31
|
self[:always_run] = true
|
32
32
|
self[:show_link_in_terminal] = false
|
33
|
+
self[:exclude_above_threshold] = true
|
33
34
|
if File.exist?('.coco.yml')
|
34
35
|
self.merge!(YAML.load_file('.coco.yml'))
|
35
36
|
# Deprecated: Support of '.coco' file will be removed in v1.0.
|
@@ -13,9 +13,9 @@ module Coco
|
|
13
13
|
# Returns a Hash coverage for sources that are not sufficiently
|
14
14
|
# covered. More technically, the sources that live in the root
|
15
15
|
# project folder and for which the coverage percentage is under the
|
16
|
-
# threshold.
|
16
|
+
# threshold.
|
17
17
|
attr_reader :covered_from_domain
|
18
|
-
|
18
|
+
|
19
19
|
# Public: Initialize a CoverageResult.
|
20
20
|
#
|
21
21
|
# config - Hash
|
@@ -27,29 +27,33 @@ module Coco
|
|
27
27
|
@result = raw_results
|
28
28
|
exclude_external_sources
|
29
29
|
exclude_files_user_dont_want
|
30
|
-
|
30
|
+
if config[:exclude_above_threshold]
|
31
|
+
@covered_from_domain = exclude_sources_above_threshold
|
32
|
+
else
|
33
|
+
@covered_from_domain = @all_from_domain
|
34
|
+
end
|
31
35
|
end
|
32
|
-
|
36
|
+
|
33
37
|
private
|
34
|
-
|
38
|
+
|
35
39
|
def exclude_external_sources
|
36
40
|
here = Dir.pwd
|
37
41
|
@all_from_domain = @result.select {|key, value| key.start_with?(here) }
|
38
42
|
end
|
39
|
-
|
43
|
+
|
40
44
|
def exclude_files_user_dont_want
|
41
45
|
return if @exclude_files.nil?
|
42
46
|
@exclude_files.each do |filename|
|
43
47
|
@all_from_domain.delete(File.expand_path(filename))
|
44
48
|
end
|
45
49
|
end
|
46
|
-
|
47
|
-
def exclude_sources_above_threshold
|
48
|
-
@
|
50
|
+
|
51
|
+
def exclude_sources_above_threshold
|
52
|
+
@all_from_domain.select do |key, value|
|
49
53
|
CoverageStat.coverage_percent(value) < @threshold
|
50
54
|
end
|
51
55
|
end
|
52
|
-
|
56
|
+
|
53
57
|
end
|
54
|
-
|
58
|
+
|
55
59
|
end
|
@@ -2,16 +2,21 @@
|
|
2
2
|
|
3
3
|
module Coco
|
4
4
|
|
5
|
-
# I format coverages
|
5
|
+
# I format coverages data for console output.
|
6
6
|
class ConsoleFormatter < Formatter
|
7
7
|
|
8
|
+
# Public: Get a colored report, formatted for console output.
|
9
|
+
#
|
8
10
|
# single_line_report - Boolean
|
9
11
|
#
|
10
|
-
# Returns percent covered and associated filenames as a
|
12
|
+
# Returns percent covered and associated filenames as a multilines
|
13
|
+
# String
|
11
14
|
def format(single_line_report = false)
|
12
15
|
single_line_report ? single_line_message : @formatted_output.join("\n")
|
13
16
|
end
|
14
17
|
|
18
|
+
# Get the link for the report's index file.
|
19
|
+
#
|
15
20
|
# Returns String.
|
16
21
|
def link
|
17
22
|
unless @formatted_output.empty?
|
@@ -21,10 +26,13 @@ module Coco
|
|
21
26
|
end
|
22
27
|
end
|
23
28
|
|
24
|
-
#
|
25
|
-
#
|
26
|
-
|
27
|
-
|
29
|
+
# Public: Creates a new ConsoleFormatter.
|
30
|
+
#
|
31
|
+
# covered - See base class Formatter.
|
32
|
+
# uncovered - See base class Formatter.
|
33
|
+
# threshold - The Fixnum percentage threshold.
|
34
|
+
def initialize(covered, uncovered, threshold)
|
35
|
+
super(covered, uncovered)
|
28
36
|
@formatted_output = []
|
29
37
|
compute_percentage
|
30
38
|
add_percentage_to_uncovered
|
@@ -33,6 +41,8 @@ module Coco
|
|
33
41
|
text = ColoredString.new "#{percentage}% #{filename}"
|
34
42
|
if percentage <= 50
|
35
43
|
text.red
|
44
|
+
elsif percentage >= threshold
|
45
|
+
text.green
|
36
46
|
else
|
37
47
|
text.yellow
|
38
48
|
end
|
@@ -7,8 +7,14 @@ module Coco
|
|
7
7
|
# method.
|
8
8
|
class Formatter
|
9
9
|
|
10
|
-
# raw_coverages - The Hash from Coverage.result.
|
10
|
+
# raw_coverages - The Hash from Coverage.result. Keys are filenames
|
11
|
+
# and values are an Array representing each lines of
|
12
|
+
# the file :
|
13
|
+
# + nil : Unreacheable (comments, etc).
|
14
|
+
# + 0 : Not hit.
|
15
|
+
# + 1 or more : Number of hits.
|
11
16
|
# uncovered - An Array list of uncovered files.
|
17
|
+
#
|
12
18
|
# TODO I think covered is a better name than raw_coverages
|
13
19
|
def initialize(raw_coverages, uncovered)
|
14
20
|
@raw_coverages = raw_coverages
|
data/template/css/coco.css
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Nayrac
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- COPYING
|
110
110
|
- Changelog.markdown
|
111
111
|
- Gemfile
|
112
|
+
- Gemfile.lock
|
112
113
|
- README.markdown
|
113
114
|
- Rakefile
|
114
115
|
- VERSION
|