Skip to content

Commit 480e264

Browse files
committed
Lint Ruby docs.
1 parent 9b6fb3d commit 480e264

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+263
-224
lines changed

.github/ISSUE_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Please fill out one of the templates on: https://github.com/Homebrew/brew/issues/new/choose or we will close it without comment.
1+
Please fill out one of the templates on https://github.com/Homebrew/brew/issues/new/choose or we will close your issue without comment.

.github/workflows/docs.yml

+16-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,22 @@ jobs:
2525
- name: Install vale
2626
run: brew install vale
2727

28-
- name: Run vale for docs linting
29-
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
30-
run: vale .
28+
- name: Lint docs
29+
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
30+
run: |
31+
set -euo pipefail
32+
33+
# Avoid failing on broken symlinks.
34+
rm Library/Homebrew/os/mac/pkgconfig/fuse/fuse.pc
35+
rm Library/Homebrew/os/mac/pkgconfig/fuse/osxfuse.pc
36+
37+
# No ignore support (https://github.com/errata-ai/vale/issues/131).
38+
rm -r Library/Homebrew/vendor
39+
40+
vale .
41+
42+
# Restore removed files.
43+
git reset --hard
3144
3245
- name: Install Ruby
3346
uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # v1.175.1

.vale.ini

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
StylesPath = ./docs/vale-styles
22

3-
[*.md]
3+
[formats]
4+
rb = md
5+
6+
[*.{md,rb}]
47
BasedOnStyles = Homebrew

Library/Homebrew/abstract_command.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
module Homebrew
77
# Subclass this to implement a `brew` command. This is preferred to declaring a named function in the `Homebrew`
88
# module, because:
9+
#
910
# - Each Command lives in an isolated namespace.
1011
# - Each Command implements a defined interface.
11-
# - `args` is available as an ivar, and thus does not need to be passed as an argument to helper methods.
12+
# - `args` is available as an instance method and thus does not need to be passed as an argument to helper methods.
1213
# - Subclasses no longer need to reference `CLI::Parser` or parse args explicitly.
1314
#
1415
# To subclass, implement a `run` method and provide a `cmd_args` block to document the command and its allowed args.

Library/Homebrew/build_environment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def std?
2828
# DSL for specifying build environment settings.
2929
module DSL
3030
# Initialise @env for each class which may use this DSL (e.g. each formula subclass).
31-
# `env` may never be called, and it needs to be initialised before the class is frozen.
31+
# `env` may never be called and it needs to be initialised before the class is frozen.
3232
def inherited(child)
3333
super
3434
child.instance_eval do

Library/Homebrew/cask/audit.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def audit_gitlab_prerelease_version
685685

686686
sig { void }
687687
def audit_github_repository_archived
688-
# Deprecated/disabled casks may have an archived repo.
688+
# Deprecated/disabled casks may have an archived repository.
689689
return if cask.discontinued? || cask.deprecated? || cask.disabled?
690690

691691
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if online?
@@ -699,7 +699,7 @@ def audit_github_repository_archived
699699

700700
sig { void }
701701
def audit_gitlab_repository_archived
702-
# Deprecated/disabled casks may have an archived repo.
702+
# Deprecated/disabled casks may have an archived repository.
703703
return if cask.discontinued? || cask.deprecated? || cask.disabled?
704704

705705
user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if online?

Library/Homebrew/cleaner.rb

+19-18
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,28 @@ def initialize(formula)
2525
def clean
2626
ObserverPathnameExtension.reset_counts!
2727

28-
# Many formulae include 'lib/charset.alias', but it is not strictly needed
29-
# and will conflict if more than one formula provides it
28+
# Many formulae include `lib/charset.alias`, but it is not strictly needed
29+
# and will conflict if more than one formula provides it.
3030
observe_file_removal @formula.lib/"charset.alias"
3131

3232
[@formula.bin, @formula.sbin, @formula.lib].each { |dir| clean_dir(dir) if dir.exist? }
3333

