Skip to content

Commit

Permalink
vale
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Apr 30, 2024
1 parent 9c112bd commit 19b59d4
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 59 deletions.
2 changes: 2 additions & 0 deletions Library/Homebrew/dev-cmd/tap-new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def run

(tap.path/"Formula").mkpath

# <!-- vale Homebrew.Titles = NO -->
readme = <<~MARKDOWN
# #{titleized_user} #{titleized_repo}
Expand All @@ -59,6 +60,7 @@ def run
`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).
MARKDOWN
# <!-- vale Homebrew.Titles = YES -->
write_path(tap, "README.md", readme)

actions_main = <<~YAML
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def truncate_text_to_approximate_size(str, max_bytes, options = {})
#
# ### Example
#
# ``ruby
# ```ruby
# with_env(PATH: "/bin") do
# system "echo $PATH"
# end
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/formula_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def write_formula!

sig { returns(String) }
def template
# <!-- vale Homebrew.Spacing = NO -->
<<~ERB
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://rubydoc.brew.sh/Formula
Expand Down Expand Up @@ -231,6 +232,7 @@ def install
end
end
ERB
# <!-- vale Homebrew.Spacing = YES -->
end
end
end
2 changes: 1 addition & 1 deletion Library/Homebrew/rubocops/cask/array_alphabetization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def sort_array(source)
end

# Separate the lines into those that should be sorted and those that should not
# ie. skip the opening and closing brackets of the array
# i.e. skip the opening and closing brackets of the array.
to_sort, to_keep = combined_source.partition { |line| !line.include?("[") && !line.include?("]") }

# Sort the lines that should be sorted
Expand Down
112 changes: 56 additions & 56 deletions Library/Homebrew/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,115 +382,115 @@ def self.parse(spec, detected_from_url: false)

