Merge pull request #10239 from MikeMcQuaid/rubocop-shim

rubocop: add shim and command.
This commit is contained in:
Mike McQuaid 2021-01-08 13:04:35 +00:00 committed by GitHub
commit 3b3d495021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 0 deletions

3
.gitignore vendored
View File

@ -183,3 +183,6 @@
# Unignore tests' bundle config
!/Library/Homebrew/test/.bundle/config
# Unignore vscode configuration
!/.vscode

8
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"recommendations": [
"kaiwood.endwise",
"misogi.ruby-rubocop",
"rebornix.ruby",
"wingrunr21.vscode-ruby"
]
}

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"ruby.rubocop.executePath": "Library/Homebrew/shims/gems/",
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"files.insertFinalNewline": true,
}

View File

@ -0,0 +1,25 @@
#: * `rubocop`
#:
#: Installs, configures and runs Homebrew's `rubocop`.
homebrew-rubocop() {
# Don't need shellcheck to follow this `source`.
# shellcheck disable=SC1090
source "$HOMEBREW_LIBRARY/Homebrew/utils/ruby.sh"
setup-ruby-path
GEM_VERSION="$("$HOMEBREW_RUBY_PATH" "$RUBY_DISABLE_OPTIONS" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')"
GEM_HOME="$HOMEBREW_LIBRARY/Homebrew/vendor/bundle/ruby/$GEM_VERSION"
if ! [[ -f "$GEM_HOME/bin/rubocop" ]]; then
"$HOMEBREW_BREW_FILE" install-bundler-gems
fi
export GEM_HOME
export PATH="$GEM_HOME/bin:$PATH"
# Unconditional -W0 to avoid printing e.g.:
# warning: parser/current is loading parser/ruby26, which recognizes
# warning: 2.6.6-compliant syntax, but you are running 2.6.3.
exec "$HOMEBREW_RUBY_PATH" "$RUBY_DISABLE_OPTIONS" -W0 -S rubocop "$@"
}

View File

@ -0,0 +1,2 @@
#!/bin/bash
exec brew rubocop "$@"

View File

@ -74,6 +74,7 @@ reinstall
release-notes
remove
rm
rubocop
ruby
search
sh

View File

@ -1206,6 +1206,10 @@ a warning will be shown if the latest minor release was less than one month ago.
* `--markdown`:
Print as a Markdown list.
### `rubocop`
Installs, configures and runs Homebrew's `rubocop`.
### `ruby` (`-e` *`text`*|*`file`*)
Run a Ruby instance with Homebrew's libraries loaded, e.g.

View File

@ -1683,6 +1683,9 @@ If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line contain
\fB\-\-markdown\fR
Print as a Markdown list\.
.
.SS "\fBrubocop\fR"
Installs, configures and runs Homebrew\'s \fBrubocop\fR\.
.
.SS "\fBruby\fR (\fB\-e\fR \fItext\fR|\fIfile\fR)"
Run a Ruby instance with Homebrew\'s libraries loaded, e\.g\. \fBbrew ruby \-e "puts :gcc\.f\.deps"\fR or \fBbrew ruby script\.rb\fR\.
.