simplecov-table 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b6e3aafc3c5c93e9bd6d514f083407737abebad68ac733306ab3fe105e77f370
4
+ data.tar.gz: 4b9bfcde11e1c38000e7359c0e3b291e07a1a7f37d6e7a109fc5f023a3a8e1da
5
+ SHA512:
6
+ metadata.gz: 458127c342f2ec2ba66b6084f8224009ac08e8aa5f61029a656c18d6c1261693641884e62874506ee0ca0dc593a3bf79689c673c855a41555ec5e659c4c28237
7
+ data.tar.gz: 6dcdc99db04d06658d25e6a35c2fe8c9c4e91c084301740fd3bf60776fb1e517fd2a5d92c9f79e8b51514f40ccb35a9b49aaef61f2164db2f0302218a0f6bdc3
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2022-present, cheap glitch
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # 📊 simplecov-table
2
+
3
+ ![License](https://badgen.net/github/license/cheap-glitch/simplecov-table?color=green)
4
+ ![Latest release](https://badgen.net/github/release/cheap-glitch/simplecov-table?color=green)
5
+
6
+ This is a custom [SimpleCov](https://github.com/simplecov-ruby/simplecov)
7
+ formatter that displays table-formatted summaries of your coverage reports in
8
+ the terminal. It prints the total coverage ratio of each source file, along with
9
+ a compressed list of the uncovered lines.
10
+
11
+ ```text
12
+ ────────────────────┬──────────┬──────────────────────────────────────
13
+ Files │ Coverage │ Uncovered lines
14
+ ────────────────────┼──────────┼──────────────────────────────────────
15
+ lib/foo.rb │ 78.0% │ 11,12,20-27
16
+ lib/foo/bar.rb │ 100.0% │
17
+ lib/foo/baz.rb │ 33.5% │ 3,5,63-75,122,128
18
+ ────────────────────┴──────────┴──────────────────────────────────────
19
+ ```
20
+
21
+ ## Installation
22
+
23
+ ```shell
24
+ gem install simplecov-table
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```ruby
30
+ require 'simplecov'
31
+ require 'simplecov-table'
32
+
33
+ SimpleCov.formatter = SimpleCov::Formatter::TableFormatter
34
+ SimpleCov.start
35
+ ```
36
+
37
+ Or, if you want to use several formatters:
38
+
39
+ ```ruby
40
+ require 'simplecov'
41
+ require 'simplecov-table'
42
+
43
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
44
+ SimpleCov::Formatter::HTMLFormatter,
45
+ SimpleCov::Formatter::TableFormatter,
46
+ ])
47
+ SimpleCov.start
48
+ ```
49
+
50
+ ## Changelog
51
+
52
+ See the full changelog [here](https://github.com/cheap-glitch/simplecov-table/releases).
53
+
54
+ ## Contributing
55
+
56
+ Contributions are welcomed! Please open an issue before submitting substantial changes.
57
+
58
+ ## Related
59
+
60
+ * [simplecov-erb](https://github.com/kpaulisse/simplecov-erb) - Flexible plain-text formatter that uses ERB templates
61
+ * [simplecov-lcov](https://github.com/fortissimo1997/simplecov-lcov) - Simple LCOV formatter
62
+
63
+ ## License
64
+
65
+ ISC
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'simplecov-table'
3
+ s.version = '1.0.0'
4
+ s.summary = 'A custom SimpleCov formatter to display summaries of coverage reports in table format.'
5
+ s.description = 'A custom SimpleCov formatter that displays table-formatted summaries of your coverage reports in the terminal. It prints the total coverage ratio of each source file, along with a compressed list of the uncovered lines.'
6
+ s.authors = ['cheap glitch']
7
+ s.email = 'cheap.glitch@gmail.com'
8
+ s.homepage = 'https://github.com/cheap-glitch/simplecov-table'
9
+ s.license = 'ISC'
10
+ s.require_path = 'lib'
11
+ s.files = Dir[
12
+ 'LICENSE',
13
+ 'lib/***/*.rb',
14
+ 'spec/**/*.rb',
15
+ 'simplecov-table.gemspec',
16
+ ]
17
+ s.extra_rdoc_files = [
18
+ 'LICENSE',
19
+ 'README.md',
20
+ ]
21
+ end
@@ -0,0 +1,17 @@
1
+ class Bar
2
+ def uncovered_1
3
+ "foo: #{@foo}"
4
+ end
5
+
6
+ def bar
7
+ @a = 'bar'
8
+ end
9
+
10
+ def uncovered_2(a)
11
+ @a = a
12
+ @b = 'baz'
13
+ @c = false
14
+ end
15
+ end
16
+
17
+ Bar.new.bar
@@ -0,0 +1,22 @@
1
+ class Foo
2
+ def foo
3
+ "foo: #{@foo}"
4
+ end
5
+
6
+ def bar
7
+ @a = 'bar'
8
+ end
9
+
10
+ def baz(b)
11
+ @a = b
12
+ end
13
+
14
+ def uncovered
15
+ @a = 'baz'
16
+ end
17
+ end
18
+
19
+ Foo.new.foo
20
+ Foo.new.foo
21
+ Foo.new.bar
22
+ Foo.new.baz 'hello'
data/spec/helpers.rb ADDED
@@ -0,0 +1,26 @@
1
+ # Taken from https://github.com/cldwalker/hirb/blob/master/test/test_helper.rb
2
+ # Copyright (c) 2010 Gabriel Horner
3
+
4
+ require 'stringio'
5
+
6
+ def capture_stdout(&block)
7
+ original_stdout = $stdout
8
+ $stdout = fake = StringIO.new
9
+ begin
10
+ yield
11
+ ensure
12
+ $stdout = original_stdout
13
+ end
14
+ fake.string
15
+ end
16
+
17
+ def capture_stderr(&block)
18
+ original_stderr = $stderr
19
+ $stderr = fake = StringIO.new
20
+ begin
21
+ yield
22
+ ensure
23
+ $stderr = original_stderr
24
+ end
25
+ fake.string
26
+ end
@@ -0,0 +1,37 @@
1
+ require 'simplecov'
2
+
3
+ require_relative 'helpers'
4
+ require_relative '../lib/simplecov-table'
5
+
6
+ FIXTURES_COVERAGE_DIR = 'spec/coverage'
7
+
8
+ module SimpleCov::Formatter
9
+ describe TableFormatter do
10
+
11
+ before(:example) do
12
+ FileUtils.remove_dir(FIXTURES_COVERAGE_DIR, true) if Dir.exist?(FIXTURES_COVERAGE_DIR)
13
+ SimpleCov.coverage_dir FIXTURES_COVERAGE_DIR
14
+ end
15
+
16
+ it 'prints an error when there is no data' do
17
+ output = capture_stderr { TableFormatter.new.format(SimpleCov.result) }
18
+ expect(output).to eq("No coverage data\n")
19
+ end
20
+
21
+ it 'prints a pretty table' do
22
+ SimpleCov.start
23
+ load 'fixtures/foo.rb'
24
+ output = capture_stdout { TableFormatter.new.format(SimpleCov.result) }
25
+ expect(output).to match(/^ Files │ Coverage │ Uncovered lines\s+$/m)
26
+ expect(output).to match(/^ foo\.rb │ 92\.3% │ 15\s+$/m)
27
+ end
28
+
29
+ it 'groups adjacent uncovered lines together' do
30
+ SimpleCov.start
31
+ load 'fixtures/bar.rb'
32
+ output = capture_stdout { TableFormatter.new.format(SimpleCov.result) }
33
+ expect(output).to match(/^ bar\.rb │ 60\.0% │ 3,11-13\s+$/m)
34
+ end
35
+
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplecov-table
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - cheap glitch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-02-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A custom SimpleCov formatter that displays table-formatted summaries
14
+ of your coverage reports in the terminal. It prints the total coverage ratio of
15
+ each source file, along with a compressed list of the uncovered lines.
16
+ email: cheap.glitch@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files:
20
+ - LICENSE
21
+ - README.md
22
+ files:
23
+ - LICENSE
24
+ - README.md
25
+ - simplecov-table.gemspec
26
+ - spec/fixtures/bar.rb
27
+ - spec/fixtures/foo.rb
28
+ - spec/helpers.rb
29
+ - spec/simplecov-table_spec.rb
30
+ homepage: https://github.com/cheap-glitch/simplecov-table
31
+ licenses:
32
+ - ISC
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 3.3.5
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: A custom SimpleCov formatter to display summaries of coverage reports in
53
+ table format.
54
+ test_files: []