style: Fix style errors

This commit is contained in:
Gautham Goli 2018-10-02 19:54:22 +05:30
parent 604dfb4ae6
commit 7b0f27ca39
No known key found for this signature in database
GPG Key ID: 6A9ABBC284468364
12 changed files with 49 additions and 43 deletions

View File

@ -125,7 +125,7 @@ module Homebrew
end end
def global_option?(name) def global_option?(name)
Homebrew::CLI::Parser.global_options.has_key?(name.to_sym) Homebrew::CLI::Parser.global_options.key?(name.to_sym)
end end
private private

View File

@ -66,41 +66,43 @@ module Homebrew
specification, nor vice versa. It must use whichever style specification specification, nor vice versa. It must use whichever style specification
the preexisting formula already uses. the preexisting formula already uses.
EOS EOS
switch "--devel", switch "--devel",
description: "Bump the development rather than stable version. The development spec must already exist." description: "Bump the development rather than stable version. The development spec must already exist."
switch "-n", "--dry-run", switch "-n", "--dry-run",
description: "Print what would be done rather than doing it." description: "Print what would be done rather than doing it."
switch "--write", switch "--write",
description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\ description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\
"file modifications but not taking any git actions." "file modifications but not taking any git actions."
switch "--audit", switch "--audit",
description: "Run `brew audit` before opening the PR." description: "Run `brew audit` before opening the PR."
switch "--strict", switch "--strict",
description: "Run `brew audit --strict` before opening the PR." description: "Run `brew audit --strict` before opening the PR."
switch "--no-browse", switch "--no-browse",
description: "Output the pull request URL instead of opening in a browser" description: "Output the pull request URL instead of opening in a browser"
flag "--url=", flag "--url=",
description: "Provide new <URL> for the formula. If a <URL> is specified, the <sha-256> "\ description: "Provide new <URL> for the formula. If a <URL> is specified, the <sha-256> "\
"checksum of the new download must also be specified." "checksum of the new download must also be specified."
flag "--revision=", flag "--revision=",
description: "Specify the new git commit <revision> corresponding to a specified <tag>." description: "Specify the new git commit <revision> corresponding to a specified <tag>."
flag "--tag=", required_for: "--revision=", flag "--tag=",
required_for: "--revision=",
description: "Specify the new git commit <tag> for the formula." description: "Specify the new git commit <tag> for the formula."
flag "--sha256=", depends_on: "--url=", flag "--sha256=",
depends_on: "--url=",
description: "Specify the <sha-256> checksum of new download." description: "Specify the <sha-256> checksum of new download."
flag "--mirror=", flag "--mirror=",
description: "Use the provided <URL> as a mirror URL." description: "Use the provided <URL> as a mirror URL."
flag "--version=", flag "--version=",
description: "Use the provided <version> to override the value parsed from the URL or tag. Note "\ description: "Use the provided <version> to override the value parsed from the URL or tag. Note "\
"that `--version=0` can be used to delete an existing `version` override from a "\ "that `--version=0` can be used to delete an existing `version` override from a "\
"formula if it has become redundant." "formula if it has become redundant."
flag "--message=", flag "--message=",
description: "Append provided <message> to the default PR message." description: "Append provided <message> to the default PR message."
switch :quiet switch :quiet
switch :force switch :force
switch :verbose switch :verbose
switch :debug switch :debug
conflicts "--url", "--tag" conflicts "--url", "--tag"
end end
end end

View File

@ -31,7 +31,8 @@ module Homebrew
EOS EOS
switch "--examples", switch "--examples",
description: "Show several examples." description: "Show several examples."
switch "--pry", env: :pry, switch "--pry",
env: :pry,
description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set." description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set."
end end
end end

View File

