commit
c04b9d1b10
4
.gitignore
vendored
4
.gitignore
vendored
@ -82,6 +82,7 @@
|
|||||||
# Ignore dependencies we don't wish to vendor
|
# Ignore dependencies we don't wish to vendor
|
||||||
**/vendor/bundle/ruby/*/gems/ast-*/
|
**/vendor/bundle/ruby/*/gems/ast-*/
|
||||||
**/vendor/bundle/ruby/*/gems/bundler-*/
|
**/vendor/bundle/ruby/*/gems/bundler-*/
|
||||||
|
**/vendor/bundle/ruby/*/gems/byebug-*/
|
||||||
**/vendor/bundle/ruby/*/gems/coderay-*/
|
**/vendor/bundle/ruby/*/gems/coderay-*/
|
||||||
**/vendor/bundle/ruby/*/gems/connection_pool-*/
|
**/vendor/bundle/ruby/*/gems/connection_pool-*/
|
||||||
**/vendor/bundle/ruby/*/gems/coveralls-*/
|
**/vendor/bundle/ruby/*/gems/coveralls-*/
|
||||||
@ -127,6 +128,8 @@
|
|||||||
**/vendor/bundle/ruby/*/gems/simplecov-*/
|
**/vendor/bundle/ruby/*/gems/simplecov-*/
|
||||||
**/vendor/bundle/ruby/*/gems/simplecov-cobertura-*/
|
**/vendor/bundle/ruby/*/gems/simplecov-cobertura-*/
|
||||||
**/vendor/bundle/ruby/*/gems/simplecov-html-*/
|
**/vendor/bundle/ruby/*/gems/simplecov-html-*/
|
||||||
|
**/vendor/bundle/ruby/*/gems/sorbet-*/
|
||||||
|
**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/
|
||||||
**/vendor/bundle/ruby/*/gems/term-ansicolor-*/
|
**/vendor/bundle/ruby/*/gems/term-ansicolor-*/
|
||||||
**/vendor/bundle/ruby/*/gems/thor-*/
|
**/vendor/bundle/ruby/*/gems/thor-*/
|
||||||
**/vendor/bundle/ruby/*/gems/tins-*/
|
**/vendor/bundle/ruby/*/gems/tins-*/
|
||||||
@ -134,7 +137,6 @@
|
|||||||
**/vendor/bundle/ruby/*/gems/unf-*/
|
**/vendor/bundle/ruby/*/gems/unf-*/
|
||||||
**/vendor/bundle/ruby/*/gems/unicode-display_width-*/
|
**/vendor/bundle/ruby/*/gems/unicode-display_width-*/
|
||||||
**/vendor/bundle/ruby/*/gems/webrobots-*/
|
**/vendor/bundle/ruby/*/gems/webrobots-*/
|
||||||
**/vendor/bundle/ruby/*/gems/byebug-*/
|
|
||||||
|
|
||||||
# Ignore `bin` contents (again).
|
# Ignore `bin` contents (again).
|
||||||
/bin
|
/bin
|
||||||
|
@ -5,6 +5,7 @@ source "https://rubygems.org"
|
|||||||
# installed gems
|
# installed gems
|
||||||
gem "byebug"
|
gem "byebug"
|
||||||
gem "coveralls", "~> 0.8", require: false
|
gem "coveralls", "~> 0.8", require: false
|
||||||
|
gem "json", require: false
|
||||||
gem "parallel_tests"
|
gem "parallel_tests"
|
||||||
gem "ronn", require: false
|
gem "ronn", require: false
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
@ -14,6 +15,11 @@ gem "rspec-wait", require: false
|
|||||||
gem "rubocop"
|
gem "rubocop"
|
||||||
gem "simplecov", require: false
|
gem "simplecov", require: false
|
||||||
|
|
||||||
|
if ENV["HOMEBREW_SORBET"]
|
||||||
|
gem "sorbet"
|
||||||
|
gem "sorbet-runtime"
|
||||||
|
end
|
||||||
|
|
||||||
# vendored gems
|
# vendored gems
|
||||||
gem "activesupport"
|
gem "activesupport"
|
||||||
gem "concurrent-ruby"
|
gem "concurrent-ruby"
|
||||||
|
@ -7,7 +7,7 @@ GEM
|
|||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
zeitwerk (~> 2.2, >= 2.2.2)
|
zeitwerk (~> 2.2, >= 2.2.2)
|
||||||
ast (2.4.0)
|
ast (2.4.1)
|
||||||
byebug (11.1.3)
|
byebug (11.1.3)
|
||||||
concurrent-ruby (1.1.6)
|
concurrent-ruby (1.1.6)
|
||||||
connection_pool (2.2.3)
|
connection_pool (2.2.3)
|
||||||
@ -49,7 +49,7 @@ GEM
|
|||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
ntlm-http (0.1.1)
|
ntlm-http (0.1.1)
|
||||||
parallel (1.19.1)
|
parallel (1.19.1)
|
||||||
parallel_tests (2.32.0)
|
parallel_tests (3.0.0)
|
||||||
parallel
|
parallel
|
||||||
parser (2.7.1.3)
|
parser (2.7.1.3)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
@ -95,7 +95,7 @@ GEM
|
|||||||
parser (>= 2.7.0.1)
|
parser (>= 2.7.0.1)
|
||||||
rubocop-performance (1.6.1)
|
rubocop-performance (1.6.1)
|
||||||
rubocop (>= 0.71.0)
|
rubocop (>= 0.71.0)
|
||||||
rubocop-rspec (1.39.0)
|
rubocop-rspec (1.40.0)
|
||||||
rubocop (>= 0.68.1)
|
rubocop (>= 0.68.1)
|
||||||
ruby-macho (2.2.0)
|
ruby-macho (2.2.0)
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.10.1)
|
||||||
@ -128,6 +128,7 @@ DEPENDENCIES
|
|||||||
byebug
|
byebug
|
||||||
concurrent-ruby
|
concurrent-ruby
|
||||||
coveralls (~> 0.8)
|
coveralls (~> 0.8)
|
||||||
|
json
|
||||||
mechanize
|
mechanize
|
||||||
parallel_tests
|
parallel_tests
|
||||||
plist
|
plist
|
||||||
|
@ -133,8 +133,8 @@ then
|
|||||||
# shellcheck disable=SC2086,SC2183
|
# shellcheck disable=SC2086,SC2183
|
||||||
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
|
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
|
||||||
|
|
||||||
# Refuse to run on pre-Mavericks
|
# Refuse to run on pre-Yosemite
|
||||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" ]]
|
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
|
||||||
then
|
then
|
||||||
printf "ERROR: Your version of macOS (%s) is too old to run Homebrew!\\n" "$HOMEBREW_MACOS_VERSION" >&2
|
printf "ERROR: Your version of macOS (%s) is too old to run Homebrew!\\n" "$HOMEBREW_MACOS_VERSION" >&2
|
||||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100700" ]]
|
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100700" ]]
|
||||||
@ -144,15 +144,6 @@ then
|
|||||||
printf "\\n" >&2
|
printf "\\n" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The system Curl is too old for some modern HTTPS certificates on
|
|
||||||
# older macOS versions.
|
|
||||||
#
|
|
||||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
|
|
||||||
then
|
|
||||||
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
|
|
||||||
HOMEBREW_FORCE_BREWED_CURL="1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on.
|
# The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on.
|
||||||
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
|
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
|
||||||
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]
|
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]
|
||||||
|
@ -310,10 +310,16 @@ module Cask
|
|||||||
return if cask.appcast.must_contain == :no_check
|
return if cask.appcast.must_contain == :no_check
|
||||||
|
|
||||||
appcast_stanza = cask.appcast.to_s
|
appcast_stanza = cask.appcast.to_s
|
||||||
appcast_contents, = curl_output("--compressed", "--user-agent", HOMEBREW_USER_AGENT_FAKE_SAFARI, "--location",
|
appcast_contents, = begin
|
||||||
|
curl_output("--compressed", "--user-agent", HOMEBREW_USER_AGENT_FAKE_SAFARI, "--location",
|
||||||
"--globoff", "--max-time", "5", appcast_stanza)
|
"--globoff", "--max-time", "5", appcast_stanza)
|
||||||
|
rescue
|
||||||
|
add_error "appcast at URL '#{appcast_stanza}' offline or looping"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
version_stanza = cask.version.to_s
|
version_stanza = cask.version.to_s
|
||||||
adjusted_version_stanza = if cask.appcast.configuration.blank?
|
adjusted_version_stanza = if cask.appcast.must_contain.blank?
|
||||||
version_stanza.match(/^[[:alnum:].]+/)[0]
|
version_stanza.match(/^[[:alnum:].]+/)[0]
|
||||||
else
|
else
|
||||||
cask.appcast.must_contain
|
cask.appcast.must_contain
|
||||||
@ -322,8 +328,6 @@ module Cask
|
|||||||
|
|
||||||
add_warning "appcast at URL '#{appcast_stanza}' does not contain"\
|
add_warning "appcast at URL '#{appcast_stanza}' does not contain"\
|
||||||
" the version number '#{adjusted_version_stanza}':\n#{appcast_contents}"
|
" the version number '#{adjusted_version_stanza}':\n#{appcast_contents}"
|
||||||
rescue
|
|
||||||
add_error "appcast at URL '#{appcast_stanza}' offline or looping"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_github_repository
|
def check_github_repository
|
||||||
|
@ -17,27 +17,17 @@ if [[ -n "$HOMEBREW_MACOS" ]]
|
|||||||
then
|
then
|
||||||
if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
|
if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
|
||||||
then
|
then
|
||||||
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz"
|
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3_1.yosemite.bottle.tar.gz"
|
||||||
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.mavericks.bottle.tar.gz"
|
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_1/portable-ruby-2.6.3_1.yosemite.bottle.tar.gz"
|
||||||
ruby_SHA="ab81211a2052ccaa6d050741c433b728d0641523d8742eef23a5b450811e5104"
|
ruby_SHA="be48eade040e13e0e572300ba59cf43d5750f53a4f35d2051966a0194e3c0ab2"
|
||||||
fi
|
fi
|
||||||
elif [[ -n "$HOMEBREW_LINUX" ]]
|
elif [[ -n "$HOMEBREW_LINUX" ]]
|
||||||
then
|
then
|
||||||
case "$HOMEBREW_PROCESSOR" in
|
case "$HOMEBREW_PROCESSOR" in
|
||||||
x86_64)
|
x86_64)
|
||||||
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz"
|
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3_1.x86_64_linux.bottle.tar.gz"
|
||||||
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz"
|
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_1/portable-ruby-2.6.3_1.x86_64_linux.bottle.tar.gz"
|
||||||
ruby_SHA="e8c9b6d3dc5f40844e07b4b694897b8b7cb5a7dab1013b3b8712a22868f98c98"
|
ruby_SHA="f5731ca80497c31ab1171ece4102e2104d9b6cd31aa7b35926e80829d4b0ce29"
|
||||||
;;
|
|
||||||
aarch64)
|
|
||||||
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3.aarch64_linux.bottle.tar.gz"
|
|
||||||
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.aarch64_linux.bottle.tar.gz"
|
|
||||||
ruby_SHA="c0b08e2835897af74948508a004d30380b8bcf14264e0dcce194e2c199fb1e35"
|
|
||||||
;;
|
|
||||||
armv[67]*)
|
|
||||||
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.6.3.armv6_linux.bottle.tar.gz"
|
|
||||||
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby-2.6.3.armv6_linux.bottle.tar.gz"
|
|
||||||
ruby_SHA="78e36e4671fd08790bfbfda4408d559341c9872bf48a4f6eab78157a3bf3efa6"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
2047
Library/Homebrew/data/spdx.json
Normal file
2047
Library/Homebrew/data/spdx.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@ require "date"
|
|||||||
require "missing_formula"
|
require "missing_formula"
|
||||||
require "digest"
|
require "digest"
|
||||||
require "cli/parser"
|
require "cli/parser"
|
||||||
|
require "json"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
@ -109,7 +110,11 @@ module Homebrew
|
|||||||
|
|
||||||
# Check style in a single batch run up front for performance
|
# Check style in a single batch run up front for performance
|
||||||
style_results = Style.check_style_json(style_files, options) if style_files
|
style_results = Style.check_style_json(style_files, options) if style_files
|
||||||
|
# load licenses
|
||||||
|
full_path = File.join(File.dirname(__FILE__), "../data/spdx.json")
|
||||||
|
spdx_ids = File.open(full_path, "r") do |f|
|
||||||
|
JSON.parse(f.read)
|
||||||
|
end
|
||||||
new_formula_problem_lines = []
|
new_formula_problem_lines = []
|
||||||
audit_formulae.sort.each do |f|
|
audit_formulae.sort.each do |f|
|
||||||
only = only_cops ? ["style"] : args.only
|
only = only_cops ? ["style"] : args.only
|
||||||
@ -120,6 +125,7 @@ module Homebrew
|
|||||||
git: git,
|
git: git,
|
||||||
only: only,
|
only: only,
|
||||||
except: args.except,
|
except: args.except,
|
||||||
|
spdx_ids: spdx_ids,
|
||||||
}
|
}
|
||||||
options[:style_offenses] = style_results.file_offenses(f.path) if style_results
|
options[:style_offenses] = style_results.file_offenses(f.path) if style_results
|
||||||
options[:display_cop_names] = args.display_cop_names?
|
options[:display_cop_names] = args.display_cop_names?
|
||||||
@ -223,6 +229,7 @@ module Homebrew
|
|||||||
@new_formula_problems = []
|
@new_formula_problems = []
|
||||||
@text = FormulaText.new(formula.path)
|
@text = FormulaText.new(formula.path)
|
||||||
@specs = %w[stable devel head].map { |s| formula.send(s) }.compact
|
@specs = %w[stable devel head].map { |s| formula.send(s) }.compact
|
||||||
|
@spdx_ids = options[:spdx_ids]
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_style
|
def audit_style
|
||||||
@ -341,6 +348,40 @@ module Homebrew
|
|||||||
openssl@1.1
|
openssl@1.1
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
def audit_license
|
||||||
|
if !formula.license.blank?
|
||||||
|
if @spdx_ids.key?(formula.license)
|
||||||
|
return unless @online
|
||||||
|
|
||||||
|
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}, false)
|
||||||
|
return if user.nil?
|
||||||
|
|
||||||
|
github_license = get_repo_license_data(user, repo)
|
||||||
|
return if github_license && (github_license == formula.license)
|
||||||
|
|
||||||
|
problem "License mismatch - Github license is: #{github_license}, "\
|
||||||
|
"but Formulae license states: #{formula.license}."
|
||||||
|
else
|
||||||
|
problem "#{formula.license} is not a standard SPDX license id."
|
||||||
|
end
|
||||||
|
else
|
||||||
|
problem "No license specified for package."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_repo_license_data(user, repo)
|
||||||
|
return unless @online
|
||||||
|
|
||||||
|
begin
|
||||||
|
res = GitHub.open_api("#{GitHub::API_URL}/repos/#{user}/#{repo}/license")
|
||||||
|
return unless res.key?("license")
|
||||||
|
|
||||||
|
res["license"]["spdx_id"] || nil
|
||||||
|
rescue GitHub::HTTPNotFoundError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def audit_deps
|
def audit_deps
|
||||||
@specs.each do |spec|
|
@specs.each do |spec|
|
||||||
# Check for things we don't like to depend on.
|
# Check for things we don't like to depend on.
|
||||||
@ -545,10 +586,11 @@ module Homebrew
|
|||||||
new_formula_problem warning
|
new_formula_problem warning
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_repo_data(regex)
|
def get_repo_data(regex, new_formula_only = true)
|
||||||
return unless @core_tap
|
return unless @core_tap
|
||||||
return unless @online
|
return unless @online
|
||||||
return unless @new_formula
|
|
||||||
|
return unless @new_formula || !new_formula_only
|
||||||
|
|
||||||
_, user, repo = *regex.match(formula.stable.url) if formula.stable
|
_, user, repo = *regex.match(formula.stable.url) if formula.stable
|
||||||
_, user, repo = *regex.match(formula.homepage) unless user
|
_, user, repo = *regex.match(formula.homepage) unless user
|
||||||
|
9
Library/Homebrew/extend/os/linux/resource.rb
Normal file
9
Library/Homebrew/extend/os/linux/resource.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Resource
|
||||||
|
undef on_linux
|
||||||
|
|
||||||
|
def on_linux(&_block)
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
end
|
9
Library/Homebrew/extend/os/mac/resource.rb
Normal file
9
Library/Homebrew/extend/os/mac/resource.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Resource
|
||||||
|
undef on_macos
|
||||||
|
|
||||||
|
def on_macos(&_block)
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
end
|
7
Library/Homebrew/extend/os/resource.rb
Normal file
7
Library/Homebrew/extend/os/resource.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
if OS.mac?
|
||||||
|
require "extend/os/mac/resource"
|
||||||
|
elsif OS.linux?
|
||||||
|
require "extend/os/linux/resource"
|
||||||
|
end
|
@ -2485,13 +2485,13 @@ class Formula
|
|||||||
specs.each { |spec| spec.uses_from_macos(dep, bounds) }
|
specs.each { |spec| spec.uses_from_macos(dep, bounds) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Block executed only executed on macOS. No-op on Linux.
|
# Block only executed on macOS. No-op on Linux.
|
||||||
# <pre>on_macos do
|
# <pre>on_macos do
|
||||||
# depends_on "mac_only_dep"
|
# depends_on "mac_only_dep"
|
||||||
# end</pre>
|
# end</pre>
|
||||||
def on_macos(&_block); end
|
def on_macos(&_block); end
|
||||||
|
|
||||||
# Block executed only executed on Linux. No-op on macOS.
|
# Block only executed on Linux. No-op on macOS.
|
||||||
# <pre>on_linux do
|
# <pre>on_linux do
|
||||||
# depends_on "linux_only_dep"
|
# depends_on "linux_only_dep"
|
||||||
# end</pre>
|
# end</pre>
|
||||||
|
@ -178,6 +178,18 @@ class Resource
|
|||||||
patches << p
|
patches << p
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Block only executed on macOS. No-op on Linux.
|
||||||
|
# <pre>on_macos do
|
||||||
|
# url "mac_only_url"
|
||||||
|
# end</pre>
|
||||||
|
def on_macos(&_block); end
|
||||||
|
|
||||||
|
# Block only executed on Linux. No-op on macOS.
|
||||||
|
# <pre>on_linux do
|
||||||
|
# url "linux_only_url"
|
||||||
|
# end</pre>
|
||||||
|
def on_linux(&_block); end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def mktemp(prefix)
|
def mktemp(prefix)
|
||||||
@ -252,3 +264,5 @@ class ResourceStageContext
|
|||||||
"<#{self.class}: resource=#{resource} staging=#{staging}>"
|
"<#{self.class}: resource=#{resource} staging=#{staging}>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "extend/os/resource"
|
||||||
|
@ -95,6 +95,84 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#audit_license" do
|
||||||
|
let(:spdx_ids) {
|
||||||
|
full_path = File.join(File.dirname(__FILE__), "../../data/spdx.json")
|
||||||
|
File.open(full_path, "r") do |f|
|
||||||
|
JSON.parse(f.read)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
let(:custom_spdx_id) { "zzz" }
|
||||||
|
let(:standard_mismatch_spdx_id) { "0BSD" }
|
||||||
|
|
||||||
|
it "detects no license info" do
|
||||||
|
fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids
|
||||||
|
class Foo < Formula
|
||||||
|
url "https://brew.sh/foo-1.0.tgz"
|
||||||
|
license ""
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
fa.audit_license
|
||||||
|
p fa.problems
|
||||||
|
expect(fa.problems.first).to match "No license specified for package."
|
||||||
|
end
|
||||||
|
|
||||||
|
it "detects if license is not a standard spdx-id" do
|
||||||
|
fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids
|
||||||
|
class Foo < Formula
|
||||||
|
url "https://brew.sh/foo-1.0.tgz"
|
||||||
|
license "#{custom_spdx_id}"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
fa.audit_license
|
||||||
|
expect(fa.problems.first).to match "#{custom_spdx_id} is not a standard SPDX license id."
|
||||||
|
end
|
||||||
|
|
||||||
|
it "verifies that a license info is a standard spdx id" do
|
||||||
|
fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids
|
||||||
|
class Foo < Formula
|
||||||
|
url "https://brew.sh/foo-1.0.tgz"
|
||||||
|
license "0BSD"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
fa.audit_license
|
||||||
|
expect(fa.problems).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
it "checks online and verifies that a standard license id is the same "\
|
||||||
|
"as what is indicated on its Github repo" do
|
||||||
|
fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true, core_tap: true
|
||||||
|
class Cask < Formula
|
||||||
|
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||||
|
head "https://github.com/cask/cask.git"
|
||||||
|
license "GPL-3.0"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
fa.audit_license
|
||||||
|
expect(fa.problems).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
it "checks online and detects that a formula-specified license is not "\
|
||||||
|
"the same as what is indicated on its Github repository" do
|
||||||
|
fa = formula_auditor "cask", <<~RUBY, online: true, spdx_ids: spdx_ids, core_tap: true
|
||||||
|
class Cask < Formula
|
||||||
|
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||||
|
head "https://github.com/cask/cask.git"
|
||||||
|
license "#{standard_mismatch_spdx_id}"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
fa.audit_license
|
||||||
|
expect(fa.problems.first).to match "License mismatch - Github license is: GPL-3.0, "\
|
||||||
|
"but Formulae license states: #{standard_mismatch_spdx_id}."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#audit_file" do
|
describe "#audit_file" do
|
||||||
specify "DATA but no __END__" do
|
specify "DATA but no __END__" do
|
||||||
fa = formula_auditor "foo", <<~RUBY
|
fa = formula_auditor "foo", <<~RUBY
|
||||||
|
@ -33,26 +33,6 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#on_linux" do
|
|
||||||
it "defines an url on Linux only" do
|
|
||||||
f = formula do
|
|
||||||
homepage "https://brew.sh"
|
|
||||||
|
|
||||||
on_macos do
|
|
||||||
url "https://brew.sh/test-macos-0.1.tbz"
|
|
||||||
sha256 TEST_SHA256
|
|
||||||
end
|
|
||||||
|
|
||||||
on_linux do
|
|
||||||
url "https://brew.sh/test-linux-0.1.tbz"
|
|
||||||
sha256 TEST_SHA256
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(f.stable.url).to eq("https://brew.sh/test-linux-0.1.tbz")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#on_linux" do
|
describe "#on_linux" do
|
||||||
it "adds a dependency on Linux only" do
|
it "adds a dependency on Linux only" do
|
||||||
f = formula do
|
f = formula do
|
||||||
@ -87,27 +67,38 @@ describe Formula do
|
|||||||
sha256 TEST_SHA256
|
sha256 TEST_SHA256
|
||||||
|
|
||||||
patch do
|
patch do
|
||||||
url "patch_both"
|
|
||||||
end
|
|
||||||
|
|
||||||
on_macos do
|
on_macos do
|
||||||
patch do
|
|
||||||
url "patch_macos"
|
url "patch_macos"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
on_linux do
|
on_linux do
|
||||||
patch do
|
|
||||||
url "patch_linux"
|
url "patch_linux"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(f.patchlist.length).to eq(2)
|
expect(f.patchlist.length).to eq(1)
|
||||||
expect(f.patchlist.first.strip).to eq(:p1)
|
expect(f.patchlist.first.strip).to eq(:p1)
|
||||||
expect(f.patchlist.first.url).to eq("patch_both")
|
expect(f.patchlist.first.url).to eq("patch_linux")
|
||||||
expect(f.patchlist.second.strip).to eq(:p1)
|
end
|
||||||
expect(f.patchlist.second.url).to eq("patch_linux")
|
end
|
||||||
|
|
||||||
|
describe "#on_linux" do
|
||||||
|
it "uses on_linux within a resource block" do
|
||||||
|
f = formula do
|
||||||
|
homepage "https://brew.sh"
|
||||||
|
|
||||||
|
url "https://brew.sh/test-0.1.tbz"
|
||||||
|
sha256 TEST_SHA256
|
||||||
|
|
||||||
|
resource "test_resource" do
|
||||||
|
on_linux do
|
||||||
|
url "on_linux"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
expect(f.resources.length).to eq(1)
|
||||||
|
expect(f.resources.first.url).to eq("on_linux")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,26 +40,6 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#on_macos" do
|
|
||||||
it "defines an url on macos only" do
|
|
||||||
f = formula do
|
|
||||||
homepage "https://brew.sh"
|
|
||||||
|
|
||||||
on_macos do
|
|
||||||
url "https://brew.sh/test-macos-0.1.tbz"
|
|
||||||
sha256 TEST_SHA256
|
|
||||||
end
|
|
||||||
|
|
||||||
on_linux do
|
|
||||||
url "https://brew.sh/test-linux-0.1.tbz"
|
|
||||||
sha256 TEST_SHA256
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(f.stable.url).to eq("https://brew.sh/test-macos-0.1.tbz")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#on_macos" do
|
describe "#on_macos" do
|
||||||
it "adds a dependency on macos only" do
|
it "adds a dependency on macos only" do
|
||||||
f = formula do
|
f = formula do
|
||||||
@ -86,7 +66,7 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#on_macos" do
|
describe "#on_macos" do
|
||||||
it "adds a patch on macos only" do
|
it "adds a patch on Mac only" do
|
||||||
f = formula do
|
f = formula do
|
||||||
homepage "https://brew.sh"
|
homepage "https://brew.sh"
|
||||||
|
|
||||||
@ -94,27 +74,38 @@ describe Formula do
|
|||||||
sha256 TEST_SHA256
|
sha256 TEST_SHA256
|
||||||
|
|
||||||
patch do
|
patch do
|
||||||
url "patch_both"
|
|
||||||
end
|
|
||||||
|
|
||||||
on_macos do
|
on_macos do
|
||||||
patch do
|
|
||||||
url "patch_macos"
|
url "patch_macos"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
on_linux do
|
on_linux do
|
||||||
patch do
|
|
||||||
url "patch_linux"
|
url "patch_linux"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(f.patchlist.length).to eq(2)
|
expect(f.patchlist.length).to eq(1)
|
||||||
expect(f.patchlist.first.strip).to eq(:p1)
|
expect(f.patchlist.first.strip).to eq(:p1)
|
||||||
expect(f.patchlist.first.url).to eq("patch_both")
|
expect(f.patchlist.first.url).to eq("patch_macos")
|
||||||
expect(f.patchlist.second.strip).to eq(:p1)
|
end
|
||||||
expect(f.patchlist.second.url).to eq("patch_macos")
|
end
|
||||||
|
|
||||||
|
describe "#on_macos" do
|
||||||
|
it "uses on_macos within a resource block" do
|
||||||
|
f = formula do
|
||||||
|
homepage "https://brew.sh"
|
||||||
|
|
||||||
|
url "https://brew.sh/test-0.1.tbz"
|
||||||
|
sha256 TEST_SHA256
|
||||||
|
|
||||||
|
resource "test_resource" do
|
||||||
|
on_macos do
|
||||||
|
url "resource_macos"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
expect(f.resources.length).to eq(1)
|
||||||
|
expect(f.resources.first.url).to eq("resource_macos")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
10
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
10
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
@ -10,7 +10,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.3.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.3.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.1/lib"
|
||||||
$:.unshift "#{path}/"
|
$:.unshift "#{path}/"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/byebug-11.1.3"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/byebug-11.1.3"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib"
|
||||||
@ -45,13 +45,13 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib"
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-2.32.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.0.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.7.1.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.7.1.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.1"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.1"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-1.7.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-1.7.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rexml-3.2.4/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rexml-3.2.4/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.9.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.9.3/lib"
|
||||||
@ -65,7 +65,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.0.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.0.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.85.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.85.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.6.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.6.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.39.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.40.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
||||||
|
@ -13,31 +13,37 @@ AllCops:
|
|||||||
RSpec/AlignLeftLetBrace:
|
RSpec/AlignLeftLetBrace:
|
||||||
Description: Checks that left braces for adjacent single line lets are aligned.
|
Description: Checks that left braces for adjacent single line lets are aligned.
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
|
||||||
|
|
||||||
RSpec/AlignRightLetBrace:
|
RSpec/AlignRightLetBrace:
|
||||||
Description: Checks that right braces for adjacent single line lets are aligned.
|
Description: Checks that right braces for adjacent single line lets are aligned.
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
|
||||||
|
|
||||||
RSpec/AnyInstance:
|
RSpec/AnyInstance:
|
||||||
Description: Check that instances are not being stubbed globally.
|
Description: Check that instances are not being stubbed globally.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.4'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
|
||||||
|
|
||||||
RSpec/AroundBlock:
|
RSpec/AroundBlock:
|
||||||
Description: Checks that around blocks actually run the test.
|
Description: Checks that around blocks actually run the test.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.11'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
|
||||||
|
|
||||||
RSpec/Be:
|
RSpec/Be:
|
||||||
Description: Check for expectations where `be` is used without argument.
|
Description: Check for expectations where `be` is used without argument.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.25'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
|
||||||
|
|
||||||
RSpec/BeEql:
|
RSpec/BeEql:
|
||||||
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
||||||
|
|
||||||
RSpec/BeforeAfterAll:
|
RSpec/BeforeAfterAll:
|
||||||
@ -47,11 +53,13 @@ RSpec/BeforeAfterAll:
|
|||||||
- spec/spec_helper.rb
|
- spec/spec_helper.rb
|
||||||
- spec/rails_helper.rb
|
- spec/rails_helper.rb
|
||||||
- spec/support/**/*.rb
|
- spec/support/**/*.rb
|
||||||
|
VersionAdded: '1.12'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
||||||
|
|
||||||
RSpec/ContextMethod:
|
RSpec/ContextMethod:
|
||||||
Description: "`context` should not be used for specifying methods."
|
Description: "`context` should not be used for specifying methods."
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.36'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
|
||||||
|
|
||||||
RSpec/ContextWording:
|
RSpec/ContextWording:
|
||||||
@ -61,86 +69,103 @@ RSpec/ContextWording:
|
|||||||
- when
|
- when
|
||||||
- with
|
- with
|
||||||
- without
|
- without
|
||||||
|
VersionAdded: '1.20'
|
||||||
|
VersionChanged: 1.20.1
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/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
|
||||||
|
VersionAdded: '1.0'
|
||||||
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:
|
||||||
Description: Checks that the second argument to `describe` specifies a method.
|
Description: Checks that the second argument to `describe` specifies a method.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.0'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
|
||||||
|
|
||||||
RSpec/DescribeSymbol:
|
RSpec/DescribeSymbol:
|
||||||
Description: Avoid describing symbols.
|
Description: Avoid describing symbols.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.15'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
|
||||||
|
|
||||||
RSpec/DescribedClass:
|
RSpec/DescribedClass:
|
||||||
Description: Checks that tests use `described_class`.
|
Description: Checks that tests use `described_class`.
|
||||||
SkipBlocks: false
|
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
SkipBlocks: false
|
||||||
EnforcedStyle: described_class
|
EnforcedStyle: described_class
|
||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- described_class
|
- described_class
|
||||||
- explicit
|
- explicit
|
||||||
|
SafeAutoCorrect: false
|
||||||
|
VersionAdded: '1.0'
|
||||||
|
VersionChanged: '1.11'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
||||||
|
|
||||||
RSpec/DescribedClassModuleWrapping:
|
RSpec/DescribedClassModuleWrapping:
|
||||||
Description: Avoid opening modules and defining specs within them.
|
Description: Avoid opening modules and defining specs within them.
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
VersionAdded: '1.37'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
|
||||||
|
|
||||||
RSpec/Dialect:
|
RSpec/Dialect:
|
||||||
Description: This cop enforces custom RSpec dialects.
|
Description: This cop enforces custom RSpec dialects.
|
||||||
Enabled: false
|
Enabled: false
|
||||||
PreferredMethods: {}
|
PreferredMethods: {}
|
||||||
|
VersionAdded: '1.33'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
||||||
|
|
||||||
RSpec/EmptyExampleGroup:
|
RSpec/EmptyExampleGroup:
|
||||||
Description: Checks if an example group does not include any tests.
|
Description: Checks if an example group does not include any tests.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
CustomIncludeMethods: []
|
CustomIncludeMethods: []
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
||||||
|
|
||||||
RSpec/EmptyHook:
|
RSpec/EmptyHook:
|
||||||
Description: Checks for empty before and after hooks.
|
Description: Checks for empty before and after hooks.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
VersionAdded: 1.39.0
|
VersionAdded: '1.39'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
|
||||||
|
|
||||||
RSpec/EmptyLineAfterExample:
|
RSpec/EmptyLineAfterExample:
|
||||||
Description: Checks if there is an empty line after example blocks.
|
Description: Checks if there is an empty line after example blocks.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
AllowConsecutiveOneLiners: true
|
AllowConsecutiveOneLiners: true
|
||||||
|
VersionAdded: '1.36'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
|
||||||
|
|
||||||
RSpec/EmptyLineAfterExampleGroup:
|
RSpec/EmptyLineAfterExampleGroup:
|
||||||
Description: Checks if there is an empty line after example group blocks.
|
Description: Checks if there is an empty line after example group blocks.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.27'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
|
||||||
|
|
||||||
RSpec/EmptyLineAfterFinalLet:
|
RSpec/EmptyLineAfterFinalLet:
|
||||||
Description: Checks if there is an empty line after the last let block.
|
Description: Checks if there is an empty line after the last let block.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.14'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
|
||||||
|
|
||||||
RSpec/EmptyLineAfterHook:
|
RSpec/EmptyLineAfterHook:
|
||||||
Description: Checks if there is an empty line after hook blocks.
|
Description: Checks if there is an empty line after hook blocks.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.27'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
||||||
|
|
||||||
RSpec/EmptyLineAfterSubject:
|
RSpec/EmptyLineAfterSubject:
|
||||||
Description: Checks if there is an empty line after subject block.
|
Description: Checks if there is an empty line after subject block.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.14'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
||||||
|
|
||||||
RSpec/ExampleLength:
|
RSpec/ExampleLength:
|
||||||
Description: Checks for long examples.
|
Description: Checks for long examples.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Max: 5
|
Max: 5
|
||||||
|
VersionAdded: '1.5'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
||||||
|
|
||||||
RSpec/ExampleWithoutDescription:
|
RSpec/ExampleWithoutDescription:
|
||||||
@ -151,6 +176,7 @@ RSpec/ExampleWithoutDescription:
|
|||||||
- always_allow
|
- always_allow
|
||||||
- single_line_only
|
- single_line_only
|
||||||
- disallow
|
- disallow
|
||||||
|
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/ExampleWording:
|
RSpec/ExampleWording:
|
||||||
@ -162,6 +188,8 @@ RSpec/ExampleWording:
|
|||||||
have: has
|
have: has
|
||||||
HAVE: HAS
|
HAVE: HAS
|
||||||
IgnoredWords: []
|
IgnoredWords: []
|
||||||
|
VersionAdded: '1.0'
|
||||||
|
VersionChanged: '1.2'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
||||||
|
|
||||||
RSpec/ExpectActual:
|
RSpec/ExpectActual:
|
||||||
@ -169,6 +197,7 @@ RSpec/ExpectActual:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
Exclude:
|
Exclude:
|
||||||
- spec/routing/**/*
|
- spec/routing/**/*
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
||||||
|
|
||||||
RSpec/ExpectChange:
|
RSpec/ExpectChange:
|
||||||
@ -178,30 +207,37 @@ RSpec/ExpectChange:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- method_call
|
- method_call
|
||||||
- block
|
- block
|
||||||
|
VersionAdded: '1.22'
|
||||||
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:
|
||||||
Enabled: true
|
|
||||||
Description: Do not use `expect` in hooks such as `before`.
|
Description: Do not use `expect` in hooks such as `before`.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
|
||||||
|
|
||||||
RSpec/ExpectOutput:
|
RSpec/ExpectOutput:
|
||||||
Description: Checks for opportunities to use `expect { ... }.to output`.
|
Description: Checks for opportunities to use `expect { ... }.to output`.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.10'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
|
||||||
|
|
||||||
RSpec/FilePath:
|
RSpec/FilePath:
|
||||||
Description: Checks that spec file paths are consistent with the test subject.
|
Description: Checks that spec file paths are consistent and well-formed.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
CustomTransform:
|
CustomTransform:
|
||||||
RuboCop: rubocop
|
RuboCop: rubocop
|
||||||
RSpec: rspec
|
RSpec: rspec
|
||||||
IgnoreMethods: false
|
IgnoreMethods: false
|
||||||
|
SpecSuffixOnly: false
|
||||||
|
VersionAdded: '1.2'
|
||||||
|
VersionChanged: '1.40'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
||||||
|
|
||||||
RSpec/Focus:
|
RSpec/Focus:
|
||||||
Description: Checks if examples are focused.
|
Description: Checks if examples are focused.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.5'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
||||||
|
|
||||||
RSpec/HookArgument:
|
RSpec/HookArgument:
|
||||||
@ -212,16 +248,19 @@ RSpec/HookArgument:
|
|||||||
- implicit
|
- implicit
|
||||||
- each
|
- each
|
||||||
- example
|
- example
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
||||||
|
|
||||||
RSpec/HooksBeforeExamples:
|
RSpec/HooksBeforeExamples:
|
||||||
Enabled: true
|
|
||||||
Description: Checks for before/around/after hooks that come after an example.
|
Description: Checks for before/around/after hooks that come after an example.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.29'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
|
||||||
|
|
||||||
RSpec/ImplicitBlockExpectation:
|
RSpec/ImplicitBlockExpectation:
|
||||||
Description: Check that implicit block expectation syntax is not used.
|
Description: Check that implicit block expectation syntax is not used.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.35'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
|
||||||
|
|
||||||
RSpec/ImplicitExpect:
|
RSpec/ImplicitExpect:
|
||||||
@ -231,32 +270,39 @@ RSpec/ImplicitExpect:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- is_expected
|
- is_expected
|
||||||
- should
|
- should
|
||||||
|
VersionAdded: '1.8'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
||||||
|
|
||||||
RSpec/ImplicitSubject:
|
RSpec/ImplicitSubject:
|
||||||
Enabled: true
|
|
||||||
Description: Checks for usage of implicit subject (`is_expected` / `should`).
|
Description: Checks for usage of implicit subject (`is_expected` / `should`).
|
||||||
|
Enabled: true
|
||||||
EnforcedStyle: single_line_only
|
EnforcedStyle: single_line_only
|
||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- single_line_only
|
- single_line_only
|
||||||
- single_statement_only
|
- single_statement_only
|
||||||
- disallow
|
- disallow
|
||||||
|
VersionAdded: '1.29'
|
||||||
|
VersionChanged: '1.30'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
||||||
|
|
||||||
RSpec/InstanceSpy:
|
RSpec/InstanceSpy:
|
||||||
Description: Checks for `instance_double` used with `have_received`.
|
Description: Checks for `instance_double` used with `have_received`.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.12'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
|
||||||
|
|
||||||
RSpec/InstanceVariable:
|
RSpec/InstanceVariable:
|
||||||
Description: Checks for instance variable usage in specs.
|
Description: Checks for instance variable usage in specs.
|
||||||
AssignmentOnly: false
|
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
AssignmentOnly: false
|
||||||
|
VersionAdded: '1.0'
|
||||||
|
VersionChanged: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
||||||
|
|
||||||
RSpec/InvalidPredicateMatcher:
|
RSpec/InvalidPredicateMatcher:
|
||||||
Description: Checks invalid usage for predicate matcher.
|
Description: Checks invalid usage for predicate matcher.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
|
||||||
|
|
||||||
RSpec/ItBehavesLike:
|
RSpec/ItBehavesLike:
|
||||||
@ -266,36 +312,45 @@ RSpec/ItBehavesLike:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- it_behaves_like
|
- it_behaves_like
|
||||||
- it_should_behave_like
|
- it_should_behave_like
|
||||||
|
VersionAdded: '1.13'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
||||||
|
|
||||||
RSpec/IteratedExpectation:
|
RSpec/IteratedExpectation:
|
||||||
Description: Check that `all` matcher is used instead of iterating over an array.
|
Description: Check that `all` matcher is used instead of iterating over an array.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.14'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
|
||||||
|
|
||||||
RSpec/LeadingSubject:
|
RSpec/LeadingSubject:
|
||||||
Description: Enforce that subject is the first definition in the test.
|
Description: Enforce that subject is the first definition in the test.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.7'
|
||||||
|
VersionChanged: '1.14'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
|
||||||
|
|
||||||
RSpec/LeakyConstantDeclaration:
|
RSpec/LeakyConstantDeclaration:
|
||||||
Description: Checks that no class, module, or constant is declared.
|
Description: Checks that no class, module, or constant is declared.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.35'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
|
||||||
|
|
||||||
RSpec/LetBeforeExamples:
|
RSpec/LetBeforeExamples:
|
||||||
Description: Checks for `let` definitions that come after an example.
|
Description: Checks for `let` definitions that come after an example.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.16'
|
||||||
|
VersionChanged: '1.22'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
|
||||||
|
|
||||||
RSpec/LetSetup:
|
RSpec/LetSetup:
|
||||||
Description: Checks unreferenced `let!` calls being used for test setup.
|
Description: Checks unreferenced `let!` calls being used for test setup.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
|
||||||
|
|
||||||
RSpec/MessageChain:
|
RSpec/MessageChain:
|
||||||
Description: Check that chains of messages are not being stubbed.
|
Description: Check that chains of messages are not being stubbed.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
|
||||||
|
|
||||||
RSpec/MessageExpectation:
|
RSpec/MessageExpectation:
|
||||||
@ -305,6 +360,8 @@ RSpec/MessageExpectation:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- allow
|
- allow
|
||||||
- expect
|
- expect
|
||||||
|
VersionAdded: '1.7'
|
||||||
|
VersionChanged: '1.8'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
||||||
|
|
||||||
RSpec/MessageSpies:
|
RSpec/MessageSpies:
|
||||||
@ -314,58 +371,70 @@ RSpec/MessageSpies:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- have_received
|
- have_received
|
||||||
- receive
|
- receive
|
||||||
|
VersionAdded: '1.9'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
||||||
|
|
||||||
RSpec/MissingExampleGroupArgument:
|
RSpec/MissingExampleGroupArgument:
|
||||||
Description: Checks that the first argument to an example group is not empty.
|
Description: Checks that the first argument to an example group is not empty.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.28'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
||||||
|
|
||||||
RSpec/MultipleDescribes:
|
RSpec/MultipleDescribes:
|
||||||
Description: Checks for multiple top level describes.
|
Description: Checks for multiple top level describes.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.0'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
||||||
|
|
||||||
RSpec/MultipleExpectations:
|
RSpec/MultipleExpectations:
|
||||||
Description: Checks if examples contain too many `expect` calls.
|
Description: Checks if examples contain too many `expect` calls.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Max: 1
|
Max: 1
|
||||||
|
VersionAdded: '1.7'
|
||||||
|
VersionChanged: '1.21'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
||||||
|
|
||||||
RSpec/MultipleSubjects:
|
RSpec/MultipleSubjects:
|
||||||
Description: Checks if an example group defines `subject` multiple times.
|
Description: Checks if an example group defines `subject` multiple times.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
|
||||||
|
|
||||||
RSpec/NamedSubject:
|
RSpec/NamedSubject:
|
||||||
Description: Checks for explicitly referenced test subjects.
|
Description: Checks for explicitly referenced test subjects.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
IgnoreSharedExamples: true
|
IgnoreSharedExamples: true
|
||||||
|
VersionAdded: 1.5.3
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
|
||||||
|
|
||||||
RSpec/NestedGroups:
|
RSpec/NestedGroups:
|
||||||
Description: Checks for nested example groups.
|
Description: Checks for nested example groups.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Max: 3
|
Max: 3
|
||||||
|
VersionAdded: '1.7'
|
||||||
|
VersionChanged: '1.10'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
||||||
|
|
||||||
RSpec/NotToNot:
|
RSpec/NotToNot:
|
||||||
Description: Checks for consistent method usage for negating expectations.
|
Description: Checks for consistent method usage for negating expectations.
|
||||||
|
Enabled: true
|
||||||
EnforcedStyle: not_to
|
EnforcedStyle: not_to
|
||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- not_to
|
- not_to
|
||||||
- to_not
|
- to_not
|
||||||
Enabled: true
|
VersionAdded: '1.4'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
||||||
|
|
||||||
RSpec/OverwritingSetup:
|
RSpec/OverwritingSetup:
|
||||||
Enabled: true
|
|
||||||
Description: Checks if there is a let/subject that overwrites an existing one.
|
Description: Checks if there is a let/subject that overwrites an existing one.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.14'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
|
||||||
|
|
||||||
RSpec/Pending:
|
RSpec/Pending:
|
||||||
Enabled: false
|
|
||||||
Description: Checks for any pending or skipped examples.
|
Description: Checks for any pending or skipped examples.
|
||||||
|
Enabled: false
|
||||||
|
VersionAdded: '1.25'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
||||||
|
|
||||||
RSpec/PredicateMatcher:
|
RSpec/PredicateMatcher:
|
||||||
@ -377,109 +446,154 @@ RSpec/PredicateMatcher:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- inflected
|
- inflected
|
||||||
- explicit
|
- explicit
|
||||||
|
SafeAutoCorrect: false
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
||||||
|
|
||||||
RSpec/ReceiveCounts:
|
RSpec/ReceiveCounts:
|
||||||
Enabled: true
|
|
||||||
Description: Check for `once` and `twice` receive counts matchers usage.
|
Description: Check for `once` and `twice` receive counts matchers usage.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.26'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
||||||
|
|
||||||
RSpec/ReceiveNever:
|
RSpec/ReceiveNever:
|
||||||
Enabled: true
|
|
||||||
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.28'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
|
||||||
|
|
||||||
RSpec/RepeatedDescription:
|
RSpec/RepeatedDescription:
|
||||||
Enabled: true
|
|
||||||
Description: Check for repeated description strings in example groups.
|
Description: Check for repeated description strings in example groups.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.9'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
|
||||||
|
|
||||||
RSpec/RepeatedExample:
|
RSpec/RepeatedExample:
|
||||||
Enabled: true
|
|
||||||
Description: Check for repeated examples within example groups.
|
Description: Check for repeated examples within example groups.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.10'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
|
||||||
|
|
||||||
RSpec/RepeatedExampleGroupBody:
|
RSpec/RepeatedExampleGroupBody:
|
||||||
Enabled: true
|
|
||||||
Description: Check for repeated describe and context block body.
|
Description: Check for repeated describe and context block body.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.38'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
|
||||||
|
|
||||||
RSpec/RepeatedExampleGroupDescription:
|
RSpec/RepeatedExampleGroupDescription:
|
||||||
Enabled: true
|
|
||||||
Description: Check for repeated example group descriptions.
|
Description: Check for repeated example group descriptions.
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: '1.38'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
||||||
|
|
||||||
RSpec/ReturnFromStub:
|
RSpec/ReturnFromStub:
|
||||||
Enabled: true
|
|
||||||
Description: Checks for consistent style of stub's return setting.
|
Description: Checks for consistent style of stub's return setting.
|
||||||
|
Enabled: true
|
||||||
EnforcedStyle: and_return
|
EnforcedStyle: and_return
|
||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- and_return
|
- and_return
|
||||||
- block
|
- block
|
||||||
|
VersionAdded: '1.16'
|
||||||
|
VersionChanged: '1.22'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
||||||
|
|
||||||
RSpec/ScatteredLet:
|
RSpec/ScatteredLet:
|
||||||
Description: Checks for let scattered across the example group.
|
Description: Checks for let scattered across the example group.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
|
VersionAdded: '1.14'
|
||||||
VersionChanged: '1.39'
|
VersionChanged: '1.39'
|
||||||
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
|
||||||
|
|
||||||
RSpec/ScatteredSetup:
|
RSpec/ScatteredSetup:
|
||||||
Description: Checks for setup scattered across multiple hooks in an example group.
|
Description: Checks for setup scattered across multiple hooks in an example group.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.10'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
|
||||||
|
|
||||||
RSpec/SharedContext:
|
RSpec/SharedContext:
|
||||||
Description: Checks for proper shared_context and shared_examples usage.
|
Description: Checks for proper shared_context and shared_examples usage.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.13'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
||||||
|
|
||||||
RSpec/SharedExamples:
|
RSpec/SharedExamples:
|
||||||
Description: Enforces use of string to titleize shared examples.
|
Description: Enforces use of string to titleize shared examples.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.25'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
||||||
|
|
||||||
RSpec/SingleArgumentMessageChain:
|
RSpec/SingleArgumentMessageChain:
|
||||||
Description: Checks that chains of messages contain more than one element.
|
Description: Checks that chains of messages contain more than one element.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.9'
|
||||||
|
VersionChanged: '1.10'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
||||||
|
|
||||||
RSpec/SubjectStub:
|
RSpec/SubjectStub:
|
||||||
Description: Checks for stubbed test subjects.
|
Description: Checks for stubbed test subjects.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.7'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
|
||||||
|
|
||||||
RSpec/UnspecifiedException:
|
RSpec/UnspecifiedException:
|
||||||
Description: Checks for a specified error in checking raised errors.
|
Description: Checks for a specified error in checking raised errors.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.30'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
|
||||||
|
|
||||||
|
RSpec/VariableDefinition:
|
||||||
|
Description: Checks that memoized helpers names are symbols or strings.
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: symbols
|
||||||
|
SupportedStyles:
|
||||||
|
- symbols
|
||||||
|
- strings
|
||||||
|
VersionAdded: '1.40'
|
||||||
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
|
||||||
|
|
||||||
|
RSpec/VariableName:
|
||||||
|
Description: Checks that memoized helper names use the configured style.
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: snake_case
|
||||||
|
SupportedStyles:
|
||||||
|
- snake_case
|
||||||
|
- camelCase
|
||||||
|
VersionAdded: '1.40'
|
||||||
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
||||||
|
|
||||||
RSpec/VerifiedDoubles:
|
RSpec/VerifiedDoubles:
|
||||||
Description: Prefer using verifying doubles over normal doubles.
|
Description: Prefer using verifying doubles over normal doubles.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
IgnoreNameless: true
|
IgnoreNameless: true
|
||||||
IgnoreSymbolicNames: false
|
IgnoreSymbolicNames: false
|
||||||
|
VersionAdded: 1.2.1
|
||||||
|
VersionChanged: '1.5'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
|
||||||
|
|
||||||
RSpec/VoidExpect:
|
RSpec/VoidExpect:
|
||||||
Description: This cop checks void `expect()`.
|
Description: This cop checks void `expect()`.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.16'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
|
||||||
|
|
||||||
RSpec/Yield:
|
RSpec/Yield:
|
||||||
Description: This cop checks for calling a block within a stub.
|
Description: This cop checks for calling a block within a stub.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.32'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
||||||
|
|
||||||
Capybara/CurrentPathExpectation:
|
Capybara/CurrentPathExpectation:
|
||||||
Description: Checks that no expectations are set on Capybara's `current_path`.
|
Description: Checks that no expectations are set on Capybara's `current_path`.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.18'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
||||||
|
|
||||||
Capybara/FeatureMethods:
|
Capybara/FeatureMethods:
|
||||||
Description: Checks for consistent method usage in feature specs.
|
Description: Checks for consistent method usage in feature specs.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
EnabledMethods: []
|
EnabledMethods: []
|
||||||
|
VersionAdded: '1.17'
|
||||||
|
VersionChanged: '1.25'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
||||||
|
|
||||||
Capybara/VisibilityMatcher:
|
Capybara/VisibilityMatcher:
|
||||||
@ -491,6 +605,7 @@ Capybara/VisibilityMatcher:
|
|||||||
FactoryBot/AttributeDefinedStatically:
|
FactoryBot/AttributeDefinedStatically:
|
||||||
Description: Always declare attribute values as blocks.
|
Description: Always declare attribute values as blocks.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.28'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
||||||
|
|
||||||
FactoryBot/CreateList:
|
FactoryBot/CreateList:
|
||||||
@ -500,11 +615,13 @@ FactoryBot/CreateList:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- create_list
|
- create_list
|
||||||
- n_times
|
- n_times
|
||||||
|
VersionAdded: '1.25'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
||||||
|
|
||||||
FactoryBot/FactoryClassName:
|
FactoryBot/FactoryClassName:
|
||||||
Description: Use string value when setting the class attribute explicitly.
|
Description: Use string value when setting the class attribute explicitly.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
VersionAdded: '1.37'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
||||||
|
|
||||||
Rails/HttpStatus:
|
Rails/HttpStatus:
|
||||||
@ -514,4 +631,5 @@ Rails/HttpStatus:
|
|||||||
SupportedStyles:
|
SupportedStyles:
|
||||||
- numeric
|
- numeric
|
||||||
- symbolic
|
- symbolic
|
||||||
|
VersionAdded: '1.23'
|
||||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
@ -17,6 +17,7 @@ require_relative 'rubocop/rspec/concept'
|
|||||||
require_relative 'rubocop/rspec/example_group'
|
require_relative 'rubocop/rspec/example_group'
|
||||||
require_relative 'rubocop/rspec/example'
|
require_relative 'rubocop/rspec/example'
|
||||||
require_relative 'rubocop/rspec/hook'
|
require_relative 'rubocop/rspec/hook'
|
||||||
|
require_relative 'rubocop/rspec/variable'
|
||||||
require_relative 'rubocop/cop/rspec/cop'
|
require_relative 'rubocop/cop/rspec/cop'
|
||||||
require_relative 'rubocop/rspec/align_let_brace'
|
require_relative 'rubocop/rspec/align_let_brace'
|
||||||
require_relative 'rubocop/rspec/factory_bot'
|
require_relative 'rubocop/rspec/factory_bot'
|
@ -18,35 +18,50 @@ module RuboCop
|
|||||||
#
|
#
|
||||||
# # bad
|
# # bad
|
||||||
# expect(page).to have_selector('.foo', visible: false)
|
# expect(page).to have_selector('.foo', visible: false)
|
||||||
#
|
# expect(page).to have_css('.foo', visible: true)
|
||||||
# # bad
|
# expect(page).to have_link('my link', visible: false)
|
||||||
# expect(page).to have_selector('.foo', visible: true)
|
|
||||||
#
|
|
||||||
# # good
|
|
||||||
# expect(page).to have_selector('.foo', visible: :all)
|
|
||||||
#
|
|
||||||
# # good
|
|
||||||
# expect(page).to have_selector('.foo', visible: :hidden)
|
|
||||||
#
|
#
|
||||||
# # good
|
# # good
|
||||||
# expect(page).to have_selector('.foo', visible: :visible)
|
# expect(page).to have_selector('.foo', visible: :visible)
|
||||||
|
# expect(page).to have_css('.foo', visible: :all)
|
||||||
|
# expect(page).to have_link('my link', visible: :hidden)
|
||||||
#
|
#
|
||||||
class VisibilityMatcher < Cop
|
class VisibilityMatcher < Cop
|
||||||
MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
|
MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
|
||||||
MSG_TRUE = 'Use `:visible` instead of `true`.'
|
MSG_TRUE = 'Use `:visible` instead of `true`.'
|
||||||
|
CAPYBARA_MATCHER_METHODS = %i[
|
||||||
|
have_selector
|
||||||
|
have_css
|
||||||
|
have_xpath
|
||||||
|
have_link
|
||||||
|
have_button
|
||||||
|
have_field
|
||||||
|
have_select
|
||||||
|
have_table
|
||||||
|
have_checked_field
|
||||||
|
have_unchecked_field
|
||||||
|
have_text
|
||||||
|
have_content
|
||||||
|
].freeze
|
||||||
|
|
||||||
def_node_matcher :visible_true?, <<~PATTERN
|
def_node_matcher :visible_true?, <<~PATTERN
|
||||||
(send nil? :have_selector ... (hash <$(pair (sym :visible) true) ...>))
|
(send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) true) ...>))
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
def_node_matcher :visible_false?, <<~PATTERN
|
def_node_matcher :visible_false?, <<~PATTERN
|
||||||
(send nil? :have_selector ... (hash <$(pair (sym :visible) false) ...>))
|
(send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) false) ...>))
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
def on_send(node)
|
def on_send(node)
|
||||||
visible_false?(node) { |arg| add_offense(arg, message: MSG_FALSE) }
|
visible_false?(node) { |arg| add_offense(arg, message: MSG_FALSE) }
|
||||||
visible_true?(node) { |arg| add_offense(arg, message: MSG_TRUE) }
|
visible_true?(node) { |arg| add_offense(arg, message: MSG_TRUE) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def capybara_matcher?(method_name)
|
||||||
|
CAPYBARA_MATCHER_METHODS.include? method_name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -2,28 +2,8 @@
|
|||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
WorkaroundCop = Cop.dup
|
|
||||||
|
|
||||||
# Clone of the the normal RuboCop::Cop::Cop class so we can rewrite
|
|
||||||
# the inherited method without breaking functionality
|
|
||||||
class WorkaroundCop
|
|
||||||
# Remove the Cop.inherited method to be a noop. Our RSpec::Cop
|
|
||||||
# class will invoke the inherited hook instead
|
|
||||||
class << self
|
|
||||||
undef inherited
|
|
||||||
def inherited(*) end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Special case `Module#<` so that the rspec support rubocop exports
|
|
||||||
# is compatible with our subclass
|
|
||||||
def self.<(other)
|
|
||||||
other.equal?(RuboCop::Cop::Cop) || super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private_constant(:WorkaroundCop)
|
|
||||||
|
|
||||||
module RSpec
|
module RSpec
|
||||||
# @abstract parent class to rspec cops
|
# @abstract parent class to RSpec cops
|
||||||
#
|
#
|
||||||
# The criteria for whether rubocop-rspec analyzes a certain ruby file
|
# The criteria for whether rubocop-rspec analyzes a certain ruby file
|
||||||
# is configured via `AllCops/RSpec`. For example, if you want to
|
# is configured via `AllCops/RSpec`. For example, if you want to
|
||||||
@ -31,13 +11,13 @@ module RuboCop
|
|||||||
# then you could add this to your configuration:
|
# then you could add this to your configuration:
|
||||||
#
|
#
|
||||||
# @example configuring analyzed paths
|
# @example configuring analyzed paths
|
||||||
#
|
# # .rubocop.yml
|
||||||
# AllCops:
|
# # AllCops:
|
||||||
# RSpec:
|
# # RSpec:
|
||||||
# Patterns:
|
# # Patterns:
|
||||||
# - '_test.rb$'
|
# # - '_test.rb$'
|
||||||
# - '(?:^|/)test/'
|
# # - '(?:^|/)test/'
|
||||||
class Cop < WorkaroundCop
|
class Cop < ::RuboCop::Cop::Cop
|
||||||
include RuboCop::RSpec::Language
|
include RuboCop::RSpec::Language
|
||||||
include RuboCop::RSpec::Language::NodePattern
|
include RuboCop::RSpec::Language::NodePattern
|
||||||
|
|
@ -3,10 +3,11 @@
|
|||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
module RSpec
|
module RSpec
|
||||||
# Checks that spec file paths are consistent with the test subject.
|
# Checks that spec file paths are consistent and well-formed.
|
||||||
#
|
#
|
||||||
# Checks the path of the spec file and enforces that it reflects the
|
# By default, this checks that spec file paths are consistent with the
|
||||||
# described class/module and its optionally called out method.
|
# test subject and and enforces that it reflects the described
|
||||||
|
# class/module and its optionally called out method.
|
||||||
#
|
#
|
||||||
# With the configuration option `IgnoreMethods` the called out method will
|
# With the configuration option `IgnoreMethods` the called out method will
|
||||||
# be ignored when determining the enforced path.
|
# be ignored when determining the enforced path.
|
||||||
@ -15,6 +16,10 @@ module RuboCop
|
|||||||
# be specified that should not as usual be transformed from CamelCase to
|
# be specified that should not as usual be transformed from CamelCase to
|
||||||
# snake_case (e.g. 'RuboCop' => 'rubocop' ).
|
# snake_case (e.g. 'RuboCop' => 'rubocop' ).
|
||||||
#
|
#
|
||||||
|
# With the configuration option `SpecSuffixOnly` test files will only
|
||||||
|
# be checked to ensure they end in '_spec.rb'. This option disables
|
||||||
|
# checking for consistency in the test subject or test methods.
|
||||||
|
#
|
||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# whatever_spec.rb # describe MyClass
|
# whatever_spec.rb # describe MyClass
|
||||||
@ -41,6 +46,16 @@ module RuboCop
|
|||||||
# # good
|
# # good
|
||||||
# my_class_spec.rb # describe MyClass, '#method'
|
# my_class_spec.rb # describe MyClass, '#method'
|
||||||
#
|
#
|
||||||
|
# @example when configuration is `SpecSuffixOnly: true`
|
||||||
|
# # good
|
||||||
|
# whatever_spec.rb # describe MyClass
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# my_class_spec.rb # describe MyClass
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# my_class_spec.rb # describe MyClass, '#method'
|
||||||
|
#
|
||||||
class FilePath < Cop
|
class FilePath < Cop
|
||||||
include RuboCop::RSpec::TopLevelDescribe
|
include RuboCop::RSpec::TopLevelDescribe
|
||||||
|
|
||||||
@ -70,9 +85,15 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def glob_for((described_class, method_name))
|
def glob_for((described_class, method_name))
|
||||||
|
return glob_for_spec_suffix_only? if spec_suffix_only?
|
||||||
|
|
||||||
"#{expected_path(described_class)}#{name_glob(method_name)}*_spec.rb"
|
"#{expected_path(described_class)}#{name_glob(method_name)}*_spec.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def glob_for_spec_suffix_only?
|
||||||
|
'*_spec.rb'
|
||||||
|
end
|
||||||
|
|
||||||
def name_glob(name)
|
def name_glob(name)
|
||||||
return unless name&.str_type?
|
return unless name&.str_type?
|
||||||
|
|
||||||
@ -105,12 +126,17 @@ module RuboCop
|
|||||||
def filename_ends_with?(glob)
|
def filename_ends_with?(glob)
|
||||||
filename =
|
filename =
|
||||||
RuboCop::PathUtil.relative_path(processed_source.buffer.name)
|
RuboCop::PathUtil.relative_path(processed_source.buffer.name)
|
||||||
|
.gsub('../', '')
|
||||||
File.fnmatch?("*#{glob}", filename)
|
File.fnmatch?("*#{glob}", filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
def relevant_rubocop_rspec_file?(_file)
|
def relevant_rubocop_rspec_file?(_file)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def spec_suffix_only?
|
||||||
|
cop_config['SpecSuffixOnly']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -70,6 +70,7 @@ module RuboCop
|
|||||||
'to describe HTTP status code.'
|
'to describe HTTP status code.'
|
||||||
|
|
||||||
attr_reader :node
|
attr_reader :node
|
||||||
|
|
||||||
def initialize(node)
|
def initialize(node)
|
||||||
@node = node
|
@node = node
|
||||||
end
|
end
|
||||||
@ -110,6 +111,7 @@ module RuboCop
|
|||||||
ALLOWED_STATUSES = %i[error success missing redirect].freeze
|
ALLOWED_STATUSES = %i[error success missing redirect].freeze
|
||||||
|
|
||||||
attr_reader :node
|
attr_reader :node
|
||||||
|
|
||||||
def initialize(node)
|
def initialize(node)
|
||||||
@node = node
|
@node = node
|
||||||
end
|
end
|
@ -34,6 +34,15 @@ module RuboCop
|
|||||||
# it { cool_predicate }
|
# it { cool_predicate }
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
# # good
|
||||||
|
# context Array do
|
||||||
|
# it { is_expected.to respond_to :each }
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# context Hash do
|
||||||
|
# it { is_expected.to respond_to :each }
|
||||||
|
# end
|
||||||
|
#
|
||||||
class RepeatedExampleGroupBody < Cop
|
class RepeatedExampleGroupBody < Cop
|
||||||
MSG = 'Repeated %<group>s block body on line(s) %<loc>s'
|
MSG = 'Repeated %<group>s block body on line(s) %<loc>s'
|
||||||
|
|
||||||
@ -43,6 +52,7 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_matcher :metadata, '(block (send _ _ _ $...) ...)'
|
def_node_matcher :metadata, '(block (send _ _ _ $...) ...)'
|
||||||
def_node_matcher :body, '(block _ args $...)'
|
def_node_matcher :body, '(block _ args $...)'
|
||||||
|
def_node_matcher :const_arg, '(block (send _ _ $const ...) ...)'
|
||||||
|
|
||||||
def_node_matcher :skip_or_pending?, <<-PATTERN
|
def_node_matcher :skip_or_pending?, <<-PATTERN
|
||||||
(block <(send nil? {:skip :pending}) ...>)
|
(block <(send nil? {:skip :pending}) ...>)
|
||||||
@ -75,7 +85,7 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def signature_keys(group)
|
def signature_keys(group)
|
||||||
[metadata(group), body(group)]
|
[metadata(group), body(group), const_arg(group)]
|
||||||
end
|
end
|
||||||
|
|
||||||
def message(group, repeats)
|
def message(group, repeats)
|
@ -47,6 +47,7 @@ module RuboCop
|
|||||||
'to titleize shared examples.'
|
'to titleize shared examples.'
|
||||||
|
|
||||||
attr_reader :node
|
attr_reader :node
|
||||||
|
|
||||||
def initialize(node)
|
def initialize(node)
|
||||||
@node = node
|
@node = node
|
||||||
end
|
end
|
@ -1,5 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'set'
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
module RSpec
|
module RSpec
|
||||||
@ -75,70 +77,46 @@ module RuboCop
|
|||||||
|
|
||||||
def on_block(node)
|
def on_block(node)
|
||||||
return unless example_group?(node)
|
return unless example_group?(node)
|
||||||
|
return if (processed_example_groups & node.ancestors).any?
|
||||||
|
|
||||||
find_subject_stub(node) do |stub|
|
processed_example_groups << node
|
||||||
|
@explicit_subjects = find_all_explicit_subjects(node)
|
||||||
|
|
||||||
|
find_subject_expectations(node) do |stub|
|
||||||
add_offense(stub)
|
add_offense(stub)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Find subjects within tree and then find (send) nodes for that subject
|
def processed_example_groups
|
||||||
#
|
@processed_example_groups ||= Set.new
|
||||||
# @param node [RuboCop::Node] example group
|
end
|
||||||
#
|
|
||||||
# @yield [RuboCop::Node] message expectations for subject
|
def find_all_explicit_subjects(node)
|
||||||
def find_subject_stub(node, &block)
|
node.each_descendant(:block).with_object({}) do |child, h|
|
||||||
find_subject(node) do |subject_name, context|
|
name = subject(child)
|
||||||
find_subject_expectation(context, subject_name, &block)
|
next unless name
|
||||||
|
|
||||||
|
outer_example_group = child.each_ancestor.find do |a|
|
||||||
|
example_group?(a)
|
||||||
|
end
|
||||||
|
|
||||||
|
h[outer_example_group] ||= []
|
||||||
|
h[outer_example_group] << name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find a subject message expectation
|
def find_subject_expectations(node, subject_names = [], &block)
|
||||||
#
|
subject_names = @explicit_subjects[node] if @explicit_subjects[node]
|
||||||
# @param node [RuboCop::Node]
|
|
||||||
# @param subject_name [Symbol] name of subject
|
|
||||||
#
|
|
||||||
# @yield [RuboCop::Node] message expectation
|
|
||||||
def find_subject_expectation(node, subject_name, &block)
|
|
||||||
# Do not search node if it is an example group with its own subject.
|
|
||||||
return if example_group?(node) && redefines_subject?(node)
|
|
||||||
|
|
||||||
# Yield the current node if it is a message expectation.
|
expectation_detected = (subject_names + [:subject]).any? do |name|
|
||||||
yield(node) if message_expectation?(node, subject_name)
|
message_expectation?(node, name)
|
||||||
|
|
||||||
# Recurse through node's children looking for a message expectation.
|
|
||||||
node.each_child_node do |child|
|
|
||||||
find_subject_expectation(child, subject_name, &block)
|
|
||||||
end
|
end
|
||||||
end
|
return yield(node) if expectation_detected
|
||||||
|
|
||||||
# Check if node's children contain a subject definition
|
|
||||||
#
|
|
||||||
# @param node [RuboCop::Node]
|
|
||||||
#
|
|
||||||
# @return [Boolean]
|
|
||||||
def redefines_subject?(node)
|
|
||||||
node.each_child_node.any? do |child|
|
|
||||||
subject(child) || redefines_subject?(child)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Find a subject definition
|
|
||||||
#
|
|
||||||
# @param node [RuboCop::Node]
|
|
||||||
# @param parent [RuboCop::Node,nil]
|
|
||||||
#
|
|
||||||
# @yieldparam subject_name [Symbol] name of subject being defined
|
|
||||||
# @yieldparam parent [RuboCop::Node] parent of subject definition
|
|
||||||
def find_subject(node, parent: nil, &block)
|
|
||||||
# An implicit subject is defined by RSpec when no subject is declared
|
|
||||||
subject_name = subject(node) || :subject
|
|
||||||
|
|
||||||
yield(subject_name, parent) if parent
|
|
||||||
|
|
||||||
node.each_child_node do |child|
|
node.each_child_node do |child|
|
||||||
find_subject(child, parent: node, &block)
|
find_subject_expectations(child, subject_names, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -0,0 +1,56 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module RSpec
|
||||||
|
# Checks that memoized helpers names are symbols or strings.
|
||||||
|
#
|
||||||
|
# @example EnforcedStyle: symbols (default)
|
||||||
|
# # bad
|
||||||
|
# let('user_name') { 'Adam' }
|
||||||
|
# subject('user') { create_user }
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# let(:user_name) { 'Adam' }
|
||||||
|
# subject(:user) { create_user }
|
||||||
|
#
|
||||||
|
# @example EnforcedStyle: strings
|
||||||
|
# # bad
|
||||||
|
# let(:user_name) { 'Adam' }
|
||||||
|
# subject(:user) { create_user }
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# let('user_name') { 'Adam' }
|
||||||
|
# subject('user') { create_user }
|
||||||
|
class VariableDefinition < Cop
|
||||||
|
include ConfigurableEnforcedStyle
|
||||||
|
include RuboCop::RSpec::Variable
|
||||||
|
|
||||||
|
MSG = 'Use %<style>s for variable names.'
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
variable_definition?(node) do |variable|
|
||||||
|
if style_violation?(variable)
|
||||||
|
add_offense(variable, message: format(MSG, style: style))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def style_violation?(variable)
|
||||||
|
style == :symbols && string?(variable) ||
|
||||||
|
style == :strings && symbol?(variable)
|
||||||
|
end
|
||||||
|
|
||||||
|
def string?(node)
|
||||||
|
node.str_type? || node.dstr_type?
|
||||||
|
end
|
||||||
|
|
||||||
|
def symbol?(node)
|
||||||
|
node.sym_type? || node.dsym_type?
|
||||||
|
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