aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/.rubocop.yml9
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb34
-rw-r--r--Library/Homebrew/dev-cmd/man.rb4
-rw-r--r--Library/Homebrew/manpages/brew.1.md.erb2
-rw-r--r--Library/Homebrew/rubocops.rb1
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb19
-rw-r--r--Library/Homebrew/rubocops/options_cop.rb58
-rw-r--r--Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb2
-rw-r--r--Library/Homebrew/test/rubocops/conflicts_cop_spec.rb6
-rw-r--r--Library/Homebrew/test/rubocops/options_cop_spec.rb132
-rw-r--r--Library/README.md3
-rw-r--r--README.md10
-rw-r--r--completions/README.md2
-rw-r--r--docs/Manpage.md4
-rw-r--r--manpages/README.md3
-rw-r--r--manpages/brew.15
16 files changed, 240 insertions, 54 deletions
diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml
index 6bfb669fd..596dae0c3 100644
--- a/Library/.rubocop.yml
+++ b/Library/.rubocop.yml
@@ -21,6 +21,15 @@ FormulaAudit/ChecksumCase:
FormulaAudit/Conflicts:
Enabled: true
+FormulaAudit/Options:
+ Enabled: true
+
+FormulaAuditStrict/Options:
+ Enabled: true
+
+NewFormulaAudit/Options:
+ Enabled: true
+
FormulaAuditStrict/BottleBlock:
Enabled: true
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 3bbfa461a..4bcfdd128 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -87,10 +87,14 @@ module Homebrew
if !only_cops.empty?
options[:only_cops] = only_cops
ARGV.push("--only=style")
+ elsif new_formula
+ options[:only_cops] = [:FormulaAudit, :FormulaAuditStrict, :NewFormulaAudit]
+ elsif strict
+ options[:only_cops] = [:FormulaAudit, :FormulaAuditStrict]
elsif !except_cops.empty?
options[:except_cops] = except_cops
elsif !strict
- options[:except_cops] = [:FormulaAuditStrict]
+ options[:except_cops] = [:FormulaAuditStrict, :NewFormulaAudit]
end
# Check style in a single batch run up front for performance
@@ -553,34 +557,6 @@ class FormulaAuditor
problem "keg_only reason should not end with a period."
end
- def audit_options
- formula.options.each do |o|
- if o.name == "32-bit"
- problem "macOS has been 64-bit only since 10.6 so 32-bit options are deprecated."
- end
-
- next unless @strict
-
- if o.name == "universal"
- problem "macOS has been 64-bit only since 10.6 so universal options are deprecated."
- end
-
- if o.name !~ /with(out)?-/ && o.name != "c++11" && o.name != "universal"
- problem "Options should begin with with/without. Migrate '--#{o.name}' with `deprecated_option`."
- end
-
- next unless o.name =~ /^with(out)?-(?:checks?|tests)$/
- unless formula.deps.any? { |d| d.name == "check" && (d.optional? || d.recommended?) }
- problem "Use '--with#{Regexp.last_match(1)}-test' instead of '--#{o.name}'. Migrate '--#{o.name}' with `deprecated_option`."
- end
- end
-
- return unless @new_formula
- return if formula.deprecated_options.empty?
- return if formula.versioned_formula?
- problem "New formulae should not use `deprecated_option`."
- end
-
def audit_homepage
homepage = formula.homepage
diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb
index 7ca22575f..472bb7c2b 100644
--- a/Library/Homebrew/dev-cmd/man.rb
+++ b/Library/Homebrew/dev-cmd/man.rb
@@ -65,7 +65,9 @@ module Homebrew
readme = HOMEBREW_REPOSITORY/"README.md"
variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
- variables[:maintainers] = readme.read[/(Homebrew's current maintainers .*\.)/, 1]
+ variables[:core_maintainer] = readme.read[%r{(Homebrew/homebrew-core's lead maintainer .*\.)}, 1]
+ .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
+ variables[:maintainers] = readme.read[/(Homebrew's other current maintainers .*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:former_maintainers] = readme.read[/(Former maintainers .*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb
index 0baa96755..589527d20 100644
--- a/Library/Homebrew/manpages/brew.1.md.erb
+++ b/Library/Homebrew/manpages/brew.1.md.erb
@@ -260,6 +260,8 @@ Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/>
<%= lead_maintainer.concat("\n") %>
+<%= core_maintainer.concat("\n") %>
+
<%= maintainers.concat("\n") %>
<%= former_maintainers.concat("\n") %>
diff --git a/Library/Homebrew/rubocops.rb b/Library/Homebrew/rubocops.rb
index 81ea2fcf2..f673720a6 100644
--- a/Library/Homebrew/rubocops.rb
+++ b/Library/Homebrew/rubocops.rb
@@ -8,3 +8,4 @@ require_relative "./rubocops/caveats_cop"
require_relative "./rubocops/checksum_cop"
require_relative "./rubocops/legacy_patches_cop"
require_relative "./rubocops/conflicts_cop"
+require_relative "./rubocops/options_cop"
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index ddfb507d2..7165ee354 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -102,14 +102,11 @@ module RuboCop
# Returns nil if does not depend on dependency_name
# args: node - dependency_name - dependency's name
- def depends_on?(dependency_name)
+ def depends_on?(dependency_name, *types)
+ types = [:required, :build, :optional, :recommended, :run] if types.empty?
dependency_nodes = find_every_method_call_by_name(@body, :depends_on)
idx = dependency_nodes.index do |n|
- depends_on_name_type?(n, dependency_name, :required) ||
- depends_on_name_type?(n, dependency_name, :build) ||
- depends_on_name_type?(n, dependency_name, :optional) ||
- depends_on_name_type?(n, dependency_name, :recommended) ||
- depends_on_name_type?(n, dependency_name, :run)
+ types.any? { |type| depends_on_name_type?(n, dependency_name, type) }
end
return if idx.nil?
@offense_source_range = dependency_nodes[idx].source_range
@@ -138,6 +135,8 @@ module RuboCop
if type_match && !name_match
name_match = node_equals?(node.method_args.first.keys.first.children.first, name)
end
+ else
+ type_match = false
end
if type_match || name_match
@@ -334,11 +333,13 @@ module RuboCop
def string_content(node)
case node.type
when :str
- return node.str_content if node.type == :str
+ node.str_content
when :dstr
- return node.each_child_node(:str).map(&:str_content).join("") if node.type == :dstr
+ node.each_child_node(:str).map(&:str_content).join("")
when :const
- return node.const_name if node.type == :const
+ node.const_name
+ when :sym
+ node.children.first.to_s
else
""
end
diff --git a/Library/Homebrew/rubocops/options_cop.rb b/Library/Homebrew/rubocops/options_cop.rb
new file mode 100644
index 000000000..c16244161
--- /dev/null
+++ b/Library/Homebrew/rubocops/options_cop.rb
@@ -0,0 +1,58 @@
+require_relative "./extend/formula_cop"
+
+module RuboCop
+ module Cop
+ module FormulaAudit
+ # This cop audits `options` in Formulae
+ class Options < FormulaCop
+ DEPRECATION_MSG = "macOS has been 64-bit only since 10.6 so 32-bit options are deprecated.".freeze
+
+ def audit_formula(_node, _class_node, _parent_class_node, body_node)
+ option_call_nodes = find_every_method_call_by_name(body_node, :option)
+ option_call_nodes.each do |option_call|
+ option = parameters(option_call).first
+ problem DEPRECATION_MSG if regex_match_group(option, /32-bit/)
+ end
+ end
+ end
+ end
+
+ module FormulaAuditStrict
+ class Options < FormulaCop
+ DEPRECATION_MSG = "macOS has been 64-bit only since 10.6 so universal options are deprecated.".freeze
+
+ def audit_formula(_node, _class_node, _parent_class_node, body_node)
+ option_call_nodes = find_every_method_call_by_name(body_node, :option)
+ option_call_nodes.each do |option_call|
+ offending_node(option_call)
+ option = string_content(parameters(option_call).first)
+ problem DEPRECATION_MSG if option == "universal"
+
+ if option !~ /with(out)?-/ &&
+ option != "cxx11" &&
+ option != "universal"
+ problem "Options should begin with with/without."\
+ " Migrate '--#{option}' with `deprecated_option`."
+ end
+
+ next unless option =~ /^with(out)?-(?:checks?|tests)$/
+ next if depends_on?("check", :optional, :recommended)
+ problem "Use '--with#{Regexp.last_match(1)}-test' instead of '--#{option}'."\
+ " Migrate '--#{option}' with `deprecated_option`."
+ end
+ end
+ end
+ end
+
+ module NewFormulaAudit
+ class Options < FormulaCop
+ MSG = "New Formula should not use `deprecated_option`".freeze
+
+ def audit_formula(_node, _class_node, _parent_class_node, body_node)
+ return if versioned_formula?
+ problem MSG if method_called_ever?(body_node, :deprecated_option)
+ end
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb
index a775b0b17..563f7ad4b 100644
--- a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb
@@ -18,7 +18,7 @@ describe RuboCop::Cop::FormulaAuditStrict::BottleBlock do
end
EOS
- expected_offenses = [{ message: "Use rebuild instead of revision in bottle block",
+ expected_offenses = [{ message: described_class::MSG,
severity: :convention,
line: 5,
column: 4,
diff --git a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb
index c3175509a..4fbab6c9e 100644
--- a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb
@@ -16,11 +16,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do
end
EOS
- msg = <<-EOS.undent
- Versioned formulae should not use `conflicts_with`.
- Use `keg_only :versioned_formula` instead.
- EOS
- expected_offenses = [{ message: msg,
+ expected_offenses = [{ message: described_class::MSG,
severity: :convention,
line: 3,
column: 2,
diff --git a/Library/Homebrew/test/rubocops/options_cop_spec.rb b/Library/Homebrew/test/rubocops/options_cop_spec.rb
new file mode 100644
index 000000000..b89b3d9b5
--- /dev/null
+++ b/Library/Homebrew/test/rubocops/options_cop_spec.rb
@@ -0,0 +1,132 @@
+require "rubocop"
+require "rubocop/rspec/support"
+require_relative "../../extend/string"
+require_relative "../../rubocops/options_cop"
+
+describe RuboCop::Cop::FormulaAudit::Options do
+ subject(:cop) { described_class.new }
+
+ context "When auditing options" do
+ it "32-bit" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url 'http://example.com/foo-1.0.tgz'
+ option "32-bit", "with 32-bit"
+ end
+ EOS
+
+ expected_offenses = [{ message: described_class::DEPRECATION_MSG,
+ severity: :convention,
+ line: 3,
+ column: 10,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+ end
+end
+
+describe RuboCop::Cop::FormulaAuditStrict::Options do
+ subject(:cop) { described_class.new }
+
+ context "When auditing options strictly" do
+ it "with universal" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url 'http://example.com/foo-1.0.tgz'
+ option :universal
+ end
+ EOS
+
+ expected_offenses = [{ message: described_class::DEPRECATION_MSG,
+ severity: :convention,
+ line: 3,
+ column: 2,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
+ it "with deprecated options" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url 'http://example.com/foo-1.0.tgz'
+ option :cxx11
+ option "examples", "with-examples"
+ end
+ EOS
+
+ MSG_1 = "Options should begin with with/without."\
+ " Migrate '--examples' with `deprecated_option`.".freeze
+ expected_offenses = [{ message: MSG_1,
+ severity: :convention,
+ line: 4,
+ column: 2,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
+ it "with misc deprecated options" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url 'http://example.com/foo-1.0.tgz'
+ option "without-check"
+ end
+ EOS
+
+ MSG_2 = "Use '--without-test' instead of '--without-check'."\
+ " Migrate '--without-check' with `deprecated_option`.".freeze
+ expected_offenses = [{ message: MSG_2,
+ severity: :convention,
+ line: 3,
+ column: 2,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+ end
+end
+
+describe RuboCop::Cop::NewFormulaAudit::Options do
+ subject(:cop) { described_class.new }
+
+ context "When auditing options for a new formula" do
+ it "with deprecated options" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url 'http://example.com/foo-1.0.tgz'
+ deprecated_option "examples" => "with-examples"
+ end
+ EOS
+
+ expected_offenses = [{ message: described_class::MSG,
+ severity: :convention,
+ line: 3,
+ column: 2,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+ end
+end
diff --git a/Library/README.md b/Library/README.md
new file mode 100644
index 000000000..1b3977172
--- /dev/null
+++ b/Library/README.md
@@ -0,0 +1,3 @@
+# Library
+
+This directory contains all the code run by the official `brew` and `brew cask` commands in `Homebrew` and all formulae (package descriptions) in taps (repositories containing formulae) in `Taps` subdirectories.
diff --git a/README.md b/README.md
index 629ddc196..97618e76c 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,6 @@
Features, usage and installation instructions are [summarised on the homepage](https://brew.sh). Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is [explained here](docs/Formula-Cookbook.md#homebrew-terminology).
-## Update Bug
-If Homebrew was updated on Aug 10-11th 2016 and `brew update` always says `Already up-to-date.` you need to run:
-```bash
-cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update
-```
-
## What Packages Are Available?
1. Type `brew search` for a list.
2. Or visit [braumeister.org](http://braumeister.org) to browse packages online.
@@ -40,7 +34,9 @@ Please report security issues to our [HackerOne](https://hackerone.com/homebrew/
## Who Are You?
Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid).
-Homebrew's current maintainers are [Alyssa Ross](https://github.com/alyssais), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [FX Coudert](https://github.com/fxcoudert), [ilovezfs](https://github.com/ilovezfs), [Josh Hagins](https://github.com/jawshooah), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Markus Reiter](https://github.com/reitermarkus), [Tim Smith](https://github.com/tdsmith), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky) and [William Woodruff](https://github.com/woodruffw).
+Homebrew/homebrew-core's lead maintainer is [ilovezfs](https://github.com/ilovezfs).
+
+Homebrew's other current maintainers are [Alyssa Ross](https://github.com/alyssais), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [FX Coudert](https://github.com/fxcoudert), [Josh Hagins](https://github.com/jawshooah), [JCount](https://github.com/jcount), [Misty De Meo](https://github.com/mistydemeo), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Markus Reiter](https://github.com/reitermarkus), [Tim Smith](https://github.com/tdsmith), [Tom Schoonjans](https://github.com/tschoonj), [Uladzislau Shablinski](https://github.com/vladshablinsky) and [William Woodruff](https://github.com/woodruffw).
Former maintainers with significant contributions include [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
diff --git a/completions/README.md b/completions/README.md
new file mode 100644
index 000000000..48cfa95c9
--- /dev/null
+++ b/completions/README.md
@@ -0,0 +1,2 @@
+# Completions
+This directory contains subdirectories for `brew`'s tab completions for `bash` and `zsh`.
diff --git a/docs/Manpage.md b/docs/Manpage.md
index 1ef465fe0..3a90c239a 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -1072,7 +1072,9 @@ Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/>
Homebrew's lead maintainer is Mike McQuaid.
-Homebrew's current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff.
+Homebrew/homebrew-core's lead maintainer is ilovezfs.
+
+Homebrew's other current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff.
Former maintainers with significant contributions include Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell.
diff --git a/manpages/README.md b/manpages/README.md
new file mode 100644
index 000000000..580342535
--- /dev/null
+++ b/manpages/README.md
@@ -0,0 +1,3 @@
+# Manual pages
+
+This directory contains the generated Homebrew man pages from the `brew man` command. This command creates the output from `#:` comments in files, sections extracted from the repository's `README.md` and `brew.1.md.erb`.
diff --git a/manpages/brew.1 b/manpages/brew.1
index 6713c6b7e..7341b3244 100644
--- a/manpages/brew.1
+++ b/manpages/brew.1
@@ -1117,7 +1117,10 @@ Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/\f
Homebrew\'s lead maintainer is Mike McQuaid\.
.
.P
-Homebrew\'s current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff\.
+Homebrew/homebrew\-core\'s lead maintainer is ilovezfs\.
+.
+.P
+Homebrew\'s other current maintainers are Alyssa Ross, Andrew Janke, Alex Dunn, FX Coudert, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff\.
.
.P
Former maintainers with significant contributions include Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg and Homebrew\'s creator: Max Howell\.