34-
# Get rid of any info 'dir' files, so they don't conflict at the link stage
34+
# Get rid of any info `dir` files, so they don't conflict at the link stage.
3535
#
36-
# The 'dir' files come in at least 3 locations:
36+
# The `dir` files come in at least 3 locations:
3737
#
38-
# 1. 'info/dir'
39-
# 2. 'info/#{name}/dir'
40-
# 3. 'info/#{arch}/dir'
38+
# 1. `info/dir`
39+
# 2. `info/#{name}/dir`
40+
# 3. `info/#{arch}/dir`
4141
#
42-
# Of these 3 only 'info/#{name}/dir' is safe to keep since the rest will
42+
# Of these 3 only `info/#{name}/dir` is safe to keep since the rest will
4343
# conflict with other formulae because they use a shared location.
4444
#
45-
# See [cleaner: recursively delete info `dir`s by gromgit · Pull Request
46-
# #11597][1], [emacs 28.1 bottle does not contain `dir` file · Issue
47-
# #100190][2], and [Keep `info/#{f.name}/dir` files in cleaner by
48-
# timvisher][3] for more info.
45+
# See
46+
# [cleaner: recursively delete info `dir`s][1],
47+
# [emacs 28.1 bottle does not contain `dir` file][2] and
48+
# [Keep `info/#{f.name}/dir` files in cleaner][3]
49+
# for more info.
4950
#
5051
# [1]: https://github.com/Homebrew/brew/pull/11597
5152
# [2]: https://github.com/Homebrew/homebrew-core/issues/100190
@@ -114,15 +115,15 @@ def executable_path?(path)
114115
# created as part of installing any Perl module.
115116
PERL_BASENAMES = Set.new(%w[perllocal.pod .packlist]).freeze
116117

117-
# Clean a top-level (bin, sbin, lib) directory, recursively, by fixing file
118+
# Clean a top-level (`bin`, `sbin`, `lib`) directory, recursively, by fixing file
118119
# permissions and removing .la files, unless the files (or parent
119120
# directories) are protected by skip_clean.
120121
#
121-
# bin and sbin should not have any subdirectories; if either do that is
122-
# caught as an audit warning
122+
# `bin` and `sbin` should not have any subdirectories; if either do that is
123+
# caught as an audit warning.
123124
#
124-
# lib may have a large directory tree (see Erlang for instance), and
125-
# clean_dir applies cleaning rules to the entire tree
125+
# `lib` may have a large directory tree (see Erlang for instance) and
126+
# clean_dir applies cleaning rules to the entire tree.
126127
sig { params(directory: Pathname).void }
127128
def clean_dir(directory)
128129
directory.find do |path|
@@ -137,7 +138,7 @@ def clean_dir(directory)
137138
elsif path.symlink?
138139
# Skip it.
139140
else
140-
# Set permissions for executables and non-executables
141+
# Set permissions for executables and non-executables.
141142
perms = if executable_path?(path)
142143
0555
143144
else

Library/Homebrew/cleanup.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def cleanup_logs
376376
def cache_files
377377
files = cache.directory? ? cache.children : []
378378
cask_files = (cache/"Cask").directory? ? (cache/"Cask").children : []
379-
api_source_files = (cache/"api-source").glob("*/*/*/*/*") # org/repo/git_head/type/file.rb
379+
api_source_files = (cache/"api-source").glob("*/*/*/*/*") # `<org>/<repo>/<git_head>/<type>/<token>.rb`
380380
gh_actions_artifacts = (cache/"gh-actions-artifact").directory? ? (cache/"gh-actions-artifact").children : []
381381

382382
files.map { |path| { path:, type: nil } } +
@@ -571,8 +571,8 @@ def cleanup_python_site_packages
571571
HOMEBREW_PREFIX.glob("lib/python*/site-packages").each do |site_packages|
572572
site_packages.each_child do |child|
573573
next unless child.directory?
574-
# TODO: Work out a sensible way to clean up pip's, setuptools', and wheel's
575-
# {dist,site}-info directories. Alternatively, consider always removing
574+
# TODO: Work out a sensible way to clean up `pip`'s, `setuptools`' and `wheel`'s
575+
# `{dist,site}-info` directories. Alternatively, consider always removing
576576
# all `-info` directories, because we may not be making use of them.
577577
next if child.basename.to_s.end_with?("-info")
578578

Library/Homebrew/cmd/--prefix.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def list_unbrewed
9595
dirs = HOMEBREW_PREFIX.subdirs.map { |dir| dir.basename.to_s }
9696
dirs -= %w[Library Cellar Caskroom .git]
9797

98-
# Exclude cache, logs, and repository, if they are located under the prefix.
98+
# Exclude cache, logs and repository, if they are located under the prefix.
9999
[HOMEBREW_CACHE, HOMEBREW_LOGS, HOMEBREW_REPOSITORY].each do |dir|
100100
dirs.delete dir.relative_path_from(HOMEBREW_PREFIX).to_s
101101
end

Library/Homebrew/cmd/outdated.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Outdated < AbstractCommand
1313
cmd_args do
1414
description <<~EOS
1515
List installed casks and formulae that have an updated version available. By default, version
16-
information is displayed in interactive shells, and suppressed otherwise.
16+
information is displayed in interactive shells and suppressed otherwise.
1717
EOS
1818
switch "-q", "--quiet",
1919
description: "List only the names of outdated kegs (takes precedence over `--verbose`)."

Library/Homebrew/dependencies_helpers.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def recursive_includes(klass, root_dependent, includes, ignores)
3333
end
3434

