Merge pull request #12111 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.5.0
build(deps): bump rubocop-rspec from 2.4.0 to 2.5.0 in /Library/Homebrew
This commit is contained in:
commit
9fbdd6eed6
@ -143,9 +143,8 @@ GEM
|
|||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.7.0, < 2.0)
|
rubocop (>= 1.7.0, < 2.0)
|
||||||
rubocop-rspec (2.4.0)
|
rubocop-rspec (2.5.0)
|
||||||
rubocop (~> 1.0)
|
rubocop (~> 1.19)
|
||||||
rubocop-ast (>= 1.1.0)
|
|
||||||
rubocop-sorbet (0.6.2)
|
rubocop-sorbet (0.6.2)
|
||||||
rubocop
|
rubocop
|
||||||
ruby-macho (2.5.1)
|
ruby-macho (2.5.1)
|
||||||
|
|||||||
@ -453,6 +453,23 @@ RuboCop::Cop::RSpec::ExampleWording::MSG_IT = T.let(T.unsafe(nil), String)
|
|||||||
RuboCop::Cop::RSpec::ExampleWording::MSG_SHOULD = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::ExampleWording::MSG_SHOULD = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::RSpec::ExampleWording::SHOULD_PREFIX = T.let(T.unsafe(nil), Regexp)
|
RuboCop::Cop::RSpec::ExampleWording::SHOULD_PREFIX = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::ExcessiveDocstringSpacing < ::RuboCop::Cop::RSpec::Base
|
||||||
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
|
def example_description(param0 = T.unsafe(nil)); end
|
||||||
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def add_whitespace_offense(node, text); end
|
||||||
|
def docstring(node); end
|
||||||
|
def excessive_whitespace?(text); end
|
||||||
|
def strip_excessive_whitespace(text); end
|
||||||
|
def text(node); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::ExcessiveDocstringSpacing::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::ExpectActual < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::ExpectActual < ::RuboCop::Cop::RSpec::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
@ -1423,6 +1440,18 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::StubbedMock::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::StubbedMock::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::SubjectDeclaration < ::RuboCop::Cop::RSpec::Base
|
||||||
|
def offensive_subject_declaration?(param0 = T.unsafe(nil)); end
|
||||||
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def message_for(offense); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::SubjectDeclaration::MSG_LET = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::SubjectDeclaration::MSG_REDUNDANT = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::SubjectStub < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::SubjectStub < ::RuboCop::Cop::RSpec::Base
|
||||||
include ::RuboCop::Cop::RSpec::TopLevelGroup
|
include ::RuboCop::Cop::RSpec::TopLevelGroup
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ describe Homebrew::Livecheck::SkipConditions do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when a formula is HEAD-only and not installed" do
|
context "when a formula is HEAD-only and not installed" do
|
||||||
it "skips " do
|
it "skips" do
|
||||||
expect(skip_conditions.skip_information(formulae[:head_only]))
|
expect(skip_conditions.skip_information(formulae[:head_only]))
|
||||||
.to eq(status_hashes[:formula][:head_only])
|
.to eq(status_hashes[:formula][:head_only])
|
||||||
end
|
end
|
||||||
@ -389,7 +389,7 @@ describe Homebrew::Livecheck::SkipConditions do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when a formula is HEAD-only and not installed" do
|
context "when a formula is HEAD-only and not installed" do
|
||||||
it "skips " do
|
it "skips" do
|
||||||
expect(skip_conditions.referenced_skip_information(formulae[:head_only], original_name))
|
expect(skip_conditions.referenced_skip_information(formulae[:head_only], original_name))
|
||||||
.to eq(status_hashes[:formula][:head_only].merge({ formula: original_name }))
|
.to eq(status_hashes[:formula][:head_only].merge({ formula: original_name }))
|
||||||
end
|
end
|
||||||
|
|||||||
@ -90,7 +90,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.20.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.20.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.5/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.5/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.4.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.5.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
|
||||||
|
|||||||
@ -148,6 +148,12 @@ RSpec/ContextWording:
|
|||||||
RSpec/DescribeClass:
|
RSpec/DescribeClass:
|
||||||
Description: Check that the first argument to the top-level describe is a constant.
|
Description: Check that the first argument to the top-level describe is a constant.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- "**/spec/features/**/*"
|
||||||
|
- "**/spec/requests/**/*"
|
||||||
|
- "**/spec/routing/**/*"
|
||||||
|
- "**/spec/system/**/*"
|
||||||
|
- "**/spec/views/**/*"
|
||||||
IgnoredMetadata:
|
IgnoredMetadata:
|
||||||
type:
|
type:
|
||||||
- channel
|
- channel
|
||||||
@ -164,7 +170,7 @@ RSpec/DescribeClass:
|
|||||||
- mailbox
|
- mailbox
|
||||||
- aruba
|
- aruba
|
||||||
VersionAdded: '1.0'
|
VersionAdded: '1.0'
|
||||||
VersionChanged: '1.44'
|
VersionChanged: '2.5'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
||||||
|
|
||||||
RSpec/DescribeMethod:
|
RSpec/DescribeMethod:
|
||||||
@ -269,6 +275,12 @@ RSpec/ExampleWithoutDescription:
|
|||||||
VersionAdded: '1.22'
|
VersionAdded: '1.22'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
||||||
|
|
||||||
|
RSpec/ExcessiveDocstringSpacing:
|
||||||
|
Description: Checks for excessive whitespace in example descriptions.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.5'
|
||||||
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
||||||
|
|
||||||
RSpec/ExampleWording:
|
RSpec/ExampleWording:
|
||||||
Description: Checks for common mistakes in example descriptions.
|
Description: Checks for common mistakes in example descriptions.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -297,7 +309,9 @@ RSpec/ExpectChange:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- method_call
|
- method_call
|
||||||
- block
|
- block
|
||||||
|
SafeAutoCorrect: false
|
||||||
VersionAdded: '1.22'
|
VersionAdded: '1.22'
|
||||||
|
VersionChanged: '2.5'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
||||||
|
|
||||||
RSpec/ExpectInHook:
|
RSpec/ExpectInHook:
|
||||||
@ -643,6 +657,12 @@ RSpec/StubbedMock:
|
|||||||
VersionAdded: '1.44'
|
VersionAdded: '1.44'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
|
||||||
|
|
||||||
|
RSpec/SubjectDeclaration:
|
||||||
|
Description: Ensure that subject is defined using subject helper.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.5'
|
||||||
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
|
||||||
|
|
||||||
RSpec/SubjectStub:
|
RSpec/SubjectStub:
|
||||||
Description: Checks for stubbed test subjects.
|
Description: Checks for stubbed test subjects.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -36,7 +36,10 @@ module RuboCop
|
|||||||
def on_block(node)
|
def on_block(node)
|
||||||
empty_hook?(node) do |hook|
|
empty_hook?(node) do |hook|
|
||||||
add_offense(hook) do |corrector|
|
add_offense(hook) do |corrector|
|
||||||
range = range_with_surrounding_space(range: node.loc.expression)
|
range = range_with_surrounding_space(
|
||||||
|
range: node.loc.expression,
|
||||||
|
side: :left
|
||||||
|
)
|
||||||
corrector.remove(range)
|
corrector.remove(range)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module RSpec
|
||||||
|
# Checks for excessive whitespace in example descriptions.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
# # bad
|
||||||
|
# it ' has excessive spacing ' do
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# it 'has excessive spacing' do
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
# # bad
|
||||||
|
# context ' when a condition is met ' do
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# context 'when a condition is met' do
|
||||||
|
# end
|
||||||
|
class ExcessiveDocstringSpacing < Base
|
||||||
|
extend AutoCorrector
|
||||||
|
|
||||||
|
MSG = 'Excessive whitespace.'
|
||||||
|
|
||||||
|
# @!method example_description(node)
|
||||||
|
def_node_matcher :example_description, <<-PATTERN
|
||||||
|
(send _ {#Examples.all #ExampleGroups.all} ${
|
||||||
|
$str
|
||||||
|
$(dstr ({str dstr `sym} ...) ...)
|
||||||
|
} ...)
|
||||||
|
PATTERN
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
example_description(node) do |description_node, message|
|
||||||
|
text = text(message)
|
||||||
|
|
||||||
|
return unless excessive_whitespace?(text)
|
||||||
|
|
||||||
|
add_whitespace_offense(description_node, text)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# @param text [String]
|
||||||
|
def excessive_whitespace?(text)
|
||||||
|
text.start_with?(' ') || text.include?(' ') || text.end_with?(' ')
|
||||||
|
end
|
||||||
|
|
||||||
|
# @param text [String]
|
||||||
|
def strip_excessive_whitespace(text)
|
||||||
|
text.strip.gsub(/ +/, ' ')
|
||||||
|
end
|
||||||
|
|
||||||
|
# @param node [RuboCop::AST::Node]
|
||||||
|
# @param text [String]
|
||||||
|
def add_whitespace_offense(node, text)
|
||||||
|
docstring = docstring(node)
|
||||||
|
corrected = strip_excessive_whitespace(text)
|
||||||
|
|
||||||
|
add_offense(docstring) do |corrector|
|
||||||
|
corrector.replace(docstring, corrected)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def docstring(node)
|
||||||
|
expr = node.loc.expression
|
||||||
|
|
||||||
|
Parser::Source::Range.new(
|
||||||
|
expr.source_buffer,
|
||||||
|
expr.begin_pos + 1,
|
||||||
|
expr.end_pos - 1
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Recursive processing is required to process nested dstr nodes
|
||||||
|
# that is the case for \-separated multiline strings with interpolation.
|
||||||
|
def text(node)
|
||||||
|
case node.type
|
||||||
|
when :dstr
|
||||||
|
node.node_parts.map { |child_node| text(child_node) }.join
|
||||||
|
when :str, :sym
|
||||||
|
node.value
|
||||||
|
when :begin
|
||||||
|
node.source
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -32,7 +32,7 @@ module RuboCop
|
|||||||
# # ...
|
# # ...
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# # good
|
# # bad
|
||||||
# before do
|
# before do
|
||||||
# # ...
|
# # ...
|
||||||
# end
|
# end
|
||||||
@ -48,6 +48,8 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def only_expectations?(body, arg)
|
def only_expectations?(body, arg)
|
||||||
|
return false unless body.each_child_node.any?
|
||||||
|
|
||||||
body.each_child_node.all? { |child| expectation?(child, arg) }
|
body.each_child_node.all? { |child| expectation?(child, arg) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -6,7 +6,7 @@ module RuboCop
|
|||||||
# Checks for nested example groups.
|
# Checks for nested example groups.
|
||||||
#
|
#
|
||||||
# This cop is configurable using the `Max` option
|
# This cop is configurable using the `Max` option
|
||||||
# and supports `--auto-gen-config
|
# and supports `--auto-gen-config`.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module RSpec
|
||||||
|
# Ensure that subject is defined using subject helper.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
#
|
||||||
|
# # bad
|
||||||
|
# let(:subject) { foo }
|
||||||
|
# let!(:subject) { foo }
|
||||||
|
# subject(:subject) { foo }
|
||||||
|
# subject!(:subject) { foo }
|
||||||
|
#
|
||||||
|
# # bad
|
||||||
|
# block = -> {}
|
||||||
|
# let(:subject, &block)
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# subject(:test_subject) { foo }
|
||||||
|
#
|
||||||
|
class SubjectDeclaration < Base
|
||||||
|
MSG_LET = 'Use subject explicitly rather than using let'
|
||||||
|
MSG_REDUNDANT = 'Ambiguous declaration of subject'
|
||||||
|
|
||||||
|
# @!method offensive_subject_declaration?(node)
|
||||||
|
def_node_matcher :offensive_subject_declaration?, <<~PATTERN
|
||||||
|
(send nil? ${#Subjects.all #Helpers.all} {(sym :subject) (str "subject")} ...)
|
||||||
|
PATTERN
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
offense = offensive_subject_declaration?(node)
|
||||||
|
return unless offense
|
||||||
|
|
||||||
|
add_offense(node, message: message_for(offense))
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def message_for(offense)
|
||||||
|
Helpers.all(offense) ? MSG_LET : MSG_REDUNDANT
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user