Merge branch 'speed-up-cask-full-names' into add-casks-to-install-search
This commit is contained in:
commit
0193caac2e
67
Dockerfile
67
Dockerfile
@ -1,36 +1,41 @@
|
|||||||
ARG version=22.04
|
ARG version=22.04
|
||||||
|
# version is passed through by Docker.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
FROM ubuntu:"${version}"
|
FROM ubuntu:"${version}"
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# We don't want to manually pin versions, happy to use whatever
|
||||||
|
# Ubuntu thinks is best.
|
||||||
# hadolint ignore=DL3008
|
# hadolint ignore=DL3008
|
||||||
# shellcheck disable=SC2292
|
|
||||||
|
# /etc/lsb-release is checked inside the container and sets DISTRIB_RELEASE.
|
||||||
|
# shellcheck disable=SC1091,SC2154
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends software-properties-common gnupg-agent \
|
&& apt-get install -y --no-install-recommends software-properties-common gnupg-agent \
|
||||||
&& add-apt-repository -y ppa:git-core/ppa \
|
&& add-apt-repository -y ppa:git-core/ppa \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
acl \
|
acl \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
file \
|
file \
|
||||||
fonts-dejavu-core \
|
fonts-dejavu-core \
|
||||||
g++ \
|
g++ \
|
||||||
gawk \
|
gawk \
|
||||||
git \
|
git \
|
||||||
less \
|
less \
|
||||||
libz-dev \
|
libz-dev \
|
||||||
locales \
|
locales \
|
||||||
make \
|
make \
|
||||||
netbase \
|
netbase \
|
||||||
openssh-client \
|
openssh-client \
|
||||||
patch \
|
patch \
|
||||||
sudo \
|
sudo \
|
||||||
uuid-runtime \
|
uuid-runtime \
|
||||||
tzdata \
|
tzdata \
|
||||||
jq \
|
jq \
|
||||||
&& if [ "$(. /etc/lsb-release; echo "${DISTRIB_RELEASE}" | cut -d. -f1)" -ge 18 ]; then apt-get install gpg; fi \
|
&& if [[ "$(. /etc/lsb-release; echo "${DISTRIB_RELEASE}" | cut -d. -f1)" -ge 18 ]]; then apt-get install gpg; fi \
|
||||||
&& apt-get remove --purge -y software-properties-common \
|
&& apt-get remove --purge -y software-properties-common \
|
||||||
&& apt-get autoremove --purge -y \
|
&& apt-get autoremove --purge -y \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
@ -45,15 +50,15 @@ ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}
|
|||||||
WORKDIR /home/linuxbrew
|
WORKDIR /home/linuxbrew
|
||||||
|
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
.linuxbrew/bin \
|
.linuxbrew/bin \
|
||||||
.linuxbrew/etc \
|
.linuxbrew/etc \
|
||||||
.linuxbrew/include \
|
.linuxbrew/include \
|
||||||
.linuxbrew/lib \
|
.linuxbrew/lib \
|
||||||
.linuxbrew/opt \
|
.linuxbrew/opt \
|
||||||
.linuxbrew/sbin \
|
.linuxbrew/sbin \
|
||||||
.linuxbrew/share \
|
.linuxbrew/share \
|
||||||
.linuxbrew/var/homebrew/linked \
|
.linuxbrew/var/homebrew/linked \
|
||||||
.linuxbrew/Cellar \
|
.linuxbrew/Cellar \
|
||||||
&& ln -s ../Homebrew/bin/brew .linuxbrew/bin/brew \
|
&& ln -s ../Homebrew/bin/brew .linuxbrew/bin/brew \
|
||||||
&& git -C .linuxbrew/Homebrew remote set-url origin https://github.com/Homebrew/brew \
|
&& git -C .linuxbrew/Homebrew remote set-url origin https://github.com/Homebrew/brew \
|
||||||
&& git -C .linuxbrew/Homebrew fetch origin \
|
&& git -C .linuxbrew/Homebrew fetch origin \
|
||||||
|
|||||||
@ -55,16 +55,14 @@ FormulaAudit:
|
|||||||
FormulaAuditStrict:
|
FormulaAuditStrict:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Homebrew/MoveToExtendOS:
|
|
||||||
Exclude:
|
|
||||||
- "Homebrew/{extend,test,requirements}/**/*"
|
|
||||||
- "Taps/**/*"
|
|
||||||
- "Homebrew/os.rb"
|
|
||||||
|
|
||||||
# enable all Homebrew custom cops
|
# enable all Homebrew custom cops
|
||||||
Homebrew:
|
Homebrew:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
# only used internally
|
||||||
|
Homebrew/MoveToExtendOS:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# makes DSL usage ugly.
|
# makes DSL usage ugly.
|
||||||
Layout/SpaceBeforeBrackets:
|
Layout/SpaceBeforeBrackets:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|||||||
@ -37,3 +37,10 @@ RSpec/MultipleMemoizedHelpers:
|
|||||||
# Annoying to have these autoremoved.
|
# Annoying to have these autoremoved.
|
||||||
RSpec/Focus:
|
RSpec/Focus:
|
||||||
AutoCorrect: false
|
AutoCorrect: false
|
||||||
|
|
||||||
|
# Gets confused on these tests for a `skip` DSL
|
||||||
|
RSpec/PendingWithoutReason:
|
||||||
|
Exclude:
|
||||||
|
- "**/dependency_expansion_spec.rb"
|
||||||
|
- "**/livecheck/skip_conditions_spec.rb"
|
||||||
|
- "**/livecheck_spec.rb"
|
||||||
|
|||||||
@ -2,6 +2,12 @@ inherit_from:
|
|||||||
- ../.rubocop_rspec.yml
|
- ../.rubocop_rspec.yml
|
||||||
- .rubocop_todo.yml
|
- .rubocop_todo.yml
|
||||||
|
|
||||||
|
Homebrew/MoveToExtendOS:
|
||||||
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- "{extend,test,requirements}/**/*"
|
||||||
|
- "os.rb"
|
||||||
|
|
||||||
# make rspec formatting more flexible
|
# make rspec formatting more flexible
|
||||||
Layout/MultilineMethodCallIndentation:
|
Layout/MultilineMethodCallIndentation:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|||||||
@ -120,7 +120,7 @@ GEM
|
|||||||
rspec-its (1.3.0)
|
rspec-its (1.3.0)
|
||||||
rspec-core (>= 3.0.0)
|
rspec-core (>= 3.0.0)
|
||||||
rspec-expectations (>= 3.0.0)
|
rspec-expectations (>= 3.0.0)
|
||||||
rspec-mocks (3.12.0)
|
rspec-mocks (3.12.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.12.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-retry (0.6.2)
|
rspec-retry (0.6.2)
|
||||||
@ -132,14 +132,14 @@ GEM
|
|||||||
rspec (>= 3, < 4)
|
rspec (>= 3, < 4)
|
||||||
rspec_junit_formatter (0.6.0)
|
rspec_junit_formatter (0.6.0)
|
||||||
rspec-core (>= 2, < 4, != 2.12.0)
|
rspec-core (>= 2, < 4, != 2.12.0)
|
||||||
rubocop (1.35.1)
|
rubocop (1.40.0)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.1.2.1)
|
parser (>= 3.1.2.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8, < 3.0)
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
rexml (>= 3.2.5, < 4.0)
|
rexml (>= 3.2.5, < 4.0)
|
||||||
rubocop-ast (>= 1.20.1, < 2.0)
|
rubocop-ast (>= 1.23.0, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 3.0)
|
unicode-display_width (>= 1.4.0, < 3.0)
|
||||||
rubocop-ast (1.24.0)
|
rubocop-ast (1.24.0)
|
||||||
@ -151,7 +151,7 @@ GEM
|
|||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.33.0, < 2.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
rubocop-rspec (2.15.0)
|
rubocop-rspec (2.16.0)
|
||||||
rubocop (~> 1.33)
|
rubocop (~> 1.33)
|
||||||
rubocop-sorbet (0.6.11)
|
rubocop-sorbet (0.6.11)
|
||||||
rubocop (>= 0.90.0)
|
rubocop (>= 0.90.0)
|
||||||
|
|||||||
@ -508,7 +508,7 @@ else
|
|||||||
message="Please update your system curl or set HOMEBREW_CURL_PATH to a newer version.
|
message="Please update your system curl or set HOMEBREW_CURL_PATH to a newer version.
|
||||||
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
|
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
|
||||||
Your curl version: ${curl_name_and_version##* }
|
Your curl version: ${curl_name_and_version##* }
|
||||||
Your curl executable: $(type -p ${HOMEBREW_CURL})"
|
Your curl executable: $(type -p "${HOMEBREW_CURL}")"
|
||||||
|
|
||||||
if [[ -z ${HOMEBREW_CURL_PATH} ]]
|
if [[ -z ${HOMEBREW_CURL_PATH} ]]
|
||||||
then
|
then
|
||||||
@ -537,7 +537,7 @@ Your curl executable: $(type -p ${HOMEBREW_CURL})"
|
|||||||
message="Please update your system Git or set HOMEBREW_GIT_PATH to a newer version.
|
message="Please update your system Git or set HOMEBREW_GIT_PATH to a newer version.
|
||||||
Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION}
|
Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION}
|
||||||
Your Git version: ${major}.${minor}.${micro}.${build}
|
Your Git version: ${major}.${minor}.${micro}.${build}
|
||||||
Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
|
Your Git executable: $(unset git && type -p "${HOMEBREW_GIT}")"
|
||||||
if [[ -z ${HOMEBREW_GIT_PATH} ]]
|
if [[ -z ${HOMEBREW_GIT_PATH} ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_FORCE_BREWED_GIT="1"
|
HOMEBREW_FORCE_BREWED_GIT="1"
|
||||||
|
|||||||
@ -416,7 +416,7 @@ module Cask
|
|||||||
add_error "cask token underscores should be replaced by hyphens" if cask.token.include? "_"
|
add_error "cask token underscores should be replaced by hyphens" if cask.token.include? "_"
|
||||||
add_error "cask token should not contain double hyphens" if cask.token.include? "--"
|
add_error "cask token should not contain double hyphens" if cask.token.include? "--"
|
||||||
|
|
||||||
if cask.token.match?(/[^a-z0-9\-]/)
|
if cask.token.match?(/[^a-z0-9-]/)
|
||||||
add_error "cask token should only contain lowercase alphanumeric characters and hyphens"
|
add_error "cask token should only contain lowercase alphanumeric characters and hyphens"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,16 @@ module Cask
|
|||||||
end.compact
|
end.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.full_names
|
||||||
|
Tap.flat_map do |tap|
|
||||||
|
next tap.cask_tokens.blank?
|
||||||
|
next tap.cask_tokens if tap.user == "Homebrew"
|
||||||
|
|
||||||
|
name = tap.name
|
||||||
|
tap.cask_tokens.map { |tok| "#{name}/#{tok}" }
|
||||||
|
end.flatten
|
||||||
|
end
|
||||||
|
|
||||||
def tap
|
def tap
|
||||||
return super if block_given? # Object#tap
|
return super if block_given? # Object#tap
|
||||||
|
|
||||||
|
|||||||
@ -185,31 +185,31 @@ class URL < Delegator
|
|||||||
&block
|
&block
|
||||||
)
|
)
|
||||||
super(
|
super(
|
||||||
if block
|
if block
|
||||||
LazyObject.new do
|
LazyObject.new do
|
||||||
*args = BlockDSL.new(uri, dsl: dsl, &block).call
|
*args = BlockDSL.new(uri, dsl: dsl, &block).call
|
||||||
options = args.last.is_a?(Hash) ? args.pop : {}
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
||||||
uri = T.let(args.first, T.any(URI::Generic, String))
|
uri = T.let(args.first, T.any(URI::Generic, String))
|
||||||
DSL.new(uri, **options)
|
DSL.new(uri, **options)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DSL.new(
|
||||||
|
T.must(uri),
|
||||||
|
verified: verified,
|
||||||
|
using: using,
|
||||||
|
tag: tag,
|
||||||
|
branch: branch,
|
||||||
|
revisions: revisions,
|
||||||
|
revision: revision,
|
||||||
|
trust_cert: trust_cert,
|
||||||
|
cookies: cookies,
|
||||||
|
referer: referer,
|
||||||
|
header: header,
|
||||||
|
user_agent: user_agent,
|
||||||
|
data: data,
|
||||||
|
only_path: only_path,
|
||||||
|
)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
DSL.new(
|
|
||||||
T.must(uri),
|
|
||||||
verified: verified,
|
|
||||||
using: using,
|
|
||||||
tag: tag,
|
|
||||||
branch: branch,
|
|
||||||
revisions: revisions,
|
|
||||||
revision: revision,
|
|
||||||
trust_cert: trust_cert,
|
|
||||||
cookies: cookies,
|
|
||||||
referer: referer,
|
|
||||||
header: header,
|
|
||||||
user_agent: user_agent,
|
|
||||||
data: data,
|
|
||||||
only_path: only_path,
|
|
||||||
)
|
|
||||||
end
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@from_block = !block.nil?
|
@from_block = !block.nil?
|
||||||
|
|||||||
@ -200,7 +200,7 @@ module Homebrew
|
|||||||
except: args.except,
|
except: args.except,
|
||||||
spdx_license_data: spdx_license_data,
|
spdx_license_data: spdx_license_data,
|
||||||
spdx_exception_data: spdx_exception_data,
|
spdx_exception_data: spdx_exception_data,
|
||||||
style_offenses: style_offenses ? style_offenses.for_path(f.path) : nil,
|
style_offenses: style_offenses&.for_path(f.path),
|
||||||
display_cop_names: args.display_cop_names?,
|
display_cop_names: args.display_cop_names?,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
|
|||||||
@ -234,7 +234,7 @@ module Homebrew
|
|||||||
system "/usr/bin/sudo", "--non-interactive", "/usr/sbin/purge"
|
system "/usr/bin/sudo", "--non-interactive", "/usr/sbin/purge"
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_tar_and_args!(args)
|
def setup_tar_and_args!(args, mtime)
|
||||||
# Without --only-json-tab bottles are never reproducible
|
# Without --only-json-tab bottles are never reproducible
|
||||||
default_tar_args = ["tar", [].freeze].freeze
|
default_tar_args = ["tar", [].freeze].freeze
|
||||||
return default_tar_args unless args.only_json_tab?
|
return default_tar_args unless args.only_json_tab?
|
||||||
@ -242,7 +242,7 @@ module Homebrew
|
|||||||
# Ensure tar is set up for reproducibility.
|
# Ensure tar is set up for reproducibility.
|
||||||
# https://reproducible-builds.org/docs/archives/
|
# https://reproducible-builds.org/docs/archives/
|
||||||
gnutar_args = [
|
gnutar_args = [
|
||||||
"--format", "pax", "--owner", "0", "--group", "0", "--sort", "name",
|
"--format", "pax", "--owner", "0", "--group", "0", "--sort", "name", "--mtime=#{mtime}",
|
||||||
# Set exthdr names to exclude PID (for GNU tar <1.33). Also don't store atime and ctime.
|
# Set exthdr names to exclude PID (for GNU tar <1.33). Also don't store atime and ctime.
|
||||||
"--pax-option", "globexthdr.name=/GlobalHead.%n,exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
|
"--pax-option", "globexthdr.name=/GlobalHead.%n,exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
|
||||||
].freeze
|
].freeze
|
||||||
@ -409,28 +409,18 @@ module Homebrew
|
|||||||
tab.write
|
tab.write
|
||||||
end
|
end
|
||||||
|
|
||||||
keg.find do |file|
|
keg.consistent_reproducible_symlink_permissions!
|
||||||
# Set the times for reproducible bottles.
|
|
||||||
if file.symlink?
|
|
||||||
# Need to make symlink permissions consistent on macOS and Linux
|
|
||||||
# TODO: Refactor and move to extend/os
|
|
||||||
File.lchmod 0777, file if OS.mac? # rubocop:disable Homebrew/MoveToExtendOS
|
|
||||||
File.lutime(tab.source_modified_time, tab.source_modified_time, file)
|
|
||||||
else
|
|
||||||
file.utime(tab.source_modified_time, tab.source_modified_time)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
cd cellar do
|
cd cellar do
|
||||||
sudo_purge
|
sudo_purge
|
||||||
# Tar then gzip for reproducible bottles.
|
# Tar then gzip for reproducible bottles.
|
||||||
tar, tar_args = setup_tar_and_args!(args)
|
tar_mtime = tab.source_modified_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
tar, tar_args = setup_tar_and_args!(args, tar_mtime)
|
||||||
safe_system tar, "--create", "--numeric-owner",
|
safe_system tar, "--create", "--numeric-owner",
|
||||||
*tar_args,
|
*tar_args,
|
||||||
"--file", tar_path, "#{f.name}/#{f.pkg_version}"
|
"--file", tar_path, "#{f.name}/#{f.pkg_version}"
|
||||||
sudo_purge
|
sudo_purge
|
||||||
# Set more times for reproducible bottles.
|
# Set filename as it affects the tarball checksum.
|
||||||
tar_path.utime(tab.source_modified_time, tab.source_modified_time)
|
|
||||||
relocatable_tar_path = "#{f}-bottle.tar"
|
relocatable_tar_path = "#{f}-bottle.tar"
|
||||||
mv tar_path, relocatable_tar_path
|
mv tar_path, relocatable_tar_path
|
||||||
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
|
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
|
||||||
|
|||||||
@ -852,7 +852,7 @@ module Homebrew
|
|||||||
.gsub("This is an unsupported configuration, likely to break in " \
|
.gsub("This is an unsupported configuration, likely to break in " \
|
||||||
"the future and leave your machine in an unknown state.", "")
|
"the future and leave your machine in an unknown state.", "")
|
||||||
.gsub("System Integrity Protection status: ", "")
|
.gsub("System Integrity Protection status: ", "")
|
||||||
.delete("\t\.")
|
.delete("\t.")
|
||||||
.capitalize
|
.capitalize
|
||||||
.strip
|
.strip
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# typed: true
|
# typed: false
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Keg
|
class Keg
|
||||||
@ -86,6 +86,8 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
undef prepare_debug_symbols
|
||||||
|
|
||||||
def prepare_debug_symbols
|
def prepare_debug_symbols
|
||||||
binary_executable_or_library_files.each do |file|
|
binary_executable_or_library_files.each do |file|
|
||||||
odebug "Extracting symbols #{file}"
|
odebug "Extracting symbols #{file}"
|
||||||
@ -100,4 +102,14 @@ class Keg
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
undef consistent_reproducible_symlink_permissions!
|
||||||
|
|
||||||
|
# Needed to make symlink permissions consistent on macOS and Linux for
|
||||||
|
# reproducible bottles.
|
||||||
|
def consistent_reproducible_symlink_permissions!
|
||||||
|
find do |file|
|
||||||
|
File.lchmod 0777, file if file.symlink?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -37,7 +37,7 @@ module Homebrew
|
|||||||
results = cask_tokens.extend(Searchable)
|
results = cask_tokens.extend(Searchable)
|
||||||
.search(string_or_regex)
|
.search(string_or_regex)
|
||||||
|
|
||||||
cask_names = Cask::Cask.all.map(&:full_name)
|
cask_names = Cask::Cask.full_names
|
||||||
results += DidYouMean::SpellChecker.new(dictionary: cask_names)
|
results += DidYouMean::SpellChecker.new(dictionary: cask_names)
|
||||||
.correct(string_or_regex)
|
.correct(string_or_regex)
|
||||||
|
|
||||||
|
|||||||
@ -493,7 +493,7 @@ class FormulaInstaller
|
|||||||
# stop installation from continuing.
|
# stop installation from continuing.
|
||||||
opoo <<~EOS
|
opoo <<~EOS
|
||||||
#{formula}: #{e.message}
|
#{formula}: #{e.message}
|
||||||
'conflicts_with \"#{c.name}\"' should be removed from #{formula.path.basename}.
|
'conflicts_with "#{c.name}"' should be removed from #{formula.path.basename}.
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
raise if Homebrew::EnvConfig.developer?
|
raise if Homebrew::EnvConfig.developer?
|
||||||
|
|||||||
@ -8,7 +8,6 @@ require "fileutils"
|
|||||||
require "json"
|
require "json"
|
||||||
require "json/add/exception"
|
require "json/add/exception"
|
||||||
require "ostruct"
|
require "ostruct"
|
||||||
require "pp"
|
|
||||||
require "forwardable"
|
require "forwardable"
|
||||||
|
|
||||||
# Only require "core_ext" here to ensure we're only requiring the minimum of
|
# Only require "core_ext" here to ensure we're only requiring the minimum of
|
||||||
|
|||||||
@ -485,6 +485,8 @@ class Keg
|
|||||||
|
|
||||||
def prepare_debug_symbols; end
|
def prepare_debug_symbols; end
|
||||||
|
|
||||||
|
def consistent_reproducible_symlink_permissions!; end
|
||||||
|
|
||||||
def remove_oldname_opt_record
|
def remove_oldname_opt_record
|
||||||
return unless oldname_opt_record
|
return unless oldname_opt_record
|
||||||
return if oldname_opt_record.resolved_path != path
|
return if oldname_opt_record.resolved_path != path
|
||||||
|
|||||||
@ -70,7 +70,7 @@ module Homebrew
|
|||||||
regex_prefix = Regexp.escape(match[:prefix] || "").gsub("\\-", "-")
|
regex_prefix = Regexp.escape(match[:prefix] || "").gsub("\\-", "-")
|
||||||
|
|
||||||
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
||||||
suffix = match[:suffix]&.sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t")
|
suffix = match[:suffix]&.sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
|
||||||
regex_suffix = Regexp.escape(suffix || "").gsub("\\-", "-")
|
regex_suffix = Regexp.escape(suffix || "").gsub("\\-", "-")
|
||||||
|
|
||||||
# Example directory regex: `%r{href=["']?v?(\d+(?:\.\d+)+)/}i`
|
# Example directory regex: `%r{href=["']?v?(\d+(?:\.\d+)+)/}i`
|
||||||
|
|||||||
@ -74,7 +74,7 @@ module Homebrew
|
|||||||
regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
|
regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
|
||||||
|
|
||||||
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
||||||
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t")
|
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
|
||||||
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
|
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
|
||||||
|
|
||||||
# Example regexes:
|
# Example regexes:
|
||||||
|
|||||||
@ -60,7 +60,7 @@ module Homebrew
|
|||||||
regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
|
regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
|
||||||
|
|
||||||
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
||||||
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t")
|
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
|
||||||
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
|
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
|
||||||
|
|
||||||
# Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i`
|
# Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i`
|
||||||
|
|||||||
@ -65,7 +65,7 @@ module Homebrew
|
|||||||
values[:url] = "https://pypi.org/project/#{T.must(match[:package_name]).gsub(/%20|_/, "-")}/#files"
|
values[:url] = "https://pypi.org/project/#{T.must(match[:package_name]).gsub(/%20|_/, "-")}/#files"
|
||||||
|
|
||||||
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
|
||||||
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t")
|
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
|
||||||
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
|
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
|
||||||
|
|
||||||
# Example regex: `%r{href=.*?/packages.*?/example[._-]v?(\d+(?:\.\d+)*(?:[._-]post\d+)?)\.t}i`
|
# Example regex: `%r{href=.*?/packages.*?/example[._-]v?(\d+(?:\.\d+)*(?:[._-]post\d+)?)\.t}i`
|
||||||
|
|||||||
@ -643,13 +643,13 @@ module RuboCop
|
|||||||
|
|
||||||
formula_path_strings(body_node, :prefix) do |p|
|
formula_path_strings(body_node, :prefix) do |p|
|
||||||
if (match = regex_match_group(p, %r{^(/share/(info|man))$}))
|
if (match = regex_match_group(p, %r{^(/share/(info|man))$}))
|
||||||
problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2]}}\""
|
problem ['"#', "{prefix}", match[1], '" should be "#{', match[2], '}"'].join
|
||||||
end
|
end
|
||||||
if (match = regex_match_group(p, %r{^((/share/man/)(man[1-8]))}))
|
if (match = regex_match_group(p, %r{^((/share/man/)(man[1-8]))}))
|
||||||
problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[3]}}\""
|
problem ['"#', "{prefix}", match[1], '" should be "#{', match[3], '}"'].join
|
||||||
end
|
end
|
||||||
if (match = regex_match_group(p, %r{^(/(bin|include|libexec|lib|sbin|share|Frameworks))}i))
|
if (match = regex_match_group(p, %r{^(/(bin|include|libexec|lib|sbin|share|Frameworks))}i))
|
||||||
problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2].downcase}}\""
|
problem ['"#', "{prefix}", match[1], '" should be "#{', match[2].downcase, '}"'].join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
require "active_support/core_ext/array/access"
|
require "active_support/core_ext/array/access"
|
||||||
require "rubocops/shared/helper_functions"
|
require "rubocops/shared/helper_functions"
|
||||||
|
require "shellwords"
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Cop
|
module Cop
|
||||||
|
|||||||
@ -202,7 +202,7 @@ class Sandbox
|
|||||||
|
|
||||||
def path_filter(path, type)
|
def path_filter(path, type)
|
||||||
case type
|
case type
|
||||||
when :regex then "regex \#\"#{path}\""
|
when :regex then "regex #\"#{path}\""
|
||||||
when :subpath then "subpath \"#{expand_realpath(Pathname.new(path))}\""
|
when :subpath then "subpath \"#{expand_realpath(Pathname.new(path))}\""
|
||||||
when :literal, nil then "literal \"#{expand_realpath(Pathname.new(path))}\""
|
when :literal, nil then "literal \"#{expand_realpath(Pathname.new(path))}\""
|
||||||
end
|
end
|
||||||
|
|||||||
@ -752,8 +752,8 @@ class RSpec::Mocks::Matchers::HaveReceived
|
|||||||
def exactly(*args); end
|
def exactly(*args); end
|
||||||
def failure_message; end
|
def failure_message; end
|
||||||
def failure_message_when_negated; end
|
def failure_message_when_negated; end
|
||||||
|
def matcher_name; end
|
||||||
def matches?(subject, &block); end
|
def matches?(subject, &block); end
|
||||||
def name; end
|
|
||||||
def once(*args); end
|
def once(*args); end
|
||||||
def ordered(*args); end
|
def ordered(*args); end
|
||||||
def setup_allowance(_subject, &_block); end
|
def setup_allowance(_subject, &_block); end
|
||||||
@ -803,8 +803,8 @@ class RSpec::Mocks::Matchers::Receive
|
|||||||
def description; end
|
def description; end
|
||||||
def does_not_match?(subject, &block); end
|
def does_not_match?(subject, &block); end
|
||||||
def exactly(*args, &block); end
|
def exactly(*args, &block); end
|
||||||
|
def matcher_name; end
|
||||||
def matches?(subject, &block); end
|
def matches?(subject, &block); end
|
||||||
def name; end
|
|
||||||
def never(*args, &block); end
|
def never(*args, &block); end
|
||||||
def once(*args, &block); end
|
def once(*args, &block); end
|
||||||
def ordered(*args, &block); end
|
def ordered(*args, &block); end
|
||||||
@ -849,8 +849,8 @@ class RSpec::Mocks::Matchers::ReceiveMessageChain
|
|||||||
def and_yield(*args, &block); end
|
def and_yield(*args, &block); end
|
||||||
def description; end
|
def description; end
|
||||||
def does_not_match?(*_args); end
|
def does_not_match?(*_args); end
|
||||||
|
def matcher_name; end
|
||||||
def matches?(subject, &block); end
|
def matches?(subject, &block); end
|
||||||
def name; end
|
|
||||||
def setup_allowance(subject, &block); end
|
def setup_allowance(subject, &block); end
|
||||||
def setup_any_instance_allowance(subject, &block); end
|
def setup_any_instance_allowance(subject, &block); end
|
||||||
def setup_any_instance_expectation(subject, &block); end
|
def setup_any_instance_expectation(subject, &block); end
|
||||||
@ -871,8 +871,8 @@ class RSpec::Mocks::Matchers::ReceiveMessages
|
|||||||
|
|
||||||
def description; end
|
def description; end
|
||||||
def does_not_match?(_subject); end
|
def does_not_match?(_subject); end
|
||||||
|
def matcher_name; end
|
||||||
def matches?(subject); end
|
def matches?(subject); end
|
||||||
def name; end
|
|
||||||
def setup_allowance(subject); end
|
def setup_allowance(subject); end
|
||||||
def setup_any_instance_allowance(subject); end
|
def setup_any_instance_allowance(subject); end
|
||||||
def setup_any_instance_expectation(subject); end
|
def setup_any_instance_expectation(subject); end
|
||||||
@ -1031,6 +1031,7 @@ class RSpec::Mocks::MethodDouble
|
|||||||
def usable_rspec_prepended_module; end
|
def usable_rspec_prepended_module; end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RSpec::Mocks::MethodDouble::FROZEN_ERROR_MSG = T.let(T.unsafe(nil), Regexp)
|
||||||
class RSpec::Mocks::MethodDouble::RSpecPrependedModule < ::Module; end
|
class RSpec::Mocks::MethodDouble::RSpecPrependedModule < ::Module; end
|
||||||
|
|
||||||
class RSpec::Mocks::MethodReference
|
class RSpec::Mocks::MethodReference
|
||||||
@ -83,6 +83,7 @@ class RuboCop::Cop::RSpec::Be < ::RuboCop::Cop::RSpec::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::RSpec::Be::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Be::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::Be::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::BeEq < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::BeEq < ::RuboCop::Cop::RSpec::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
@ -131,7 +132,7 @@ RuboCop::Cop::RSpec::BeforeAfterAll::MSG = T.let(T.unsafe(nil), String)
|
|||||||
RuboCop::Cop::RSpec::BeforeAfterAll::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::BeforeAfterAll::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
module RuboCop::Cop::RSpec::Capybara; end
|
module RuboCop::Cop::RSpec::Capybara; end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def as_is_matcher(param0 = T.unsafe(nil)); end
|
def as_is_matcher(param0 = T.unsafe(nil)); end
|
||||||
@ -172,7 +173,7 @@ end
|
|||||||
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MAP = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MAP = T.let(T.unsafe(nil), Hash)
|
||||||
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::NegationMatcher < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Capybara::NegationMatcher < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
@ -195,7 +196,7 @@ RuboCop::Cop::RSpec::Capybara::NegationMatcher::NEGATIVE_MATCHERS = T.let(T.unsa
|
|||||||
RuboCop::Cop::RSpec::Capybara::NegationMatcher::POSITIVE_MATCHERS = T.let(T.unsafe(nil), Set)
|
RuboCop::Cop::RSpec::Capybara::NegationMatcher::POSITIVE_MATCHERS = T.let(T.unsafe(nil), Set)
|
||||||
RuboCop::Cop::RSpec::Capybara::NegationMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
RuboCop::Cop::RSpec::Capybara::NegationMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::SpecificActions < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Capybara::SpecificActions < ::RuboCop::Cop::Base
|
||||||
def click_on_selector(param0 = T.unsafe(nil)); end
|
def click_on_selector(param0 = T.unsafe(nil)); end
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
|
|
||||||
@ -213,7 +214,7 @@ RuboCop::Cop::RSpec::Capybara::SpecificActions::MSG = T.let(T.unsafe(nil), Strin
|
|||||||
RuboCop::Cop::RSpec::Capybara::SpecificActions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::Capybara::SpecificActions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::RSpec::Capybara::SpecificActions::SPECIFIC_ACTION = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::RSpec::Capybara::SpecificActions::SPECIFIC_ACTION = T.let(T.unsafe(nil), Hash)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::SpecificFinders < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Capybara::SpecificFinders < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::RangeHelp
|
include ::RuboCop::Cop::RangeHelp
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
@ -235,9 +236,7 @@ end
|
|||||||
RuboCop::Cop::RSpec::Capybara::SpecificFinders::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Capybara::SpecificFinders::MSG = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::RSpec::Capybara::SpecificFinders::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::Capybara::SpecificFinders::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::SpecificMatcher < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Capybara::SpecificMatcher < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::RSpec::CapybaraHelp
|
|
||||||
|
|
||||||
def first_argument(param0 = T.unsafe(nil)); end
|
def first_argument(param0 = T.unsafe(nil)); end
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
|
|
||||||
@ -252,7 +251,7 @@ RuboCop::Cop::RSpec::Capybara::SpecificMatcher::MSG = T.let(T.unsafe(nil), Strin
|
|||||||
RuboCop::Cop::RSpec::Capybara::SpecificMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::Capybara::SpecificMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::RSpec::Capybara::SpecificMatcher::SPECIFIC_MATCHER = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::RSpec::Capybara::SpecificMatcher::SPECIFIC_MATCHER = T.let(T.unsafe(nil), Hash)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::VisibilityMatcher < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Capybara::VisibilityMatcher < ::RuboCop::Cop::Base
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
def visible_false?(param0 = T.unsafe(nil)); end
|
def visible_false?(param0 = T.unsafe(nil)); end
|
||||||
def visible_true?(param0 = T.unsafe(nil)); end
|
def visible_true?(param0 = T.unsafe(nil)); end
|
||||||
@ -484,6 +483,22 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::Dialect::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Dialect::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::DuplicatedMetadata < ::RuboCop::Cop::RSpec::Base
|
||||||
|
include ::RuboCop::Cop::RSpec::Metadata
|
||||||
|
include ::RuboCop::Cop::RangeHelp
|
||||||
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
|
def on_metadata(symbols, _pairs); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def autocorrect(corrector, node); end
|
||||||
|
def duplicated?(node); end
|
||||||
|
def on_metadata_symbol(node); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::DuplicatedMetadata::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base
|
||||||
include ::RuboCop::Cop::RangeHelp
|
include ::RuboCop::Cop::RangeHelp
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
@ -521,11 +536,14 @@ class RuboCop::Cop::RSpec::EmptyLineAfterExample < ::RuboCop::Cop::RSpec::Base
|
|||||||
include ::RuboCop::Cop::RSpec::EmptyLineSeparation
|
include ::RuboCop::Cop::RSpec::EmptyLineSeparation
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
|
def on_block(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def allow_consecutive_one_liners?; end
|
def allow_consecutive_one_liners?; end
|
||||||
def allowed_one_liner?(node); end
|
def allowed_one_liner?(node); end
|
||||||
def consecutive_one_liner?(node); end
|
def consecutive_one_liner?(node); end
|
||||||
def next_one_line_example?(node); end
|
def next_one_line_example?(node); end
|
||||||
def on_block(node); end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::RSpec::EmptyLineAfterExample::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::EmptyLineAfterExample::MSG = T.let(T.unsafe(nil), String)
|
||||||
@ -676,6 +694,7 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::ExpectActual::COMPLEX_LITERALS = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::ExpectActual::COMPLEX_LITERALS = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::RSpec::ExpectActual::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::ExpectActual::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::ExpectActual::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::RSpec::ExpectActual::SIMPLE_LITERALS = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::ExpectActual::SIMPLE_LITERALS = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::RSpec::ExpectActual::SUPPORTED_MATCHERS = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::ExpectActual::SUPPORTED_MATCHERS = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
@ -738,7 +757,7 @@ RuboCop::Cop::RSpec::ExplicitHelper::BUILT_IN_MATCHERS = T.let(T.unsafe(nil), Ar
|
|||||||
RuboCop::Cop::RSpec::ExplicitHelper::MSG_EXPLICIT = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::ExplicitHelper::MSG_EXPLICIT = T.let(T.unsafe(nil), String)
|
||||||
module RuboCop::Cop::RSpec::FactoryBot; end
|
module RuboCop::Cop::RSpec::FactoryBot; end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::Cop::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def association?(param0 = T.unsafe(nil)); end
|
def association?(param0 = T.unsafe(nil)); end
|
||||||
@ -762,19 +781,19 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
include ::RuboCop::RSpec::FactoryBot::Language
|
include ::RuboCop::RSpec::FactoryBot::Language
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def ambiguous_without_parentheses?(node); end
|
|
||||||
def factory_call(param0 = T.unsafe(nil)); end
|
def factory_call(param0 = T.unsafe(nil)); end
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
def process_with_parentheses(node); end
|
|
||||||
def process_without_parentheses(node); end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def ambiguous_without_parentheses?(node); end
|
||||||
|
def process_with_parentheses(node); end
|
||||||
|
def process_without_parentheses(node); end
|
||||||
def remove_parentheses(corrector, node); end
|
def remove_parentheses(corrector, node); end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
@ -787,7 +806,7 @@ RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::MSG_OMIT_PARENS = T
|
|||||||
RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::MSG_REQUIRE_PARENS = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::MSG_REQUIRE_PARENS = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::FactoryBot::CreateList < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::FactoryBot::CreateList < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
include ::RuboCop::RSpec::FactoryBot::Language
|
include ::RuboCop::RSpec::FactoryBot::Language
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
@ -845,11 +864,12 @@ class RuboCop::Cop::RSpec::FactoryBot::CreateList::TimesCorrector
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def factory_call_block_source; end
|
||||||
def generate_n_times_block(node); end
|
def generate_n_times_block(node); end
|
||||||
def node; end
|
def node; end
|
||||||
end
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::FactoryBot::FactoryClassName < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::FactoryBot::FactoryClassName < ::RuboCop::Cop::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def class_name(param0 = T.unsafe(nil)); end
|
def class_name(param0 = T.unsafe(nil)); end
|
||||||
@ -864,6 +884,25 @@ RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::ALLOWED_CONSTANTS = T.let(T.u
|
|||||||
RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::MSG = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle < ::RuboCop::Cop::Base
|
||||||
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
|
include ::RuboCop::RSpec::FactoryBot::Language
|
||||||
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
|
def factory_call(param0 = T.unsafe(nil)); end
|
||||||
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def offense_for_string_style?(name); end
|
||||||
|
def offense_for_symbol_style?(name); end
|
||||||
|
def register_offense(name, prefer); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle::FACTORY_CALLS = T.let(T.unsafe(nil), Set)
|
||||||
|
RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::FactoryBot::SyntaxMethods < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::FactoryBot::SyntaxMethods < ::RuboCop::Cop::RSpec::Base
|
||||||
include ::RuboCop::Cop::RSpec::InsideExampleGroup
|
include ::RuboCop::Cop::RSpec::InsideExampleGroup
|
||||||
include ::RuboCop::Cop::RangeHelp
|
include ::RuboCop::Cop::RangeHelp
|
||||||
@ -1010,6 +1049,7 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::ImplicitExpect::ENFORCED_REPLACEMENTS = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::RSpec::ImplicitExpect::ENFORCED_REPLACEMENTS = T.let(T.unsafe(nil), Hash)
|
||||||
RuboCop::Cop::RSpec::ImplicitExpect::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::ImplicitExpect::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::ImplicitExpect::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::ImplicitSubject < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::ImplicitSubject < ::RuboCop::Cop::RSpec::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
@ -1132,12 +1172,12 @@ class RuboCop::Cop::RSpec::LeadingSubject < ::RuboCop::Cop::RSpec::Base
|
|||||||
include ::RuboCop::Cop::RSpec::InsideExampleGroup
|
include ::RuboCop::Cop::RSpec::InsideExampleGroup
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def check_previous_nodes(node); end
|
|
||||||
def on_block(node); end
|
def on_block(node); end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def autocorrect(corrector, node, sibling); end
|
def autocorrect(corrector, node, sibling); end
|
||||||
|
def check_previous_nodes(node); end
|
||||||
def offending?(node); end
|
def offending?(node); end
|
||||||
def offending_node(node); end
|
def offending_node(node); end
|
||||||
def parent(node); end
|
def parent(node); end
|
||||||
@ -1230,8 +1270,21 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::MessageSpies::MSG_HAVE_RECEIVED = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::MessageSpies::MSG_HAVE_RECEIVED = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::RSpec::MessageSpies::MSG_RECEIVE = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::MessageSpies::MSG_RECEIVE = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::MessageSpies::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::RSpec::MessageSpies::SUPPORTED_STYLES = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::RSpec::MessageSpies::SUPPORTED_STYLES = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
|
module RuboCop::Cop::RSpec::Metadata
|
||||||
|
include ::RuboCop::RSpec::Language
|
||||||
|
extend ::RuboCop::AST::NodePattern::Macros
|
||||||
|
|
||||||
|
def metadata_in_block(param0, param1); end
|
||||||
|
def on_block(node); end
|
||||||
|
def on_metadata(_symbols, _pairs); end
|
||||||
|
def on_numblock(node); end
|
||||||
|
def rspec_configure(param0 = T.unsafe(nil)); end
|
||||||
|
def rspec_metadata(param0 = T.unsafe(nil)); end
|
||||||
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::MissingExampleGroupArgument < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::MissingExampleGroupArgument < ::RuboCop::Cop::RSpec::Base
|
||||||
def on_block(node); end
|
def on_block(node); end
|
||||||
end
|
end
|
||||||
@ -1405,6 +1458,24 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::Pending::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Pending::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::PendingWithoutReason < ::RuboCop::Cop::RSpec::Base
|
||||||
|
def on_send(node); end
|
||||||
|
def pending_by_example_method?(param0 = T.unsafe(nil)); end
|
||||||
|
def pending_by_metadata_without_reason?(param0 = T.unsafe(nil)); end
|
||||||
|
def skipped_by_example_group_method?(param0 = T.unsafe(nil)); end
|
||||||
|
def skipped_by_example_method?(param0 = T.unsafe(nil)); end
|
||||||
|
def skipped_by_metadata_without_reason?(param0 = T.unsafe(nil)); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def pending_by_pending_step_without_reason?(node); end
|
||||||
|
def pending_without_reason?(node); end
|
||||||
|
def skipped_by_skip_step_without_reason?(node); end
|
||||||
|
def skipped_without_reason?(node); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::PendingWithoutReason::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
include ::RuboCop::Cop::RSpec::InflectedHelper
|
include ::RuboCop::Cop::RSpec::InflectedHelper
|
||||||
@ -1420,6 +1491,7 @@ class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base
|
|||||||
def block_loc(send_node); end
|
def block_loc(send_node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::PredicateMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
module RuboCop::Cop::RSpec::Rails; end
|
module RuboCop::Cop::RSpec::Rails; end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Rails::AvoidSetupHook < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Rails::AvoidSetupHook < ::RuboCop::Cop::RSpec::Base
|
||||||
@ -1431,7 +1503,7 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::Rails::AvoidSetupHook::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Rails::AvoidSetupHook::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Rails::HaveHttpStatus < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Rails::HaveHttpStatus < ::RuboCop::Cop::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def match_status(param0 = T.unsafe(nil)); end
|
def match_status(param0 = T.unsafe(nil)); end
|
||||||
@ -1439,6 +1511,8 @@ class RuboCop::Cop::RSpec::Rails::HaveHttpStatus < ::RuboCop::Cop::RSpec::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||||
|
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::RUNNERS = T.let(T.unsafe(nil), Set)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Rails::HttpStatus < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::Rails::HttpStatus < ::RuboCop::Cop::RSpec::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
@ -1679,8 +1753,11 @@ end
|
|||||||
RuboCop::Cop::RSpec::ScatteredLet::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::ScatteredLet::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::ScatteredSetup < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::ScatteredSetup < ::RuboCop::Cop::RSpec::Base
|
||||||
def lines_msg(numbers); end
|
|
||||||
def on_block(node); end
|
def on_block(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def lines_msg(numbers); end
|
||||||
def repeated_hooks(node); end
|
def repeated_hooks(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1755,19 +1832,15 @@ module RuboCop::Cop::RSpec::SkipOrPending
|
|||||||
end
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::SortMetadata < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::SortMetadata < ::RuboCop::Cop::RSpec::Base
|
||||||
|
include ::RuboCop::Cop::RSpec::Metadata
|
||||||
include ::RuboCop::Cop::RangeHelp
|
include ::RuboCop::Cop::RangeHelp
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def metadata_in_block(param0, param1); end
|
def on_metadata(symbols, pairs); end
|
||||||
def on_block(node); end
|
|
||||||
def on_numblock(node); end
|
|
||||||
def rspec_configure(param0 = T.unsafe(nil)); end
|
|
||||||
def rspec_metadata(param0 = T.unsafe(nil)); end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def crime_scene(symbols, pairs); end
|
def crime_scene(symbols, pairs); end
|
||||||
def investigate(symbols, pairs); end
|
|
||||||
def replacement(symbols, pairs); end
|
def replacement(symbols, pairs); end
|
||||||
def sort_pairs(pairs); end
|
def sort_pairs(pairs); end
|
||||||
def sort_symbols(symbols); end
|
def sort_symbols(symbols); end
|
||||||
@ -1794,6 +1867,7 @@ class RuboCop::Cop::RSpec::StubbedMock < ::RuboCop::Cop::RSpec::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::RSpec::StubbedMock::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::StubbedMock::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::StubbedMock::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::SubjectDeclaration < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::SubjectDeclaration < ::RuboCop::Cop::RSpec::Base
|
||||||
def offensive_subject_declaration?(param0 = T.unsafe(nil)); end
|
def offensive_subject_declaration?(param0 = T.unsafe(nil)); end
|
||||||
@ -1840,10 +1914,13 @@ module RuboCop::Cop::RSpec::TopLevelGroup
|
|||||||
end
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::UnspecifiedException < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::UnspecifiedException < ::RuboCop::Cop::RSpec::Base
|
||||||
def block_with_args?(node); end
|
|
||||||
def empty_exception_matcher?(node); end
|
|
||||||
def empty_raise_error_or_exception(param0 = T.unsafe(nil)); end
|
def empty_raise_error_or_exception(param0 = T.unsafe(nil)); end
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def block_with_args?(node); end
|
||||||
|
def empty_exception_matcher?(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::RSpec::UnspecifiedException::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::UnspecifiedException::MSG = T.let(T.unsafe(nil), String)
|
||||||
@ -2174,7 +2251,7 @@ end
|
|||||||
|
|
||||||
module RuboCop::RSpec::Language::Runners
|
module RuboCop::RSpec::Language::Runners
|
||||||
class << self
|
class << self
|
||||||
def all(element); end
|
def all(element = T.unsafe(nil)); end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -3287,9 +3287,13 @@ module CopHelper
|
|||||||
|
|
||||||
def autocorrect_source_file(source); end
|
def autocorrect_source_file(source); end
|
||||||
|
|
||||||
|
def configuration(); end
|
||||||
|
|
||||||
def inspect_source(source, file=T.unsafe(nil)); end
|
def inspect_source(source, file=T.unsafe(nil)); end
|
||||||
|
|
||||||
def parse_source(source, file=T.unsafe(nil)); end
|
def parse_source(source, file=T.unsafe(nil)); end
|
||||||
|
|
||||||
|
def registry(); end
|
||||||
end
|
end
|
||||||
|
|
||||||
module CopHelper
|
module CopHelper
|
||||||
@ -6776,6 +6780,7 @@ class RuboCop::AST::NodePattern::Parser
|
|||||||
end
|
end
|
||||||
|
|
||||||
module RuboCop::AST::NodePattern::Sets
|
module RuboCop::AST::NodePattern::Sets
|
||||||
|
SET_ANY_EMPTY = ::T.let(nil, ::T.untyped)
|
||||||
SET_ARM_INTEL = ::T.let(nil, ::T.untyped)
|
SET_ARM_INTEL = ::T.let(nil, ::T.untyped)
|
||||||
SET_BASH_COMPLETION_ZSH_COMPLETION_FISH_COMPLETION = ::T.let(nil, ::T.untyped)
|
SET_BASH_COMPLETION_ZSH_COMPLETION_FISH_COMPLETION = ::T.let(nil, ::T.untyped)
|
||||||
SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped)
|
SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped)
|
||||||
@ -6784,7 +6789,9 @@ module RuboCop::AST::NodePattern::Sets
|
|||||||
SET_MAC_LINUX = ::T.let(nil, ::T.untyped)
|
SET_MAC_LINUX = ::T.let(nil, ::T.untyped)
|
||||||
SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped)
|
SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped)
|
||||||
SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped)
|
SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped)
|
||||||
|
SET_PRESENT_ANY_BLANK_EMPTY = ::T.let(nil, ::T.untyped)
|
||||||
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
|
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
|
||||||
|
SET_TO_TO_NOT_NOT_TO = ::T.let(nil, ::T.untyped)
|
||||||
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
||||||
SET____ETC_4 = ::T.let(nil, ::T.untyped)
|
SET____ETC_4 = ::T.let(nil, ::T.untyped)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -37,7 +37,7 @@ describe Cask::Cmd::Reinstall, :cask do
|
|||||||
==> Removing App '.*Caffeine.app'
|
==> Removing App '.*Caffeine.app'
|
||||||
==> Dispatching zap stanza
|
==> Dispatching zap stanza
|
||||||
==> Trashing files:
|
==> Trashing files:
|
||||||
.*org\.example\.caffeine\.plist
|
.*org.example.caffeine.plist
|
||||||
==> Removing all staged versions of Cask 'local-caffeine'
|
==> Removing all staged versions of Cask 'local-caffeine'
|
||||||
==> Installing Cask local-caffeine
|
==> Installing Cask local-caffeine
|
||||||
==> Moving App 'Caffeine.app' to '.*Caffeine.app'
|
==> Moving App 'Caffeine.app' to '.*Caffeine.app'
|
||||||
|
|||||||
@ -51,7 +51,7 @@ describe Homebrew::Livecheck do
|
|||||||
|
|
||||||
livecheck do
|
livecheck do
|
||||||
url "https://formulae.brew.sh/api/formula/ruby.json"
|
url "https://formulae.brew.sh/api/formula/ruby.json"
|
||||||
regex(/"stable":"(\d+(?:\.\d+)+)"/i)
|
regex(/"stable":"(\d+(?:.\d+)+)"/i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -227,7 +227,7 @@ describe Homebrew::Livecheck do
|
|||||||
|
|
||||||
livecheck do
|
livecheck do
|
||||||
url "https://formulae.brew.sh/api/formula/ruby.json"
|
url "https://formulae.brew.sh/api/formula/ruby.json"
|
||||||
regex(/"stable":"(\d+(?:\.\d+)+)"/i)
|
regex(/"stable":"(\d+(?:.\d+)+)"/i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|||||||
@ -17,14 +17,14 @@ describe RuboCop::Cop::Cask::Desc do
|
|||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
desc 'A bar program'
|
desc 'A bar program'
|
||||||
^ Description shouldn\'t start with an article.
|
^ Description shouldn't start with an article.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
desc 'The bar program'
|
desc 'The bar program'
|
||||||
^^^ Description shouldn\'t start with an article.
|
^^^ Description shouldn't start with an article.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
@ -46,28 +46,28 @@ describe RuboCop::Cop::Cask::Desc do
|
|||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foobar' do
|
cask 'foobar' do
|
||||||
desc 'Foo-Bar program'
|
desc 'Foo-Bar program'
|
||||||
^^^^^^^ Description shouldn\'t start with the cask name.
|
^^^^^^^ Description shouldn't start with the cask name.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'Foo bar program'
|
desc 'Foo bar program'
|
||||||
^^^^^^^ Description shouldn\'t start with the cask name.
|
^^^^^^^ Description shouldn't start with the cask name.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'Foo-Bar program'
|
desc 'Foo-Bar program'
|
||||||
^^^^^^^ Description shouldn\'t start with the cask name.
|
^^^^^^^ Description shouldn't start with the cask name.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'Foo Bar'
|
desc 'Foo Bar'
|
||||||
^^^^^^^ Description shouldn\'t start with the cask name.
|
^^^^^^^ Description shouldn't start with the cask name.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -76,28 +76,28 @@ describe RuboCop::Cop::Cask::Desc do
|
|||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'macOS status bar monitor'
|
desc 'macOS status bar monitor'
|
||||||
^^^^^ Description shouldn\'t contain the platform.
|
^^^^^ Description shouldn't contain the platform.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'Toggles dark mode on Mac OS Mojave'
|
desc 'Toggles dark mode on Mac OS Mojave'
|
||||||
^^^^^^ Description shouldn\'t contain the platform.
|
^^^^^^ Description shouldn't contain the platform.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'Better input source switcher for OS X'
|
desc 'Better input source switcher for OS X'
|
||||||
^^^^ Description shouldn\'t contain the platform.
|
^^^^ Description shouldn't contain the platform.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
|
||||||
cask 'foo-bar' do
|
cask 'foo-bar' do
|
||||||
desc 'Media Manager for Mac OS X'
|
desc 'Media Manager for Mac OS X'
|
||||||
^^^^^^^^ Description shouldn\'t contain the platform.
|
^^^^^^^^ Description shouldn't contain the platform.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ describe RuboCop::Cop::Cask::Desc do
|
|||||||
expect_offense <<~RUBY
|
expect_offense <<~RUBY
|
||||||
cask 'foo' do
|
cask 'foo' do
|
||||||
desc 'Application for managing macOS virtual machines on macOS'
|
desc 'Application for managing macOS virtual machines on macOS'
|
||||||
^^^^^ Description shouldn\'t contain the platform.
|
^^^^^ Description shouldn't contain the platform.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do
|
|||||||
url "https://brew.sh/foo-1.0.tgz"
|
url "https://brew.sh/foo-1.0.tgz"
|
||||||
def caveats
|
def caveats
|
||||||
"setuid"
|
"setuid"
|
||||||
^^^^^^^^ Don\'t recommend setuid in the caveats, suggest sudo instead.
|
^^^^^^^^ Don't recommend setuid in the caveats, suggest sudo instead.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|||||||
@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
|
|||||||
livecheck do
|
livecheck do
|
||||||
^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5)
|
^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5)
|
||||||
url "https://brew.sh/foo/versions/"
|
url "https://brew.sh/foo/versions/"
|
||||||
regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/)
|
regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -75,7 +75,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
|
|||||||
|
|
||||||
livecheck do
|
livecheck do
|
||||||
url "https://brew.sh/foo/versions/"
|
url "https://brew.sh/foo/versions/"
|
||||||
regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/)
|
regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
|
||||||
end
|
end
|
||||||
|
|
||||||
bottle :unneeded
|
bottle :unneeded
|
||||||
|
|||||||
@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
desc 'An aardvark'
|
desc 'An aardvark'
|
||||||
^^ Description shouldn\'t start with an article.
|
^^ Description shouldn't start with an article.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
desc 'The aardvark'
|
desc 'The aardvark'
|
||||||
^^^ Description shouldn\'t start with an article.
|
^^^ Description shouldn't start with an article.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -113,7 +113,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
desc 'Foo is a foobar'
|
desc 'Foo is a foobar'
|
||||||
^^^ Description shouldn\'t start with the formula name.
|
^^^ Description shouldn't start with the formula name.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
depends_on :automake
|
depends_on :automake
|
||||||
^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be \"automake\".
|
^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be "automake".
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
depends_on :autoconf
|
depends_on :autoconf
|
||||||
^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be \"autoconf\".
|
^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be "autoconf".
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
depends_on :libtool
|
depends_on :libtool
|
||||||
^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be \"libtool\".
|
^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be "libtool".
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
depends_on :apr
|
depends_on :apr
|
||||||
^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be \"apr-util\".
|
^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be "apr-util".
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,7 +15,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
system "foo bar"
|
system "foo bar"
|
||||||
^^^^^^^^^ Separate `system` commands into `\"foo\", \"bar\"`
|
^^^^^^^^^ Separate `system` commands into `"foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -34,7 +34,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
system "\#{bin}/foo bar"
|
system "\#{bin}/foo bar"
|
||||||
^^^^^^^^^^^^^^^^ Separate `system` commands into `\"\#{bin}/foo\", \"bar\"`
|
^^^^^^^^^^^^^^^^ Separate `system` commands into `"\#{bin}/foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -83,7 +83,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
Utils.popen_read("foo bar")
|
Utils.popen_read("foo bar")
|
||||||
^^^^^^^^^ Separate `Utils.popen_read` commands into `\"foo\", \"bar\"`
|
^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -102,7 +102,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
Utils.safe_popen_read("foo bar")
|
Utils.safe_popen_read("foo bar")
|
||||||
^^^^^^^^^ Separate `Utils.safe_popen_read` commands into `\"foo\", \"bar\"`
|
^^^^^^^^^ Separate `Utils.safe_popen_read` commands into `"foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -121,7 +121,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
Utils.popen_write("foo bar")
|
Utils.popen_write("foo bar")
|
||||||
^^^^^^^^^ Separate `Utils.popen_write` commands into `\"foo\", \"bar\"`
|
^^^^^^^^^ Separate `Utils.popen_write` commands into `"foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -140,7 +140,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
Utils.safe_popen_write("foo bar")
|
Utils.safe_popen_write("foo bar")
|
||||||
^^^^^^^^^ Separate `Utils.safe_popen_write` commands into `\"foo\", \"bar\"`
|
^^^^^^^^^ Separate `Utils.safe_popen_write` commands into `"foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -159,7 +159,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
Utils.popen_read("\#{bin}/foo bar")
|
Utils.popen_read("\#{bin}/foo bar")
|
||||||
^^^^^^^^^^^^^^^^ Separate `Utils.popen_read` commands into `\"\#{bin}/foo\", \"bar\"`
|
^^^^^^^^^^^^^^^^ Separate `Utils.popen_read` commands into `"\#{bin}/foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -198,7 +198,7 @@ module RuboCop
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
def install
|
def install
|
||||||
Utils.popen_read({ "SHELL" => "bash"}, "foo bar")
|
Utils.popen_read({ "SHELL" => "bash"}, "foo bar")
|
||||||
^^^^^^^^^ Separate `Utils.popen_read` commands into `\"foo\", \"bar\"`
|
^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -222,7 +222,7 @@ module RuboCop
|
|||||||
expect_offense(<<~RUBY)
|
expect_offense(<<~RUBY)
|
||||||
fork do
|
fork do
|
||||||
exec "foo bar > output"
|
exec "foo bar > output"
|
||||||
^^^^^^^^^^^^^^^^^^ Don\'t use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`.
|
^^^^^^^^^^^^^^^^^^ Don't use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`.
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
desc "foo"
|
desc "foo"
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
FileUtils.mv "hello"
|
FileUtils.mv "hello"
|
||||||
^^^^^^^^^^^^^^^^^^^^ Don\'t need \'FileUtils.\' before mv
|
^^^^^^^^^^^^^^^^^^^^ Don't need 'FileUtils.' before mv
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
desc "foo"
|
desc "foo"
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
inreplace "foo" do |longvar|
|
inreplace "foo" do |longvar|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \"inreplace <filenames> do |s|\" is preferred over \"|longvar|\".
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "inreplace <filenames> do |s|" is preferred over "|longvar|".
|
||||||
somerandomCall(longvar)
|
somerandomCall(longvar)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -275,7 +275,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
def install
|
def install
|
||||||
ENV["COMPILER_PATH"] = "/usr/bin/gcc"
|
ENV["COMPILER_PATH"] = "/usr/bin/gcc"
|
||||||
^^^^^^^^^^^^^^ Use \"\#{ENV.cc}\" instead of hard-coding \"gcc\"
|
^^^^^^^^^^^^^^ Use "\#{ENV.cc}" instead of hard-coding "gcc"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -339,7 +339,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
desc "foo"
|
desc "foo"
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
depends_on "lpeg" => :lua51
|
depends_on "lpeg" => :lua51
|
||||||
^^^^^^ lua modules should be vendored rather than use deprecated `depends_on \"lpeg\" => :lua51`
|
^^^^^^ lua modules should be vendored rather than use deprecated `depends_on "lpeg" => :lua51`
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -413,7 +413,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
desc "foo"
|
desc "foo"
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
needs :openmp
|
needs :openmp
|
||||||
^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on \"gcc\"'
|
^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on "gcc"'
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|||||||
@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
|
|||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
def post_install
|
def post_install
|
||||||
return if build.without? "--without-bar"
|
return if build.without? "--without-bar"
|
||||||
^^^^^^^^^^^^^^^ Don't duplicate 'without': Use `build.without? \"bar\"` to check for \"--without-bar\"
|
^^^^^^^^^^^^^^^ Don't duplicate 'without': Use `build.without? "bar"` to check for "--without-bar"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
|
|||||||
url 'https://brew.sh/foo-1.0.tgz'
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
def post_install
|
def post_install
|
||||||
return if build.with? "--with-bar"
|
return if build.with? "--with-bar"
|
||||||
^^^^^^^^^^^^ Don't duplicate 'with': Use `build.with? \"bar\"` to check for \"--with-bar\"
|
^^^^^^^^^^^^ Don't duplicate 'with': Use `build.with? "bar"` to check for "--with-bar"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|||||||
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
|
|||||||
|
|
||||||
def install
|
def install
|
||||||
system "xcodebuild", "foo", "bar"
|
system "xcodebuild", "foo", "bar"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use \"xcodebuild *args\" instead of \"system 'xcodebuild', *args\"
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -107,7 +107,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
|
|||||||
|
|
||||||
def install
|
def install
|
||||||
system "xcodebuild", "foo", "bar"
|
system "xcodebuild", "foo", "bar"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use \"xcodebuild *args\" instead of \"system 'xcodebuild', *args\"
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args"
|
||||||
end
|
end
|
||||||
|
|
||||||
def plist
|
def plist
|
||||||
@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
|
|||||||
|
|
||||||
def install
|
def install
|
||||||
Formula.factory(name)
|
Formula.factory(name)
|
||||||
^^^^^^^^^^^^^^^^^^^^^ \"Formula.factory(name)\" is deprecated in favor of \"Formula[name]\"
|
^^^^^^^^^^^^^^^^^^^^^ "Formula.factory(name)" is deprecated in favor of "Formula[name]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -166,7 +166,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
|
|||||||
|
|
||||||
def install
|
def install
|
||||||
system "dep", "ensure"
|
system "dep", "ensure"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^ use \"dep\", \"ensure\", \"-vendor-only\"
|
^^^^^^^^^^^^^^^^^^^^^^ use "dep", "ensure", "-vendor-only"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
@ -180,7 +180,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
|
|||||||
|
|
||||||
def install
|
def install
|
||||||
system "cargo", "build"
|
system "cargo", "build"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", *std_cargo_args
|
^^^^^^^^^^^^^^^^^^^^^^^ use "cargo", "install", *std_cargo_args
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|||||||
@ -592,8 +592,8 @@ describe Homebrew::Service do
|
|||||||
StandardInput=file:#{HOMEBREW_PREFIX}/var/in/beanstalkd
|
StandardInput=file:#{HOMEBREW_PREFIX}/var/in/beanstalkd
|
||||||
StandardOutput=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.log
|
StandardOutput=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.log
|
||||||
StandardError=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log
|
StandardError=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log
|
||||||
Environment=\"PATH=#{std_path}\"
|
Environment="PATH=#{std_path}"
|
||||||
Environment=\"FOO=BAR\"
|
Environment="FOO=BAR"
|
||||||
EOS
|
EOS
|
||||||
expect(unit).to eq(unit_expect.strip)
|
expect(unit).to eq(unit_expect.strip)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -36,7 +36,7 @@ RSpec.shared_context "Homebrew Cask", :needs_macos do # rubocop:disable RSpec/Co
|
|||||||
third_party_tap = Tap.fetch("third-party", "tap")
|
third_party_tap = Tap.fetch("third-party", "tap")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Cask::Config::DEFAULT_DIRS_PATHNAMES.values.each(&:mkpath)
|
Cask::Config::DEFAULT_DIRS_PATHNAMES.each_value(&:mkpath)
|
||||||
|
|
||||||
Tap.default_cask_tap.tap do |tap|
|
Tap.default_cask_tap.tap do |tap|
|
||||||
FileUtils.mkdir_p tap.path.dirname
|
FileUtils.mkdir_p tap.path.dirname
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
describe Tty do
|
describe Tty do
|
||||||
describe "::strip_ansi" do
|
describe "::strip_ansi" do
|
||||||
it "removes ANSI escape codes from a string" do
|
it "removes ANSI escape codes from a string" do
|
||||||
expect(described_class.strip_ansi("\033\[36;7mhello\033\[0m")).to eq("hello")
|
expect(described_class.strip_ansi("\033[36;7mhello\033[0m")).to eq("hello")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -535,7 +535,7 @@ module GitHub
|
|||||||
response = create_fork(tap_remote_repo, org: org)
|
response = create_fork(tap_remote_repo, org: org)
|
||||||
# GitHub API responds immediately but fork takes a few seconds to be ready.
|
# GitHub API responds immediately but fork takes a few seconds to be ready.
|
||||||
sleep 1 until check_fork_exists(tap_remote_repo, org: org)
|
sleep 1 until check_fork_exists(tap_remote_repo, org: org)
|
||||||
remote_url = if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
|
remote_url = if system("git", "config", "--local", "--get-regexp", "remote..*.url", "git@github.com:.*")
|
||||||
response.fetch("ssh_url")
|
response.fetch("ssh_url")
|
||||||
else
|
else
|
||||||
url = response.fetch("clone_url")
|
url = response.fetch("clone_url")
|
||||||
|
|||||||
@ -185,7 +185,10 @@ module GitHub
|
|||||||
# This is a no-op if the user is opting out of using the GitHub API.
|
# This is a no-op if the user is opting out of using the GitHub API.
|
||||||
return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api?
|
return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api?
|
||||||
|
|
||||||
args = ["--header", "Accept: application/vnd.github+json", "--write-out", "\n%\{http_code}"]
|
# This is a Curl format token, not a Ruby one.
|
||||||
|
# rubocop:disable Style/FormatStringToken
|
||||||
|
args = ["--header", "Accept: application/vnd.github+json", "--write-out", "\n%{http_code}"]
|
||||||
|
# rubocop:enable Style/FormatStringToken
|
||||||
|
|
||||||
token = credentials
|
token = credentials
|
||||||
args += ["--header", "Authorization: token #{token}"] unless credentials_type == :none
|
args += ["--header", "Authorization: token #{token}"] unless credentials_type == :none
|
||||||
|
|||||||
@ -220,9 +220,9 @@ module PyPI
|
|||||||
pipgrip_output = Utils.popen_read(*command)
|
pipgrip_output = Utils.popen_read(*command)
|
||||||
unless $CHILD_STATUS.success?
|
unless $CHILD_STATUS.success?
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
Unable to determine dependencies for \"#{input_packages.join(" ")}\" because of a failure when running
|
Unable to determine dependencies for "#{input_packages.join(" ")}" because of a failure when running
|
||||||
`#{command.join(" ")}`.
|
`#{command.join(" ")}`.
|
||||||
Please update the resources for \"#{formula.name}\" manually.
|
Please update the resources for "#{formula.name}" manually.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -242,8 +242,8 @@ module PyPI
|
|||||||
odie "Unable to resolve some dependencies. Please update the resources for \"#{formula.name}\" manually."
|
odie "Unable to resolve some dependencies. Please update the resources for \"#{formula.name}\" manually."
|
||||||
elsif url.blank? || checksum.blank?
|
elsif url.blank? || checksum.blank?
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
Unable to find the URL and/or sha256 for the \"#{name}\" resource.
|
Unable to find the URL and/or sha256 for the "#{name}" resource.
|
||||||
Please update the resources for \"#{formula.name}\" manually.
|
Please update the resources for "#{formula.name}" manually.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.12.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-core-3.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-core-3.12.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-expectations-3.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-expectations-3.12.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-mocks-3.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-mocks-3.12.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.12.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.12.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-github-2.4.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-github-2.4.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-its-1.3.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-its-1.3.0/lib")
|
||||||
@ -104,10 +104,10 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.24.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.24.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.11.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.11.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.35.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.40.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.16.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.12.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.12.3/lib")
|
||||||
|
|||||||
@ -147,13 +147,17 @@ RSpec/Be:
|
|||||||
RSpec/BeEq:
|
RSpec/BeEq:
|
||||||
Description: Check for expectations where `be(...)` can replace `eq(...)`.
|
Description: Check for expectations where `be(...)` can replace `eq(...)`.
|
||||||
Enabled: pending
|
Enabled: pending
|
||||||
|
Safe: false
|
||||||
VersionAdded: 2.9.0
|
VersionAdded: 2.9.0
|
||||||
|
VersionChanged: '2.16'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
|
||||||
|
|
||||||
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
|
||||||
|
Safe: false
|
||||||
VersionAdded: '1.7'
|
VersionAdded: '1.7'
|
||||||
|
VersionChanged: '2.16'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
||||||
|
|
||||||
RSpec/BeNil:
|
RSpec/BeNil:
|
||||||
@ -284,6 +288,12 @@ RSpec/Dialect:
|
|||||||
VersionAdded: '1.33'
|
VersionAdded: '1.33'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
||||||
|
|
||||||
|
RSpec/DuplicatedMetadata:
|
||||||
|
Description: Avoid duplicated metadata.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.16'
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
|
||||||
|
|
||||||
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
|
||||||
@ -356,12 +366,6 @@ RSpec/ExampleWithoutDescription:
|
|||||||
VersionAdded: '1.22'
|
VersionAdded: '1.22'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
Reference: 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'
|
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
|
||||||
|
|
||||||
RSpec/ExampleWording:
|
RSpec/ExampleWording:
|
||||||
Description: Checks for common mistakes in example descriptions.
|
Description: Checks for common mistakes in example descriptions.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -378,6 +382,12 @@ RSpec/ExampleWording:
|
|||||||
StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
|
StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
||||||
|
|
||||||
|
RSpec/ExcessiveDocstringSpacing:
|
||||||
|
Description: Checks for excessive whitespace in example descriptions.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.5'
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
||||||
|
|
||||||
RSpec/ExpectActual:
|
RSpec/ExpectActual:
|
||||||
Description: Checks for `expect(...)` calls containing literal values.
|
Description: Checks for `expect(...)` calls containing literal values.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -664,6 +674,12 @@ RSpec/Pending:
|
|||||||
VersionAdded: '1.25'
|
VersionAdded: '1.25'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
||||||
|
|
||||||
|
RSpec/PendingWithoutReason:
|
||||||
|
Description: Checks for pending or skipped examples without reason.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.16'
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
|
||||||
|
|
||||||
RSpec/PredicateMatcher:
|
RSpec/PredicateMatcher:
|
||||||
Description: Prefer using predicate matcher over using predicate method directly.
|
Description: Prefer using predicate matcher over using predicate method directly.
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -960,6 +976,16 @@ RSpec/FactoryBot/FactoryClassName:
|
|||||||
VersionChanged: '2.0'
|
VersionChanged: '2.0'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
||||||
|
|
||||||
|
RSpec/FactoryBot/FactoryNameStyle:
|
||||||
|
Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.16'
|
||||||
|
EnforcedStyle: symbol
|
||||||
|
SupportedStyles:
|
||||||
|
- symbol
|
||||||
|
- string
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle
|
||||||
|
|
||||||
RSpec/FactoryBot/SyntaxMethods:
|
RSpec/FactoryBot/SyntaxMethods:
|
||||||
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
|
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
|
||||||
Enabled: pending
|
Enabled: pending
|
||||||
@ -985,6 +1011,17 @@ RSpec/Rails/HaveHttpStatus:
|
|||||||
VersionAdded: '2.12'
|
VersionAdded: '2.12'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
|
||||||
|
|
||||||
|
RSpec/Rails/HttpStatus:
|
||||||
|
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: symbolic
|
||||||
|
SupportedStyles:
|
||||||
|
- numeric
|
||||||
|
- symbolic
|
||||||
|
VersionAdded: '1.23'
|
||||||
|
VersionChanged: '2.0'
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
||||||
|
|
||||||
RSpec/Rails/InferredSpecType:
|
RSpec/Rails/InferredSpecType:
|
||||||
Description: Identifies redundant spec type.
|
Description: Identifies redundant spec type.
|
||||||
Enabled: pending
|
Enabled: pending
|
||||||
@ -1007,14 +1044,3 @@ RSpec/Rails/InferredSpecType:
|
|||||||
routing: routing
|
routing: routing
|
||||||
system: system
|
system: system
|
||||||
views: view
|
views: view
|
||||||
|
|
||||||
RSpec/Rails/HttpStatus:
|
|
||||||
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
|
||||||
Enabled: true
|
|
||||||
EnforcedStyle: symbolic
|
|
||||||
SupportedStyles:
|
|
||||||
- numeric
|
|
||||||
- symbolic
|
|
||||||
VersionAdded: '1.23'
|
|
||||||
VersionChanged: '2.0'
|
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
|
||||||
@ -6,34 +6,39 @@ require 'yaml'
|
|||||||
require 'rubocop'
|
require 'rubocop'
|
||||||
|
|
||||||
require_relative 'rubocop/rspec'
|
require_relative 'rubocop/rspec'
|
||||||
require_relative 'rubocop/rspec/version'
|
|
||||||
require_relative 'rubocop/rspec/inject'
|
require_relative 'rubocop/rspec/inject'
|
||||||
require_relative 'rubocop/rspec/node'
|
|
||||||
require_relative 'rubocop/rspec/wording'
|
|
||||||
require_relative 'rubocop/rspec/language/node_pattern'
|
require_relative 'rubocop/rspec/language/node_pattern'
|
||||||
|
require_relative 'rubocop/rspec/node'
|
||||||
|
require_relative 'rubocop/rspec/version'
|
||||||
|
require_relative 'rubocop/rspec/wording'
|
||||||
|
|
||||||
|
# Dependent on `RuboCop::RSpec::Language::NodePattern`.
|
||||||
require_relative 'rubocop/rspec/language'
|
require_relative 'rubocop/rspec/language'
|
||||||
|
|
||||||
require_relative 'rubocop/rspec/factory_bot/language'
|
require_relative 'rubocop/rspec/factory_bot/language'
|
||||||
|
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/capybara_help'
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/css_selector'
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/metadata'
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/namespace'
|
||||||
|
require_relative 'rubocop/cop/rspec/mixin/skip_or_pending'
|
||||||
require_relative 'rubocop/cop/rspec/mixin/top_level_group'
|
require_relative 'rubocop/cop/rspec/mixin/top_level_group'
|
||||||
require_relative 'rubocop/cop/rspec/mixin/variable'
|
require_relative 'rubocop/cop/rspec/mixin/variable'
|
||||||
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
|
||||||
|
# Dependent on `RuboCop::Cop::RSpec::FinalEndLocation`.
|
||||||
require_relative 'rubocop/cop/rspec/mixin/comments_help'
|
require_relative 'rubocop/cop/rspec/mixin/comments_help'
|
||||||
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
|
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
|
||||||
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
|
|
||||||
require_relative 'rubocop/cop/rspec/mixin/namespace'
|
|
||||||
require_relative 'rubocop/cop/rspec/mixin/css_selector'
|
|
||||||
require_relative 'rubocop/cop/rspec/mixin/skip_or_pending'
|
|
||||||
require_relative 'rubocop/cop/rspec/mixin/capybara_help'
|
|
||||||
|
|
||||||
require_relative 'rubocop/rspec/concept'
|
|
||||||
require_relative 'rubocop/rspec/example_group'
|
|
||||||
require_relative 'rubocop/rspec/example'
|
|
||||||
require_relative 'rubocop/rspec/hook'
|
|
||||||
require_relative 'rubocop/cop/rspec/base'
|
require_relative 'rubocop/cop/rspec/base'
|
||||||
require_relative 'rubocop/rspec/align_let_brace'
|
require_relative 'rubocop/rspec/align_let_brace'
|
||||||
require_relative 'rubocop/rspec/factory_bot'
|
require_relative 'rubocop/rspec/concept'
|
||||||
require_relative 'rubocop/rspec/corrector/move_node'
|
require_relative 'rubocop/rspec/corrector/move_node'
|
||||||
|
require_relative 'rubocop/rspec/example'
|
||||||
|
require_relative 'rubocop/rspec/example_group'
|
||||||
|
require_relative 'rubocop/rspec/factory_bot'
|
||||||
|
require_relative 'rubocop/rspec/hook'
|
||||||
|
|
||||||
RuboCop::RSpec::Inject.defaults!
|
RuboCop::RSpec::Inject.defaults!
|
||||||
|
|
||||||
@ -21,6 +21,8 @@ module RuboCop
|
|||||||
class Be < Base
|
class Be < Base
|
||||||
MSG = "Don't use `be` without an argument."
|
MSG = "Don't use `be` without an argument."
|
||||||
|
|
||||||
|
RESTRICT_ON_SEND = Runners.all
|
||||||
|
|
||||||
# @!method be_without_args(node)
|
# @!method be_without_args(node)
|
||||||
def_node_matcher :be_without_args, <<-PATTERN
|
def_node_matcher :be_without_args, <<-PATTERN
|
||||||
(send _ #Runners.all $(send nil? :be))
|
(send _ #Runners.all $(send nil? :be))
|
||||||
@ -9,6 +9,9 @@ module RuboCop
|
|||||||
# using `==`. Booleans and nil can be compared by identity and therefore
|
# using `==`. Booleans and nil can be compared by identity and therefore
|
||||||
# the `be` matcher is preferable as it is a more strict test.
|
# the `be` matcher is preferable as it is a more strict test.
|
||||||
#
|
#
|
||||||
|
# @safety
|
||||||
|
# This cop is unsafe because it changes how values are compared.
|
||||||
|
#
|
||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# expect(foo).to eq(true)
|
# expect(foo).to eq(true)
|
||||||
@ -10,6 +10,9 @@ module RuboCop
|
|||||||
# can be compared by identity and therefore the `be` matcher is
|
# can be compared by identity and therefore the `be` matcher is
|
||||||
# preferable as it is a more strict test.
|
# preferable as it is a more strict test.
|
||||||
#
|
#
|
||||||
|
# @safety
|
||||||
|
# This cop is unsafe because it changes how values are compared.
|
||||||
|
#
|
||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# expect(foo).to eql(1)
|
# expect(foo).to eql(1)
|
||||||
@ -29,7 +29,7 @@ module RuboCop
|
|||||||
# # good
|
# # good
|
||||||
# expect(page).to have_current_path('/callback')
|
# expect(page).to have_current_path('/callback')
|
||||||
#
|
#
|
||||||
class CurrentPathExpectation < Base
|
class CurrentPathExpectation < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
|
|
||||||
MSG = 'Do not set an RSpec expectation on `current_path` in ' \
|
MSG = 'Do not set an RSpec expectation on `current_path` in ' \
|
||||||
@ -47,14 +47,14 @@ module RuboCop
|
|||||||
# @!method as_is_matcher(node)
|
# @!method as_is_matcher(node)
|
||||||
def_node_matcher :as_is_matcher, <<-PATTERN
|
def_node_matcher :as_is_matcher, <<-PATTERN
|
||||||
(send
|
(send
|
||||||
#expectation_set_on_current_path $#Runners.all
|
#expectation_set_on_current_path ${:to :to_not :not_to}
|
||||||
${(send nil? :eq ...) (send nil? :match (regexp ...))})
|
${(send nil? :eq ...) (send nil? :match (regexp ...))})
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
# @!method regexp_str_matcher(node)
|
# @!method regexp_str_matcher(node)
|
||||||
def_node_matcher :regexp_str_matcher, <<-PATTERN
|
def_node_matcher :regexp_str_matcher, <<-PATTERN
|
||||||
(send
|
(send
|
||||||
#expectation_set_on_current_path $#Runners.all
|
#expectation_set_on_current_path ${:to :to_not :not_to}
|
||||||
$(send nil? :match (str $_)))
|
$(send nil? :match (str $_)))
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ module RuboCop
|
|||||||
# expect(page).to have_no_selector
|
# expect(page).to have_no_selector
|
||||||
# expect(page).to have_no_css('a')
|
# expect(page).to have_no_css('a')
|
||||||
#
|
#
|
||||||
class NegationMatcher < Base
|
class NegationMatcher < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
include ConfigurableEnforcedStyle
|
include ConfigurableEnforcedStyle
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ module RuboCop
|
|||||||
# click_link(exact_text: 'foo')
|
# click_link(exact_text: 'foo')
|
||||||
# find('div').click_button
|
# find('div').click_button
|
||||||
#
|
#
|
||||||
class SpecificActions < Base
|
class SpecificActions < ::RuboCop::Cop::Base
|
||||||
MSG = "Prefer `%<good_action>s` over `find('%<selector>s').click`."
|
MSG = "Prefer `%<good_action>s` over `find('%<selector>s').click`."
|
||||||
RESTRICT_ON_SEND = %i[click].freeze
|
RESTRICT_ON_SEND = %i[click].freeze
|
||||||
SPECIFIC_ACTION = {
|
SPECIFIC_ACTION = {
|
||||||
@ -15,7 +15,7 @@ module RuboCop
|
|||||||
# find_by_id('some-id')
|
# find_by_id('some-id')
|
||||||
# find_by_id('some-id', visible: true)
|
# find_by_id('some-id', visible: true)
|
||||||
#
|
#
|
||||||
class SpecificFinders < Base
|
class SpecificFinders < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
|
|
||||||
include RangeHelp
|
include RangeHelp
|
||||||
@ -26,9 +26,7 @@ module RuboCop
|
|||||||
# expect(page).to have_select
|
# expect(page).to have_select
|
||||||
# expect(page).to have_field('foo')
|
# expect(page).to have_field('foo')
|
||||||
#
|
#
|
||||||
class SpecificMatcher < Base
|
class SpecificMatcher < ::RuboCop::Cop::Base
|
||||||
include CapybaraHelp
|
|
||||||
|
|
||||||
MSG = 'Prefer `%<good_matcher>s` over `%<bad_matcher>s`.'
|
MSG = 'Prefer `%<good_matcher>s` over `%<bad_matcher>s`.'
|
||||||
RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css
|
RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css
|
||||||
have_no_css].freeze
|
have_no_css].freeze
|
||||||
@ -49,8 +47,8 @@ module RuboCop
|
|||||||
first_argument(node) do |arg|
|
first_argument(node) do |arg|
|
||||||
next unless (matcher = specific_matcher(arg))
|
next unless (matcher = specific_matcher(arg))
|
||||||
next if CssSelector.multiple_selectors?(arg)
|
next if CssSelector.multiple_selectors?(arg)
|
||||||
next unless specific_option?(node, arg, matcher)
|
next unless CapybaraHelp.specific_option?(node, arg, matcher)
|
||||||
next unless specific_pseudo_classes?(arg)
|
next unless CapybaraHelp.specific_pseudo_classes?(arg)
|
||||||
|
|
||||||
add_offense(node, message: message(node, matcher))
|
add_offense(node, message: message(node, matcher))
|
||||||
end
|
end
|
||||||
@ -26,7 +26,7 @@ module RuboCop
|
|||||||
# expect(page).to have_css('.foo', visible: :all)
|
# expect(page).to have_css('.foo', visible: :all)
|
||||||
# expect(page).to have_link('my link', visible: :hidden)
|
# expect(page).to have_link('my link', visible: :hidden)
|
||||||
#
|
#
|
||||||
class VisibilityMatcher < Base
|
class VisibilityMatcher < ::RuboCop::Cop::Base
|
||||||
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 = %w[
|
CAPYBARA_MATCHER_METHODS = %w[
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module RSpec
|
||||||
|
# Avoid duplicated metadata.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
# # bad
|
||||||
|
# describe 'Something', :a, :a
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# describe 'Something', :a
|
||||||
|
class DuplicatedMetadata < Base
|
||||||
|
extend AutoCorrector
|
||||||
|
|
||||||
|
include Metadata
|
||||||
|
include RangeHelp
|
||||||
|
|
||||||
|
MSG = 'Avoid duplicated metadata.'
|
||||||
|
|
||||||
|
def on_metadata(symbols, _pairs)
|
||||||
|
symbols.each do |symbol|
|
||||||
|
on_metadata_symbol(symbol)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def on_metadata_symbol(node)
|
||||||
|
return unless duplicated?(node)
|
||||||
|
|
||||||
|
add_offense(node) do |corrector|
|
||||||
|
autocorrect(corrector, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def autocorrect(corrector, node)
|
||||||
|
corrector.remove(
|
||||||
|
range_with_surrounding_comma(
|
||||||
|
range_with_surrounding_space(
|
||||||
|
node.location.expression,
|
||||||
|
side: :left
|
||||||
|
),
|
||||||
|
:left
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def duplicated?(node)
|
||||||
|
node.left_siblings.any? do |sibling|
|
||||||
|
sibling.eql?(node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -55,6 +55,8 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def allowed_one_liner?(node)
|
def allowed_one_liner?(node)
|
||||||
consecutive_one_liner?(node) && allow_consecutive_one_liners?
|
consecutive_one_liner?(node) && allow_consecutive_one_liners?
|
||||||
end
|
end
|
||||||
@ -26,6 +26,8 @@ module RuboCop
|
|||||||
|
|
||||||
MSG = 'Provide the actual you are testing to `expect(...)`.'
|
MSG = 'Provide the actual you are testing to `expect(...)`.'
|
||||||
|
|
||||||
|
RESTRICT_ON_SEND = Runners.all
|
||||||
|
|
||||||
SIMPLE_LITERALS = %i[
|
SIMPLE_LITERALS = %i[
|
||||||
true
|
true
|
||||||
false
|
false
|
||||||
@ -25,7 +25,7 @@ module RuboCop
|
|||||||
# # good
|
# # good
|
||||||
# count { 1 }
|
# count { 1 }
|
||||||
#
|
#
|
||||||
class AttributeDefinedStatically < Base
|
class AttributeDefinedStatically < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
|
|
||||||
MSG = 'Use a block to declare attribute values.'
|
MSG = 'Use a block to declare attribute values.'
|
||||||
@ -40,7 +40,7 @@ module RuboCop
|
|||||||
# name: 'foo'
|
# name: 'foo'
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
class ConsistentParenthesesStyle < Base
|
class ConsistentParenthesesStyle < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
include ConfigurableEnforcedStyle
|
include ConfigurableEnforcedStyle
|
||||||
include RuboCop::RSpec::FactoryBot::Language
|
include RuboCop::RSpec::FactoryBot::Language
|
||||||
@ -69,6 +69,8 @@ module RuboCop
|
|||||||
return if ambiguous_without_parentheses?(node)
|
return if ambiguous_without_parentheses?(node)
|
||||||
|
|
||||||
factory_call(node) do
|
factory_call(node) do
|
||||||
|
return if node.method?(:generate) && node.arguments.count > 1
|
||||||
|
|
||||||
if node.parenthesized?
|
if node.parenthesized?
|
||||||
process_with_parentheses(node)
|
process_with_parentheses(node)
|
||||||
else
|
else
|
||||||
@ -77,6 +79,8 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def process_with_parentheses(node)
|
def process_with_parentheses(node)
|
||||||
return unless style == :omit_parentheses
|
return unless style == :omit_parentheses
|
||||||
return unless same_line?(node, node.first_argument)
|
return unless same_line?(node, node.first_argument)
|
||||||
@ -102,8 +106,6 @@ module RuboCop
|
|||||||
node.parent&.array_type?
|
node.parent&.array_type?
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def remove_parentheses(corrector, node)
|
def remove_parentheses(corrector, node)
|
||||||
corrector.replace(node.location.begin, ' ')
|
corrector.replace(node.location.begin, ' ')
|
||||||
corrector.remove(node.location.end)
|
corrector.remove(node.location.end)
|
||||||
@ -31,7 +31,7 @@ module RuboCop
|
|||||||
# # good
|
# # good
|
||||||
# 3.times { create :user }
|
# 3.times { create :user }
|
||||||
#
|
#
|
||||||
class CreateList < Base
|
class CreateList < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
include ConfigurableEnforcedStyle
|
include ConfigurableEnforcedStyle
|
||||||
include RuboCop::RSpec::FactoryBot::Language
|
include RuboCop::RSpec::FactoryBot::Language
|
||||||
@ -143,7 +143,7 @@ module RuboCop
|
|||||||
|
|
||||||
def call(corrector)
|
def call(corrector)
|
||||||
replacement = generate_n_times_block(node)
|
replacement = generate_n_times_block(node)
|
||||||
corrector.replace(node, replacement)
|
corrector.replace(node.block_node || node, replacement)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -159,8 +159,15 @@ module RuboCop
|
|||||||
|
|
||||||
replacement = format_receiver(node.receiver)
|
replacement = format_receiver(node.receiver)
|
||||||
replacement += format_method_call(node, 'create', arguments)
|
replacement += format_method_call(node, 'create', arguments)
|
||||||
|
replacement += " #{factory_call_block_source}" if node.block_node
|
||||||
"#{count.source}.times { #{replacement} }"
|
"#{count.source}.times { #{replacement} }"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def factory_call_block_source
|
||||||
|
node.block_node.location.begin.with(
|
||||||
|
end_pos: node.block_node.location.end.end_pos
|
||||||
|
).source
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
@ -20,7 +20,7 @@ module RuboCop
|
|||||||
# factory :foo, class: 'Foo' do
|
# factory :foo, class: 'Foo' do
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
class FactoryClassName < Base
|
class FactoryClassName < ::RuboCop::Cop::Base
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
|
|
||||||
MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \
|
MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module RSpec
|
||||||
|
module FactoryBot
|
||||||
|
# Checks for name style for argument of FactoryBot::Syntax::Methods.
|
||||||
|
#
|
||||||
|
# @example EnforcedStyle: symbol (default)
|
||||||
|
# # bad
|
||||||
|
# create('user')
|
||||||
|
# build "user", username: "NAME"
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# create(:user)
|
||||||
|
# build :user, username: "NAME"
|
||||||
|
#
|
||||||
|
# @example EnforcedStyle: string
|
||||||
|
# # bad
|
||||||
|
# create(:user)
|
||||||
|
# build :user, username: "NAME"
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# create('user')
|
||||||
|
# build "user", username: "NAME"
|
||||||
|
#
|
||||||
|
class FactoryNameStyle < ::RuboCop::Cop::Base
|
||||||
|
extend AutoCorrector
|
||||||
|
include ConfigurableEnforcedStyle
|
||||||
|
include RuboCop::RSpec::FactoryBot::Language
|
||||||
|
|
||||||
|
MSG = 'Use %<prefer>s to refer to a factory.'
|
||||||
|
FACTORY_CALLS = RuboCop::RSpec::FactoryBot::Language::METHODS
|
||||||
|
RESTRICT_ON_SEND = FACTORY_CALLS
|
||||||
|
|
||||||
|
# @!method factory_call(node)
|
||||||
|
def_node_matcher :factory_call, <<-PATTERN
|
||||||
|
(send
|
||||||
|
{#factory_bot? nil?} %FACTORY_CALLS
|
||||||
|
${str sym} ...
|
||||||
|
)
|
||||||
|
PATTERN
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
factory_call(node) do |name|
|
||||||
|
if offense_for_symbol_style?(name)
|
||||||
|
register_offense(name, name.value.to_sym.inspect)
|
||||||
|
elsif offense_for_string_style?(name)
|
||||||
|
register_offense(name, name.value.to_s.inspect)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def offense_for_symbol_style?(name)
|
||||||
|
name.str_type? && style == :symbol
|
||||||
|
end
|
||||||
|
|
||||||
|
def offense_for_string_style?(name)
|
||||||
|
name.sym_type? && style == :string
|
||||||
|
end
|
||||||
|
|
||||||
|
def register_offense(name, prefer)
|
||||||
|
add_offense(name,
|
||||||
|
message: format(MSG, prefer: style.to_s)) do |corrector|
|
||||||
|
corrector.replace(name, prefer)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
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