3535
# If a tap isn't installed, we can't find the dependencies of one of
36-
# its formulae, and an exception will be thrown if we try.
36+
# its formulae and an exception will be thrown if we try.
3737
Dependency.keep_but_prune_recursive_deps if klass == Dependency && dep.tap && !dep.tap.installed?
3838
end
3939
end

Library/Homebrew/dependency_collector.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
require "requirements"
88
require "extend/cachable"
99

10-
## A dependency is a formula that another formula needs to install.
11-
## A requirement is something other than a formula that another formula
12-
## needs to be present. This includes external language modules,
13-
## command-line tools in the path, or any arbitrary predicate.
14-
##
15-
## The `depends_on` method in the formula DSL is used to declare
16-
## dependencies and requirements.
10+
# A dependency is a formula that another formula needs to install.
11+
# A requirement is something other than a formula that another formula
12+
# needs to be present. This includes external language modules,
13+
# command-line tools in the path, or any arbitrary predicate.
14+
#
15+
# The `depends_on` method in the formula DSL is used to declare
16+
# dependencies and requirements.
1717

1818
# This class is used by `depends_on` in the formula DSL to turn dependency
1919
# specifications into the proper kinds of dependencies and requirements.

Library/Homebrew/dev-cmd/pr-pull.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PrPull < AbstractCommand
1515

1616
cmd_args do
1717
description <<~EOS
18-
Download and publish bottles, and apply the bottle commit from a
18+
Download and publish bottles and apply the bottle commit from a
1919
pull request with artifacts generated by GitHub Actions.
2020
Requires write access to the repository.
2121
EOS
@@ -187,7 +187,7 @@ def run
187187
end
188188
end
189189

190-
# Separates a commit message into subject, body, and trailers.
190+
# Separates a commit message into subject, body and trailers.
191191
def separate_commit_message(message)
192192
subject = message.lines.first.strip
193193

@@ -337,7 +337,7 @@ def squash_package_commits(commits, file, git_repo:, reason: "", verbose: false,
337337
new_package = package_file.read
338338
bump_subject = determine_bump_subject(old_package, new_package, package_file, reason:)
339339

340-
# Commit with the new subject, body, and trailers.
340+
# Commit with the new subject, body and trailers.
341341
safe_system("git", "-C", git_repo.pathname, "commit", "--quiet",
342342
"-m", bump_subject, "-m", messages.join("\n"), "-m", trailers.join("\n"),
343343
"--author", original_author, "--date", original_date, "--", file)

Library/Homebrew/dev-cmd/tap-new.rb

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def run
4646

4747
(tap.path/"Formula").mkpath
4848

49+
# FIXME: https://github.com/errata-ai/vale/issues/818
50+
# <!-- vale off -->
4951
readme = <<~MARKDOWN
5052
# #{titleized_user} #{titleized_repo}
5153
@@ -59,6 +61,7 @@ def run
5961
6062
`brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh).
6163
MARKDOWN
64+
# <!-- vale on -->
6265
write_path(tap, "README.md", readme)
6366

6467
actions_main = <<~YAML

Library/Homebrew/dev-cmd/tests.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class Tests < AbstractCommand
2222
description: "Include tests that use the GitHub API and tests that use any of the taps for " \
2323
"official external commands."
2424
switch "--debug",
25-
description: "Enable debugging using ruby/debug, or surface the standard `odebug` output."
25+
description: "Enable debugging using `ruby/debug`, or surface the standard `odebug` output."
2626
switch "--changed",
2727
description: "Only runs tests on files that were changed from the master branch."
2828
switch "--fail-fast",
2929
description: "Exit early on the first failing test."
3030
flag "--only=",
31-
description: "Run only <test_script>`_spec.rb`. Appending `:`<line_number> will start at a " \
31+
description: "Run only `<test_script>_spec.rb`. Appending `:<line_number>` will start at a " \
3232
"specific line."
3333
flag "--profile=",
3434
description: "Run the test suite serially to find the <n> slowest tests."
@@ -145,7 +145,10 @@ def run
145145
end
146146

147147
# Workaround for:
148+
#
149+
# ```
148150
# ruby: no -r allowed while running setuid (SecurityError)
151+
# ```
149152
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
150153

151154
if parallel

Library/Homebrew/dev-cmd/update-test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def run
116116
# update ENV["PATH"]
117117
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).prepend(curdir/"bin").to_s
118118

119-
# run brew help to install portable-ruby (if needed)
119+
# Run `brew help` to install `portable-ruby` (if needed).
120120
quiet_system "brew", "help"
121121

122122
# run brew update

