Skip to content

Commit 929e9f8

Browse files
committed
Test edge version of simplecov
1 parent 5bb9847 commit 929e9f8

10 files changed

Lines changed: 15 additions & 41 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ E.g. on macOS:
6565
$ open coverage/index.html
6666
```
6767

68-
If you have unreachable lines, you can add `# :nocov` around those lines. The code itself or a comment should explain why the line is unreachable.
68+
If you have unreachable lines, you can add `# simplecov:disable`/`# simplecov:enable` around those lines. The code itself or a comment should explain why the line is unreachable.
6969

7070
Example:
7171

7272
```ruby
73-
# :nocov:
73+
# simplecov:disable
7474
raise ArgumentError("Unsupported style :#{style}")
75-
# :nocov:
75+
# simplecov:enable
7676
```
7777

7878
This can happen for a few reasons, including:

.simplecov

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# frozen_string_literal: true
22

3-
SimpleCov.start do
4-
enable_coverage :branch
5-
minimum_coverage line: 100, branch: 100
6-
add_filter '/spec/'
7-
add_filter '/vendor/bundle/'
8-
end
3+
enable_coverage :branch
4+
minimum_coverage line: 100, branch: 100
5+
ignore_branches :implicit_else
6+
skip '/spec/'
7+
skip '/vendor/bundle/'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gem 'rake'
1111
gem 'rspec', '~> 3.11'
1212
gem 'rubocop-performance', '~> 1.24'
1313
gem 'rubocop-rake', '~> 0.7'
14-
gem 'simplecov', '>= 0.19'
14+
gem 'simplecov', github: 'simplecov-ruby/simplecov'
1515
gem 'yard'
1616

1717
# FIXME: Remove when the next prism version is released.

lib/rubocop/cop/rspec/be_nil.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ def on_send(node)
4848
check_be_style(node)
4949
when :be_nil
5050
check_be_nil_style(node)
51-
else
52-
# :nocov:
53-
:noop
54-
# :nocov:
5551
end
5652
end
5753

lib/rubocop/cop/rspec/implicit_subject.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ def autocorrect(corrector, node)
107107
corrector.replace(node.location.selector, 'expect(subject).to')
108108
when :should_not
109109
corrector.replace(node.location.selector, 'expect(subject).not_to')
110-
else
111-
# :nocov:
112-
:noop
113-
# :nocov:
114110
end
115111
end
116112

@@ -133,10 +129,6 @@ def invalid?(node)
133129
implicit_subject_in_non_its_and_non_single_line?(node)
134130
when :single_statement_only
135131
implicit_subject_in_non_its_and_non_single_statement?(node)
136-
else
137-
# :nocov:
138-
:noop
139-
# :nocov:
140132
end
141133
end
142134

lib/rubocop/cop/rspec/message_spies.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ def error_message(receiver)
8080
MSG_RECEIVE
8181
when :have_received
8282
format(MSG_HAVE_RECEIVED, source: receiver.source)
83-
else
84-
# :nocov:
85-
:noop
86-
# :nocov:
8783
end
8884
end
8985
end

lib/rubocop/cop/rspec/predicate_matcher.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ def true?(to_symbol, matcher)
116116
true
117117
when :be_falsey, :be_falsy, :a_falsey_value, :a_falsy_value
118118
false
119-
else
120-
# :nocov:
121-
:noop
122-
# :nocov:
123119
end
124120
to_symbol == :to ? result : !result
125121
end
@@ -333,10 +329,6 @@ def on_send(node)
333329
check_inflected(node)
334330
when :explicit
335331
check_explicit(node)
336-
else
337-
# :nocov:
338-
:noop
339-
# :nocov:
340332
end
341333
end
342334

lib/rubocop/cop/rspec/spec_file_path_format.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ def inflector
106106
ActiveSupportInflector
107107
when 'default'
108108
DefaultInflector
109-
else
110-
# :nocov:
111-
:noop
112-
# :nocov:
113109
end
114110
end
115111

lib/rubocop/rspec/plugin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module RuboCop
66
module RSpec
77
# A plugin that integrates RuboCop RSpec with RuboCop's plugin system.
88
class Plugin < LintRoller::Plugin
9-
# :nocov:
9+
# simplecov:disable
1010
def about
1111
LintRoller::About.new(
1212
name: 'rubocop-rspec',
@@ -15,7 +15,7 @@ def about
1515
description: 'Code style checking for RSpec files.'
1616
)
1717
end
18-
# :nocov:
18+
# simplecov:enable
1919

2020
def supported?(context)
2121
context.engine == :rubocop

spec/spec_helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
require 'rubocop'
44
require 'rubocop/rspec/support'
55

6-
require 'simplecov' unless ENV['NO_COVERAGE']
6+
unless ENV['NO_COVERAGE']
7+
require 'simplecov'
8+
SimpleCov.start
9+
end
710

811
module SpecHelper
912
ROOT = Pathname.new(__dir__).parent.freeze

0 commit comments

Comments
 (0)