brew vendor-gems: commit updates.
This commit is contained in:
parent
e62cc946c6
commit
9bf4f0ebb6
@ -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-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-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/ruby-macho-2.5.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
|
||||
|
||||
@ -148,6 +148,12 @@ RSpec/ContextWording:
|
||||
RSpec/DescribeClass:
|
||||
Description: Check that the first argument to the top-level describe is a constant.
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- "**/spec/features/**/*"
|
||||
- "**/spec/requests/**/*"
|
||||
- "**/spec/routing/**/*"
|
||||
- "**/spec/system/**/*"
|
||||
- "**/spec/views/**/*"
|
||||
IgnoredMetadata:
|
||||
type:
|
||||
- channel
|
||||
@ -164,7 +170,7 @@ RSpec/DescribeClass:
|
||||
- mailbox
|
||||
- aruba
|
||||
VersionAdded: '1.0'
|
||||
VersionChanged: '1.44'
|
||||
VersionChanged: '2.5'
|
||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
||||
|
||||
RSpec/DescribeMethod:
|
||||
@ -269,6 +275,12 @@ RSpec/ExampleWithoutDescription:
|
||||
VersionAdded: '1.22'
|
||||
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:
|
||||
Description: Checks for common mistakes in example descriptions.
|
||||
Enabled: true
|
||||
@ -297,7 +309,9 @@ RSpec/ExpectChange:
|
||||
SupportedStyles:
|
||||
- method_call
|
||||
- block
|
||||
SafeAutoCorrect: false
|
||||
VersionAdded: '1.22'
|
||||
VersionChanged: '2.5'
|
||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
||||
|
||||
RSpec/ExpectInHook:
|
||||
@ -643,6 +657,12 @@ RSpec/StubbedMock:
|
||||
VersionAdded: '1.44'
|
||||
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:
|
||||
Description: Checks for stubbed test subjects.
|
||||
Enabled: true
|
||||
@ -36,7 +36,10 @@ module RuboCop
|
||||
def on_block(node)
|
||||
empty_hook?(node) do |hook|
|
||||
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)
|
||||
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
|
||||
#
|
||||
# # good
|
||||
# # bad
|
||||
# before do
|
||||
# # ...
|
||||
# end
|
||||
@ -48,6 +48,8 @@ module RuboCop
|
||||
end
|
||||
|
||||
def only_expectations?(body, arg)
|
||||
return false unless body.each_child_node.any?
|
||||
|
||||
body.each_child_node.all? { |child| expectation?(child, arg) }
|
||||
end
|
||||
end
|
||||
@ -6,7 +6,7 @@ module RuboCop
|
||||
# Checks for nested example groups.
|
||||
#
|
||||
# This cop is configurable using the `Max` option
|
||||
# and supports `--auto-gen-config
|
||||
# and supports `--auto-gen-config`.
|
||||
#
|
||||
# @example
|
||||
# # 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
|
||||
@ -40,6 +40,7 @@ require_relative 'rspec/empty_line_after_subject'
|
||||
require_relative 'rspec/example_length'
|
||||
require_relative 'rspec/example_without_description'
|
||||
require_relative 'rspec/example_wording'
|
||||
require_relative 'rspec/excessive_docstring_spacing'
|
||||
require_relative 'rspec/expect_actual'
|
||||
require_relative 'rspec/expect_change'
|
||||
require_relative 'rspec/expect_in_hook'
|
||||
@ -88,6 +89,7 @@ require_relative 'rspec/shared_context'
|
||||
require_relative 'rspec/shared_examples'
|
||||
require_relative 'rspec/single_argument_message_chain'
|
||||
require_relative 'rspec/stubbed_mock'
|
||||
require_relative 'rspec/subject_declaration'
|
||||
require_relative 'rspec/subject_stub'
|
||||
require_relative 'rspec/unspecified_exception'
|
||||
require_relative 'rspec/variable_definition'
|
||||
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