Fix brew style.
This commit is contained in:
parent
d2e22986cd
commit
fa760a2f26
@ -561,7 +561,7 @@ module Homebrew
|
||||
return if !Utils.git_available? || !(coretap_path/".git").exist?
|
||||
|
||||
branch = coretap_path.git_branch
|
||||
return if branch.nil? || branch =~ /master/
|
||||
return if branch.blank? || branch.include?("master")
|
||||
|
||||
<<~EOS
|
||||
#{CoreTap.instance.full_name} is not on the master branch.
|
||||
|
||||
@ -191,7 +191,8 @@ module Homebrew
|
||||
def check_xcode_license_approved
|
||||
# If the user installs Xcode-only, they have to approve the
|
||||
# license or no "xc*" tool will work.
|
||||
return unless `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$CHILD_STATUS.success?
|
||||
return unless `/usr/bin/xcrun clang 2>&1`.include?("license")
|
||||
return if $CHILD_STATUS.success?
|
||||
|
||||
<<~EOS
|
||||
You have not agreed to the Xcode license.
|
||||
|
||||
@ -268,7 +268,7 @@ module Language
|
||||
|
||||
t.stage { do_install Pathname.pwd }
|
||||
else
|
||||
t = t.lines.map(&:strip) if t.respond_to?(:lines) && t =~ /\n/
|
||||
t = t.lines.map(&:strip) if t.respond_to?(:lines) && t.include?("\n")
|
||||
do_install t
|
||||
end
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ class JavaRequirement < Requirement
|
||||
end
|
||||
|
||||
def exact_version?
|
||||
@version && @version.to_s.chars.last != "+"
|
||||
@version && @version.to_s[-1] != "+"
|
||||
end
|
||||
|
||||
def fits_latest?
|
||||
|
||||
@ -47,7 +47,7 @@ module RuboCop
|
||||
|
||||
# Check if command-line is wrongly used in formula's desc
|
||||
if match = regex_match_group(desc, /(command ?line)/i)
|
||||
c = match.to_s.chars.first
|
||||
c = match.to_s[0]
|
||||
problem "Description should use \"#{c}ommand-line\" instead of \"#{match}\""
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ module RuboCop
|
||||
correction = node.source
|
||||
first_word = string_content(node).split.first
|
||||
unless VALID_LOWERCASE_WORDS.include?(first_word)
|
||||
first_char = first_word.to_s.chars.first
|
||||
first_char = first_word.to_s[0]
|
||||
correction.sub!(/^(['"]?)([a-z])/, "\\1#{first_char.upcase}") if first_char
|
||||
end
|
||||
correction.sub!(/^(['"]?)an?\s/i, "\\1")
|
||||
|
||||
@ -37,7 +37,7 @@ module RuboCop
|
||||
# https://wiki.freedesktop.org/project_name.
|
||||
# "Software" is redirected to https://wiki.freedesktop.org/www/Software/project_name
|
||||
when %r{^http://((?:www|nice|libopenraw|liboil|telepathy|xorg)\.)?freedesktop\.org/(?:wiki/)?}
|
||||
if homepage =~ /Software/
|
||||
if homepage.include?("Software")
|
||||
problem "#{homepage} should be styled `https://wiki.freedesktop.org/www/Software/project_name`"
|
||||
else
|
||||
problem "#{homepage} should be styled `https://wiki.freedesktop.org/project_name`"
|
||||
|
||||
@ -247,7 +247,7 @@ module RuboCop
|
||||
# Don't use GitHub .zip files
|
||||
zip_gh_pattern = %r{https://.*github.*/(archive|releases)/.*\.zip$}
|
||||
audit_urls(urls, zip_gh_pattern) do |_, url|
|
||||
next if url.match?(%r{releases/download})
|
||||
next if url.include?("releases/download")
|
||||
|
||||
problem "Use GitHub tarballs rather than zipballs (url is #{url})."
|
||||
end
|
||||
|
||||
@ -73,8 +73,8 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
|
||||
RUBY
|
||||
|
||||
inspect_source(source)
|
||||
if homepage.match?(%r{http://www\.freedesktop\.org})
|
||||
if homepage.match?(/Software/)
|
||||
if homepage.include?("http://www.freedesktop.org")
|
||||
if homepage.include?("Software")
|
||||
expected_offenses = [{ message: "#{homepage} should be styled " \
|
||||
"`https://wiki.freedesktop.org/www/Software/project_name`",
|
||||
severity: :convention,
|
||||
@ -89,7 +89,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
|
||||
column: 2,
|
||||
source: source }]
|
||||
end
|
||||
elsif homepage.match?(%r{https://code\.google\.com})
|
||||
elsif homepage.include?("https://code.google.com")
|
||||
expected_offenses = [{ message: "#{homepage} should end with a slash",
|
||||
severity: :convention,
|
||||
line: 2,
|
||||
|
||||
@ -48,7 +48,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
|
||||
EOS
|
||||
|
||||
inspect_source(source)
|
||||
expected_offense = if patch_url.match?(%r{/raw\.github\.com/})
|
||||
expected_offense = if patch_url.include?("/raw.github.com/")
|
||||
[{ message:
|
||||
<<~EOS.chomp,
|
||||
GitHub/Gist patches should specify a revision:
|
||||
@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
|
||||
line: 5,
|
||||
column: 12,
|
||||
source: source }]
|
||||
elsif patch_url.match?(%r{macports/trunk})
|
||||
elsif patch_url.include?("macports/trunk")
|
||||
[{ message:
|
||||
<<~EOS.chomp,
|
||||
MacPorts patches should specify a revision instead of trunk:
|
||||
@ -232,7 +232,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
|
||||
RUBY
|
||||
|
||||
inspect_source(source)
|
||||
expected_offense = if patch_url.match?(%r{/raw\.github\.com/})
|
||||
expected_offense = if patch_url.include?("/raw.github.com/")
|
||||
[{ message:
|
||||
<<~EOS.chomp,
|
||||
GitHub/Gist patches should specify a revision:
|
||||
@ -242,7 +242,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
|
||||
line: 5,
|
||||
column: 16,
|
||||
source: source }]
|
||||
elsif patch_url.match?(%r{macports/trunk})
|
||||
elsif patch_url.include?("macports/trunk")
|
||||
[{ message:
|
||||
<<~EOS.chomp,
|
||||
MacPorts patches should specify a revision instead of trunk:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user