Library/Homebrew/diagnostic.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def check_for_stray_dylibs
221221
__check_stray_files "/usr/local/lib", "*.dylib", allow_list, <<~EOS
222222
Unbrewed dylibs were found in /usr/local/lib.
223223
If you didn't put them there on purpose they could cause problems when
224-
building Homebrew formulae, and may need to be deleted.
224+
building Homebrew formulae and may need to be deleted.
225225
226226
Unexpected dylibs:
227227
EOS
@@ -246,7 +246,7 @@ def check_for_stray_static_libs
246246
__check_stray_files "/usr/local/lib", "*.a", allow_list, <<~EOS
247247
Unbrewed static libraries were found in /usr/local/lib.
248248
If you didn't put them there on purpose they could cause problems when
249-
building Homebrew formulae, and may need to be deleted.
249+
building Homebrew formulae and may need to be deleted.
250250
251251
Unexpected static libraries:
252252
EOS
@@ -266,7 +266,7 @@ def check_for_stray_pcs
266266
__check_stray_files "/usr/local/lib/pkgconfig", "*.pc", allow_list, <<~EOS
267267
Unbrewed '.pc' files were found in /usr/local/lib/pkgconfig.
268268
If you didn't put them there on purpose they could cause problems when
269-
building Homebrew formulae, and may need to be deleted.
269+
building Homebrew formulae and may need to be deleted.
270270
271271
Unexpected '.pc' files:
272272
EOS
@@ -287,7 +287,7 @@ def check_for_stray_las
287287
__check_stray_files "/usr/local/lib", "*.la", allow_list, <<~EOS
288288
Unbrewed '.la' files were found in /usr/local/lib.
289289
If you didn't put them there on purpose they could cause problems when
290-
building Homebrew formulae, and may need to be deleted.
290+
building Homebrew formulae and may need to be deleted.
291291
292292
Unexpected '.la' files:
293293
EOS
@@ -306,7 +306,7 @@ def check_for_stray_headers
306306
__check_stray_files "/usr/local/include", "**/*.h", allow_list, <<~EOS
307307
Unbrewed header files were found in /usr/local/include.
308308
If you didn't put them there on purpose they could cause problems when
309-
building Homebrew formulae, and may need to be deleted.
309+
building Homebrew formulae and may need to be deleted.
310310
311311
Unexpected header files:
312312
EOS
@@ -491,7 +491,7 @@ def check_for_git
491491

492492
<<~EOS
493493
Git could not be found in your PATH.
494-
Homebrew uses Git for several internal functions, and some formulae use Git
494+
Homebrew uses Git for several internal functions and some formulae use Git
495495
checkouts instead of stable tarballs. You may want to install Git:
496496
brew install git
497497
EOS

Library/Homebrew/download_strategy.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,8 @@ def clone_args
931931

932932
args << "--no-checkout" << "--filter=blob:none" if partial_clone_sparse_checkout?
933933

934-
args << "--config" << "advice.detachedHead=false" # silences detached head warning
935-
args << "--config" << "core.fsmonitor=false" # prevent fsmonitor from watching this repo
934+
args << "--config" << "advice.detachedHead=false" # Silences “detached head warning.
935+
args << "--config" << "core.fsmonitor=false" # Prevent `fsmonitor` from watching this repository.
936936
args << @url << cached_location.to_s
937937
end
938938

Library/Homebrew/extend/ENV.rb

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ def superenv?(env)
1717
private :superenv?
1818
end
1919

20+
# <!-- vale off -->
2021
# @!parse
21-
# # ENV is not actually a class, but this makes `YARD` happy
22-
# # @see https://rubydoc.info/stdlib/core/ENV ENV core documentation
23-
# class ENV; end
22+
# # `ENV` is not actually a class, but this makes YARD happy
23+
# # @see https://rubydoc.info/stdlib/core/ENV
24+
# # <code>ENV</code> core documentation
25+
# # @see Superenv
26+
# # @see Stdenv
27+
# class ENV; end
28+
# <!-- vale on -->
29+
2430
module EnvActivation
2531
sig { params(env: T.nilable(String)).void }
2632
def activate_extensions!(env: nil)

Library/Homebrew/extend/os/linux/install.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module Homebrew
55
module Install
66
# This is a list of known paths to the host dynamic linker on Linux if
7-
# the host glibc is new enough. The symlink_ld_so method will fail if
7+
# the host glibc is new enough. The symlink_ld_so method will fail if
88
# the host linker cannot be found in this list.
99
DYNAMIC_LINKERS = %w[
1010
/lib64/ld-linux-x86-64.so.2
@@ -19,7 +19,7 @@ module Install
1919
private_constant :DYNAMIC_LINKERS
2020

2121
# We link GCC runtime libraries that are not specifically used for Fortran,
22-
# which are linked by the GCC formula. We only use the versioned shared libraries
22+
# which are linked by the GCC formula. We only use the versioned shared libraries
2323
# as the other shared and static libraries are only used at build time where
2424
# GCC can find its own libraries.
2525
GCC_RUNTIME_LIBS = %w[

0 commit comments

Comments
 (0)