commit
10384231a2
@ -123,6 +123,14 @@ Style/Documentation:
|
|||||||
Style/Encoding:
|
Style/Encoding:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
# disabled until we get the Metrics/LineLength down to 80.
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# messes with existing plist/caveats style
|
||||||
|
Style/TrailingBodyOnMethodDefinition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# use spaces for indentation; detect tabs
|
# use spaces for indentation; detect tabs
|
||||||
Layout/Tab:
|
Layout/Tab:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -214,7 +222,7 @@ Style/FrozenStringLiteralComment:
|
|||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# generally rescuing StandardError is fine
|
# generally rescuing StandardError is fine
|
||||||
Lint/RescueWithoutErrorClass:
|
Style/RescueStandardError:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# implicitly allow EOS as we use it everywhere
|
# implicitly allow EOS as we use it everywhere
|
||||||
|
|||||||
@ -5,6 +5,7 @@ AllCops:
|
|||||||
Include:
|
Include:
|
||||||
- '**/.simplecov'
|
- '**/.simplecov'
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'bin/*'
|
||||||
- '**/Casks/**/*'
|
- '**/Casks/**/*'
|
||||||
- '**/vendor/**/*'
|
- '**/vendor/**/*'
|
||||||
|
|
||||||
@ -79,3 +80,7 @@ Style/GuardClause:
|
|||||||
# hash-rockets preferred for formulae, a: 1 preferred elsewhere
|
# hash-rockets preferred for formulae, a: 1 preferred elsewhere
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
EnforcedStyle: ruby19_no_mixed_keys
|
EnforcedStyle: ruby19_no_mixed_keys
|
||||||
|
|
||||||
|
# so many of these in formulae but none in here
|
||||||
|
Style/TrailingBodyOnMethodDefinition:
|
||||||
|
Enabled: true
|
||||||
|
|||||||
@ -70,7 +70,6 @@ module Homebrew
|
|||||||
def check_style_impl(files, output_type, options = {})
|
def check_style_impl(files, output_type, options = {})
|
||||||
fix = options[:fix]
|
fix = options[:fix]
|
||||||
|
|
||||||
Homebrew.install_gem_setup_path! "parser", HOMEBREW_RUBOCOP_PARSER_VERSION, "ruby-parse"
|
|
||||||
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
|
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
|
||||||
require "rubocop"
|
require "rubocop"
|
||||||
require_relative "../rubocops"
|
require_relative "../rubocops"
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# RuboCop version used for `brew style` and `brew cask style`
|
# RuboCop version used for `brew style` and `brew cask style`
|
||||||
HOMEBREW_RUBOCOP_VERSION = "0.51.0"
|
HOMEBREW_RUBOCOP_VERSION = "0.52.1"
|
||||||
HOMEBREW_RUBOCOP_PARSER_VERSION = "2.4.0.0" # for Ruby 2.3.3
|
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.16.0" # has to be updated when RuboCop version changes
|
||||||
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.15.1" # has to be updated when RuboCop version changes
|
|
||||||
|
|||||||
@ -165,11 +165,11 @@ class FormulaCreator
|
|||||||
path.write ERB.new(template, nil, ">").result(binding)
|
path.write ERB.new(template, nil, ">").result(binding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def template; <<~EOS
|
def template
|
||||||
|
<<~EOS
|
||||||
# Documentation: https://docs.brew.sh/Formula-Cookbook.html
|
# Documentation: https://docs.brew.sh/Formula-Cookbook.html
|
||||||
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
|
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
|
||||||
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
|
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
|
||||||
|
|
||||||
class #{Formulary.class_s(name)} < Formula
|
class #{Formulary.class_s(name)} < Formula
|
||||||
desc "#{desc}"
|
desc "#{desc}"
|
||||||
homepage "#{homepage}"
|
homepage "#{homepage}"
|
||||||
@ -182,7 +182,6 @@ class FormulaCreator
|
|||||||
<% end %>
|
<% end %>
|
||||||
sha256 "#{sha256}"
|
sha256 "#{sha256}"
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if mode == :cmake %>
|
<% if mode == :cmake %>
|
||||||
depends_on "cmake" => :build
|
depends_on "cmake" => :build
|
||||||
<% elsif mode == :meson %>
|
<% elsif mode == :meson %>
|
||||||
@ -191,10 +190,8 @@ class FormulaCreator
|
|||||||
<% elsif mode.nil? %>
|
<% elsif mode.nil? %>
|
||||||
# depends_on "cmake" => :build
|
# depends_on "cmake" => :build
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
def install
|
def install
|
||||||
# ENV.deparallelize # if your formula fails when building in parallel
|
# ENV.deparallelize # if your formula fails when building in parallel
|
||||||
|
|
||||||
<% if mode == :cmake %>
|
<% if mode == :cmake %>
|
||||||
system "cmake", ".", *std_cmake_args
|
system "cmake", ".", *std_cmake_args
|
||||||
<% elsif mode == :autotools %>
|
<% elsif mode == :autotools %>
|
||||||
@ -222,7 +219,6 @@ class FormulaCreator
|
|||||||
system "make", "install" # if this fails, try separate make/make install steps
|
system "make", "install" # if this fails, try separate make/make install steps
|
||||||
<% end %>
|
<% end %>
|
||||||
end
|
end
|
||||||
|
|
||||||
test do
|
test do
|
||||||
# `test do` will create, run in and delete a temporary directory.
|
# `test do` will create, run in and delete a temporary directory.
|
||||||
#
|
#
|
||||||
|
|||||||
@ -54,7 +54,8 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
class DirectoryNotWritableError < LinkError
|
class DirectoryNotWritableError < LinkError
|
||||||
def to_s; <<~EOS
|
def to_s
|
||||||
|
<<~EOS
|
||||||
Could not symlink #{src}
|
Could not symlink #{src}
|
||||||
#{dst.dirname} is not writable.
|
#{dst.dirname} is not writable.
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
@ -16,8 +16,6 @@ module RuboCop
|
|||||||
problem "Use rebuild instead of revision in bottle block" if method_called_in_block?(bottle, :revision)
|
problem "Use rebuild instead of revision in bottle block" if method_called_in_block?(bottle, :revision)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
lambda do |corrector|
|
lambda do |corrector|
|
||||||
correction = node.source.sub("revision", "rebuild")
|
correction = node.source.sub("revision", "rebuild")
|
||||||
|
|||||||
@ -50,8 +50,6 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
lambda do |corrector|
|
lambda do |corrector|
|
||||||
correction = node.source.downcase
|
correction = node.source.downcase
|
||||||
|
|||||||
@ -16,8 +16,6 @@ module RuboCop
|
|||||||
problem "#{parent_class} is deprecated, use Formula instead"
|
problem "#{parent_class} is deprecated, use Formula instead"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
lambda do |corrector|
|
lambda do |corrector|
|
||||||
corrector.replace(node.source_range, "Formula")
|
corrector.replace(node.source_range, "Formula")
|
||||||
|
|||||||
@ -62,8 +62,6 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Method to format message for reporting component precedence violations
|
# Method to format message for reporting component precedence violations
|
||||||
def component_problem(c1, c2)
|
def component_problem(c1, c2)
|
||||||
problem "`#{format_component(c1)}` (line #{line_number(c1)}) should be put before `#{format_component(c2)}` (line #{line_number(c2)})"
|
problem "`#{format_component(c1)}` (line #{line_number(c1)}) should be put before `#{format_component(c2)}` (line #{line_number(c2)})"
|
||||||
@ -99,7 +97,7 @@ module RuboCop
|
|||||||
line_breaks = (order_idx > 8) ? "\n\n" : "\n"
|
line_breaks = (order_idx > 8) ? "\n\n" : "\n"
|
||||||
corrector.insert_before(node2.source_range, node1.source + line_breaks + indentation)
|
corrector.insert_before(node2.source_range, node1.source + line_breaks + indentation)
|
||||||
end
|
end
|
||||||
corrector.remove(range_with_surrounding_space(node1.source_range, :left))
|
corrector.remove(range_with_surrounding_space(range: node1.source_range, side: :left))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns precedence index and component's index to properly reorder and group during autocorrect
|
# Returns precedence index and component's index to properly reorder and group during autocorrect
|
||||||
|
|||||||
@ -425,7 +425,7 @@ module RuboCop
|
|||||||
|
|
||||||
# Returns the block length of the block node
|
# Returns the block length of the block node
|
||||||
def block_size(block)
|
def block_size(block)
|
||||||
block_length(block)
|
block.loc.end.line - block.loc.begin.line
|
||||||
end
|
end
|
||||||
|
|
||||||
# Source buffer is required as an argument to report style violations
|
# Source buffer is required as an argument to report style violations
|
||||||
|
|||||||
@ -88,8 +88,6 @@ module RuboCop
|
|||||||
problem "Description shouldn't end with a full stop"
|
problem "Description shouldn't end with a full stop"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
lambda do |corrector|
|
lambda do |corrector|
|
||||||
correction = node.source
|
correction = node.source
|
||||||
|
|||||||
@ -206,8 +206,6 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
lambda do |corrector|
|
lambda do |corrector|
|
||||||
url_string_node = parameters(node).first
|
url_string_node = parameters(node).first
|
||||||
|
|||||||
@ -3,7 +3,6 @@ source "https://rubygems.org"
|
|||||||
require_relative "../constants"
|
require_relative "../constants"
|
||||||
|
|
||||||
gem "parallel_tests"
|
gem "parallel_tests"
|
||||||
gem "parser", HOMEBREW_RUBOCOP_PARSER_VERSION
|
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rspec-its", require: false
|
gem "rspec-its", require: false
|
||||||
gem "rspec-wait", require: false
|
gem "rspec-wait", require: false
|
||||||
|
|||||||
@ -12,12 +12,10 @@ GEM
|
|||||||
parallel (1.12.0)
|
parallel (1.12.0)
|
||||||
parallel_tests (2.17.0)
|
parallel_tests (2.17.0)
|
||||||
parallel
|
parallel
|
||||||
parser (2.4.0.0)
|
parser (2.4.0.2)
|
||||||
ast (~> 2.2)
|
ast (~> 2.3)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
rainbow (2.2.2)
|
rainbow (3.0.0)
|
||||||
rake
|
|
||||||
rake (12.1.0)
|
|
||||||
rspec (3.6.0)
|
rspec (3.6.0)
|
||||||
rspec-core (~> 3.6.0)
|
rspec-core (~> 3.6.0)
|
||||||
rspec-expectations (~> 3.6.0)
|
rspec-expectations (~> 3.6.0)
|
||||||
@ -36,11 +34,11 @@ GEM
|
|||||||
rspec-support (3.6.0)
|
rspec-support (3.6.0)
|
||||||
rspec-wait (0.0.9)
|
rspec-wait (0.0.9)
|
||||||
rspec (>= 3, < 4)
|
rspec (>= 3, < 4)
|
||||||
rubocop (0.51.0)
|
rubocop (0.52.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.3.3.1, < 3.0)
|
parser (>= 2.4.0.2, < 3.0)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 2.2.2, < 3.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
ruby-progressbar (1.9.0)
|
ruby-progressbar (1.9.0)
|
||||||
@ -58,11 +56,10 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
codecov
|
codecov
|
||||||
parallel_tests
|
parallel_tests
|
||||||
parser (= 2.4.0.0)
|
|
||||||
rspec
|
rspec
|
||||||
rspec-its
|
rspec-its
|
||||||
rspec-wait
|
rspec-wait
|
||||||
rubocop (= 0.51.0)
|
rubocop (= 0.52.1)
|
||||||
simplecov
|
simplecov
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
|||||||
@ -232,7 +232,8 @@ describe Hbc::DSL, :cask do
|
|||||||
expect(cask.caveats).to be_empty
|
expect(cask.caveats).to be_empty
|
||||||
|
|
||||||
cask = Hbc::Cask.new("cask-with-caveats") do
|
cask = Hbc::Cask.new("cask-with-caveats") do
|
||||||
def caveats; <<~EOS
|
def caveats
|
||||||
|
<<~EOS
|
||||||
When you install this Cask, you probably want to know this.
|
When you install this Cask, you probably want to know this.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|||||||
@ -28,7 +28,7 @@ describe "brew style" do
|
|||||||
rubocop_result = Homebrew.check_style_json([formula])
|
rubocop_result = Homebrew.check_style_json([formula])
|
||||||
|
|
||||||
expect(rubocop_result.file_offenses(formula.realpath.to_s).map(&:message))
|
expect(rubocop_result.file_offenses(formula.realpath.to_s).map(&:message))
|
||||||
.to include("Extra empty line detected at class body beginning.")
|
.to include("Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -19,7 +19,7 @@ module Test
|
|||||||
return super(block) unless @tty
|
return super(block) unless @tty
|
||||||
|
|
||||||
colored_tty_block = lambda do
|
colored_tty_block = lambda do
|
||||||
instance_eval("$#{@output}").extend(Module.new do
|
instance_eval("$#{@output}", __FILE__, __LINE__).extend(Module.new do
|
||||||
def tty?
|
def tty?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
@ -32,7 +32,7 @@ module Test
|
|||||||
return super(colored_tty_block) if @colors
|
return super(colored_tty_block) if @colors
|
||||||
|
|
||||||
uncolored_tty_block = lambda do
|
uncolored_tty_block = lambda do
|
||||||
instance_eval <<-EOS
|
instance_eval <<-EOS, __FILE__, __LINE__ + 1
|
||||||
begin
|
begin
|
||||||
captured_stream = StringIO.new
|
captured_stream = StringIO.new
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ 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 ENV["HOMEBREW_NO_GITHUB_API"]
|
return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"]
|
||||||
|
|
||||||
args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}]
|
args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}] # rubocop:disable Lint/NestedPercentLiteral
|
||||||
args += curl_args
|
args += curl_args
|
||||||
|
|
||||||
token, username = api_credentials
|
token, username = api_credentials
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user