VERSION_PARSERS = [
# date-based versioning
# e.g. 2023-09-28.tar.gz
# e.g. ltopers-v2017-04-14.tar.gz
# e.g. `2023-09-28.tar.gz`
# e.g. `ltopers-v2017-04-14.tar.gz`
StemParser.new(/(?:^|[._-]?)v?(\d{4}-\d{2}-\d{2})/),

# GitHub tarballs
# e.g. https://github.com/foo/bar/tarball/v1.2.3
# e.g. https://github.com/sam-github/libnet/tarball/libnet-1.1.4
# e.g. https://github.com/isaacs/npm/tarball/v0.2.5-1
# e.g. https://github.com/petdance/ack/tarball/1.93_02
# e.g. `https://github.com/foo/bar/tarball/v1.2.3`
# e.g. `https://github.com/sam-github/libnet/tarball/libnet-1.1.4`
# e.g. `https://github.com/isaacs/npm/tarball/v0.2.5-1`
# e.g. `https://github.com/petdance/ack/tarball/1.93_02`
UrlParser.new(%r{github\.com/.+/(?:zip|tar)ball/(?:v|\w+-)?((?:\d+[._-])+\d*)$}),

# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)
# e.g. `https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)`
UrlParser.new(/[_-]([Rr]\d+[AaBb]\d*(?:-\d+)?)/),

# e.g. boost_1_39_0
# e.g. `boost_1_39_0`
StemParser.new(/((?:\d+_)+\d+)$/) { |s| s.tr("_", ".") },

# e.g. foobar-4.5.1-1
# e.g. unrtf_0.20.4-1
# e.g. ruby-1.9.1-p243
# e.g. `foobar-4.5.1-1`
# e.g. `unrtf_0.20.4-1`
# e.g. `ruby-1.9.1-p243`
StemParser.new(/[_-](#{NUMERIC_WITH_DOTS}-(?:p|P|rc|RC)?\d+)#{CONTENT_SUFFIX}?$/),

# Hyphenated versions without software-name prefix (e.g. brew-)
# e.g. v0.0.8-12.tar.gz
# e.g. 3.3.04-1.tar.gz
# e.g. v2.1-20210510.tar.gz
# e.g. 2020.11.11-3.tar.gz
# e.g. v3.6.6-0.2
# e.g. `v0.0.8-12.tar.gz`
# e.g. `3.3.04-1.tar.gz`
# e.g. `v2.1-20210510.tar.gz`
# e.g. `2020.11.11-3.tar.gz`
# e.g. `v3.6.6-0.2`
StemParser.new(/^v?(#{NUMERIC_WITH_DOTS}(?:-#{NUMERIC_WITH_OPTIONAL_DOTS})+)/),

# URL with no extension
# e.g. https://waf.io/waf-1.8.12
# e.g. https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1
# e.g. `https://waf.io/waf-1.8.12`
# e.g. `https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1`
UrlParser.new(/[-v](#{NUMERIC_WITH_OPTIONAL_DOTS})$/),

# e.g. lame-398-1
# e.g. `lame-398-1`
StemParser.new(/-(\d+-\d+)/),

# e.g. foobar-4.5.1
# e.g. `foobar-4.5.1`
StemParser.new(/-(#{NUMERIC_WITH_OPTIONAL_DOTS})$/),

# e.g. foobar-4.5.1.post1
# e.g. `foobar-4.5.1.post1`
StemParser.new(/-(#{NUMERIC_WITH_OPTIONAL_DOTS}(.post\d+)?)$/),

# e.g. foobar-4.5.1b
# e.g. `foobar-4.5.1b`
StemParser.new(/-(#{NUMERIC_WITH_OPTIONAL_DOTS}(?:[abc]|rc|RC)\d*)$/),

# e.g. foobar-4.5.0-alpha5, foobar-4.5.0-beta1, or foobar-4.50-beta
# e.g. `foobar-4.5.0-alpha5, foobar-4.5.0-beta1, or foobar-4.50-beta`
StemParser.new(/-(#{NUMERIC_WITH_OPTIONAL_DOTS}-(?:alpha|beta|rc)\d*)$/),

# e.g. https://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip
# e.g. https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.17-w32.zip
# e.g. `https://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip`
# e.g. `https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.17-w32.zip`
StemParser.new(/-(#{MINOR_OR_PATCH})-w(?:in)?(?:32|64)$/),

# Opam packages
# e.g. https://opam.ocaml.org/archives/sha.1.9+opam.tar.gz
# e.g. https://opam.ocaml.org/archives/lablgtk.2.18.3+opam.tar.gz
# e.g. https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz
# e.g. `https://opam.ocaml.org/archives/sha.1.9+opam.tar.gz`
# e.g. `https://opam.ocaml.org/archives/lablgtk.2.18.3+opam.tar.gz`
# e.g. `https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz`
StemParser.new(/\.(#{MINOR_OR_PATCH})\+opam$/),

# e.g. https://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm
# e.g. https://ftpmirror.gnu.org/autogen/autogen-5.5.7-5.i386.rpm
# e.g. https://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x86.zip
# e.g. https://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x64.zip
# e.g. https://ftpmirror.gnu.org/mtools/mtools_4.0.18_i386.deb
# e.g. `https://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm`
# e.g. `https://ftpmirror.gnu.org/autogen/autogen-5.5.7-5.i386.rpm`
# e.g. `https://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x86.zip`
# e.g. `https://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x64.zip`
# e.g. `https://ftpmirror.gnu.org/mtools/mtools_4.0.18_i386.deb`
StemParser.new(/[_-](#{MINOR_OR_PATCH}(?:-\d+)?)[._-](?:i[36]86|x86|x64(?:[_-](?:32|64))?)$/),

# e.g. https://registry.npmjs.org/@angular/cli/-/cli-1.3.0-beta.1.tgz
# e.g. https://github.com/dlang/dmd/archive/v2.074.0-beta1.tar.gz
# e.g. https://github.com/dlang/dmd/archive/v2.074.0-rc1.tar.gz
# e.g. https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip
# e.g. `https://registry.npmjs.org/@angular/cli/-/cli-1.3.0-beta.1.tgz`
# e.g. `https://github.com/dlang/dmd/archive/v2.074.0-beta1.tar.gz`
# e.g. `https://github.com/dlang/dmd/archive/v2.074.0-rc1.tar.gz`
# e.g. `https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip`
StemParser.new(/[-.vV]?(#{NUMERIC_WITH_DOTS}#{PRERELEASE_SUFFIX})/),

# e.g. foobar4.5.1
# e.g. `foobar4.5.1`
StemParser.new(/(#{NUMERIC_WITH_OPTIONAL_DOTS})$/),

# e.g. foobar-4.5.0-bin
# e.g. `foobar-4.5.0-bin`
StemParser.new(/[-vV](#{NUMERIC_WITH_DOTS}[abc]?)#{CONTENT_SUFFIX}$/),

# dash version style
# e.g. http://www.antlr.org/download/antlr-3.4-complete.jar
# e.g. https://cdn.nuxeo.com/nuxeo-9.2/nuxeo-server-9.2-tomcat.zip
# e.g. https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar
# e.g. https://search.maven.org/remotecontent?filepath=org/fusesource/fuse-extra/fusemq-apollo-mqtt/1.3/fusemq-apollo-mqtt-1.3-uber.jar
# e.g. https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar
# e.g. `http://www.antlr.org/download/antlr-3.4-complete.jar`
# e.g. `https://cdn.nuxeo.com/nuxeo-9.2/nuxeo-server-9.2-tomcat.zip`
# e.g. `https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar`
# e.g. `https://search.maven.org/remotecontent?filepath=org/fusesource/fuse-extra/fusemq-apollo-mqtt/1.3/fusemq-apollo-mqtt-1.3-uber.jar`
# e.g. `https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar`
StemParser.new(/-(#{NUMERIC_WITH_DOTS})-/),

# e.g. dash_0.5.5.1.orig.tar.gz (Debian style)
# e.g. `dash_0.5.5.1.orig.tar.gz (Debian style)`
StemParser.new(/_(#{NUMERIC_WITH_DOTS}[abc]?)\.orig$/),

# e.g. https://www.openssl.org/source/openssl-0.9.8s.tar.gz
# e.g. `https://www.openssl.org/source/openssl-0.9.8s.tar.gz`
StemParser.new(/-v?(\d[^-]+)/),

# e.g. astyle_1.23_macosx.tar.gz
# e.g. `astyle_1.23_macosx.tar.gz`
StemParser.new(/_v?(\d[^_]+)/),

# e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
# e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar
# e.g. https://github.com/clojure/clojurescript/releases/download/r1.9.293/cljs.jar
# e.g. https://github.com/fibjs/fibjs/releases/download/v0.6.1/fullsrc.zip
# e.g. https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_1.9/E.tgz
# e.g. https://github.com/JustArchi/ArchiSteamFarm/releases/download/2.3.2.0/ASF.zip
# e.g. https://people.gnome.org/~newren/eg/download/1.7.5.2/eg
# e.g. `http://mirrors.jenkins-ci.org/war/1.486/jenkins.war`
# e.g. `https://github.com/foo/bar/releases/download/0.10.11/bar.phar`
# e.g. `https://github.com/clojure/clojurescript/releases/download/r1.9.293/cljs.jar`
# e.g. `https://github.com/fibjs/fibjs/releases/download/v0.6.1/fullsrc.zip`
# e.g. `https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_1.9/E.tgz`
# e.g. `https://github.com/JustArchi/ArchiSteamFarm/releases/download/2.3.2.0/ASF.zip`
# e.g. `https://people.gnome.org/~newren/eg/download/1.7.5.2/eg`
UrlParser.new(%r{/(?:[rvV]_?)?(\d+\.\d+(?:\.\d+){,2})}),

# e.g. https://www.ijg.org/files/jpegsrc.v8d.tar.gz
# e.g. `https://www.ijg.org/files/jpegsrc.v8d.tar.gz`
StemParser.new(/\.v(\d+[a-z]?)/),

# e.g. https://secure.php.net/get/php-7.1.10.tar.bz2/from/this/mirror
# e.g. `https://secure.php.net/get/php-7.1.10.tar.bz2/from/this/mirror`
UrlParser.new(/[-.vV]?(#{NUMERIC_WITH_DOTS}#{PRERELEASE_SUFFIX}?)/),
].freeze
private_constant :VERSION_PARSERS
Expand Down
2 changes: 1 addition & 1 deletion docs/vale-styles/Homebrew/Terms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ swap:
'(?<!How to Open a Homebrew )Pull Request': pull request
Rubocop: RuboCop
'(?<!^\{.*)MacOS': macOS # FIXME: https://github.com/errata-ai/vale/issues/818
'(?<!^\{.*)ruby': Ruby # FIXME: https://github.com/errata-ai/vale/issues/818
'(?<!^\{.*|^#!)ruby': Ruby # FIXME: https://github.com/errata-ai/vale/issues/818

0 comments on commit 19b59d4

Please sign in to comment.