@ -156,8 +156,10 @@ module Homebrew
ronn_output = ronn.read ronn_output = ronn.read
odie "Got no output from ronn!" unless ronn_output odie "Got no output from ronn!" unless ronn_output
ronn_output.gsub!(%r{</var>`(?=[.!?,;:]?\s)}, "").gsub!(%r{</?var>}, "`") if format_flag == "--markdown" ronn_output.gsub!(%r{</var>`(?=[.!?,;:]?\s)}, "").gsub!(%r{</?var>}, "`") if format_flag == "--markdown"
ronn_output = ronn_output.gsub(%r{<code>}, "\\fB").gsub(%r{</code>}, "\\fR") unless format_flag == "--markdown"
.gsub(%r{<var>}, "\\fI").gsub(%r{</var>}, "\\fR") unless format_flag == '--markdown' ronn_output = ronn_output.gsub(/<code>/, "\\fB").gsub(%r{</code>}, "\\fR")
.gsub(/<var>/, "\\fI").gsub(%r{</var>}, "\\fR")
end
target.atomic_write ronn_output target.atomic_write ronn_output
end end
end end
@ -192,11 +194,11 @@ module Homebrew
end end
def cmd_arg_parser(cmd_path) def cmd_arg_parser(cmd_path)
"#{cmd_path.basename.to_s.gsub('.rb', '').gsub('-', '_')}_args".to_sym "#{cmd_path.basename.to_s.gsub(".rb", "").tr("-", "_")}_args".to_sym
end end
def cmd_manpage_lines(cmd_parser) def cmd_manpage_lines(cmd_parser)
lines = ["#{format_usage_banner(cmd_parser.usage_banner_text)}"] lines = [format_usage_banner(cmd_parser.usage_banner_text)]
lines += cmd_parser.processed_options.map do |short, long, _, desc| lines += cmd_parser.processed_options.map do |short, long, _, desc|
next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long))
generate_option_doc(short, long, desc) generate_option_doc(short, long, desc)

View File

@ -1,7 +1,7 @@
#: * `prof` [ruby options]: #: * `prof` [<ruby options>]:
#: Run Homebrew with the Ruby profiler. #: Run Homebrew with the Ruby profiler.
#: For example: #: For example:
#: brew prof readall #: brew prof readall
module Homebrew module Homebrew
module_function module_function

View File

@ -1,4 +1,4 @@
#: * test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: #: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] <formula>:
#: Most formulae provide a test method. `brew test` <formula> runs this #: Most formulae provide a test method. `brew test` <formula> runs this
#: test method. There is no standard output or return code, but it should #: test method. There is no standard output or return code, but it should
#: generally indicate to the user if something is wrong with the installed #: generally indicate to the user if something is wrong with the installed

View File

@ -40,7 +40,7 @@ module Homebrew
def help(cmd = nil, flags = {}) def help(cmd = nil, flags = {})
# Let OptionParser generate help text for commands which have a parser defined # Let OptionParser generate help text for commands which have a parser defined
begin begin
Homebrew.send("#{cmd.gsub('-','_')}_args".to_sym) Homebrew.send("#{cmd.tr("-", "_")}_args".to_sym)
return return
rescue NoMethodError rescue NoMethodError
nil nil

View File

@ -836,9 +836,10 @@ It is now done automatically by `brew update`.
Reuploads the stable URL for a formula to Bintray to use it as a mirror. Reuploads the stable URL for a formula to Bintray to use it as a mirror.
* `prof` [ruby options]: * `prof` [`ruby options`]:
Run Homebrew with the Ruby profiler. Run Homebrew with the Ruby profiler.
For example: For example:
brew prof readall
###pull `options` `formula`: ###pull `options` `formula`:
@ -899,7 +900,7 @@ Output as a Markdown list.
Generate the template files for a new tap. Generate the template files for a new tap.
* test [--devel|--HEAD] [--debug] [--keep-tmp] [formula]: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] `formula`:
Most formulae provide a test method. `brew test` `formula` runs this Most formulae provide a test method. `brew test` `formula` runs this
test method. There is no standard output or return code, but it should test method. There is no standard output or return code, but it should
generally indicate to the user if something is wrong with the installed generally indicate to the user if something is wrong with the installed

View File

@ -863,8 +863,8 @@ It is now done automatically by \fBbrew update\fR\.
Reuploads the stable URL for a formula to Bintray to use it as a mirror\. Reuploads the stable URL for a formula to Bintray to use it as a mirror\.
. .
.TP .TP
\fBprof\fR [ruby options] \fBprof\fR [\fIruby options\fR]
Run Homebrew with the Ruby profiler\. For example: Run Homebrew with the Ruby profiler\. For example: brew prof readall
. .
.SS "pull \fIoptions\fR \fIformula\fR:" .SS "pull \fIoptions\fR \fIformula\fR:"
Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\. Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\.
@ -943,7 +943,7 @@ Run a Ruby instance with Homebrew\'s libraries loaded\. For example:
Generate the template files for a new tap\. Generate the template files for a new tap\.
. .
.TP .TP
test [\-\-devel|\-\-HEAD] [\-\-debug] [\-\-keep\-tmp] [formula] \fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR
Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. Most formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\.
. .
.IP .IP