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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f3f3919f636ca63d3f48631e04e2f5a2d803844
4
- data.tar.gz: cf8c9967b7790f2c9794fa92006b1a818265c68e
3
+ metadata.gz: 370bbcc5a7090bd6ad4ce42f2b7a339a6cc7f4c9
4
+ data.tar.gz: 588bd8101244a9802da80a2bc42641f3c180ea61
5
5
  SHA512:
6
- metadata.gz: 95d444f5b8268451ab0f3e2ae044233a6540f0741b41d68adf7089a0b48f708db9e5365e722affde368c0e9748874d45533d55405d90a02f01992f8bc1130f4e
7
- data.tar.gz: ca9e2c8ac2e133c3c2ff13d281b0c1c266333b85755ad16cd5ce7259436b043f7005cb4e7faf93a5dabe09afafa8731eb8ad9121538cd4959286e38e70194bca
6
+ metadata.gz: 325a23f885d4c9342aad6f3006244952c74566f79463167f6027f32529d1ca0e405005de0b83896e5c60b2b3d9cbe6037ace7958cdd879449cde0552084ad845
7
+ data.tar.gz: e6aa3b9764732984c806d196c6eccae802590da1fc05bc6ea483aec4f10c5b41addebfcc19fe8a6c0e32801a53f9c26fce912739dd41252b2be98b9460d484cd
@@ -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
 
@@ -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)
@@ -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-pages.github.io/github/lkdjiin/coco.png)](http://inch-pages.github.io/github/lkdjiin/coco) [![Dependency Status](https://gemnasium.com/lkdjiin/coco.svg)](https://gemnasium.com/lkdjiin/coco)
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.11.0
1
+ 0.12.0
@@ -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
- cf = Coco::ConsoleFormatter.new(covered, uncovered)
30
- puts cf.format(config[:single_line_report])
31
- puts cf.link if config[:show_link_in_terminal]
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
@@ -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
- exclude_sources_above_threshold
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
- @covered_from_domain = @all_from_domain.select do |key, value|
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
@@ -27,6 +27,10 @@ module Coco
27
27
  colorize "\033[33m"
28
28
  end
29
29
 
30
+ def green
31
+ colorize "\033[32m"
32
+ end
33
+
30
34
  private
31
35
 
32
36
  def colorize(color_code)
@@ -2,16 +2,21 @@
2
2
 
3
3
  module Coco
4
4
 
5
- # I format coverages information for console output.
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 String.
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
- # covered - Hash
25
- # uncovered - Array
26
- def initialize(covered, uncovered)
27
- super
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
@@ -82,6 +82,10 @@ tr.hit {
82
82
  background-color: #5BD999;
83
83
  }
84
84
 
85
+ tr.hit:hover {
86
+ background-color: #8BF9C9;
87
+ }
88
+
85
89
  tr.miss {
86
90
  background-color: #E6567A;
87
91
  }
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.11.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-05-24 00:00:00.000000000 Z
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