Skip to content

Commit 9e4ae19

Browse files
committed
Lint Ruby docs.
1 parent 820b6c9 commit 9e4ae19

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 16 additions & 3 deletions
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 19 additions & 18 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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`)."

0 commit comments

Comments
 (0)