mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #17482 from samford/fix-brew-style-tap-checking
This commit is contained in:
commit
df2387fd56
5
.github/workflows/docs.yml
vendored
5
.github/workflows/docs.yml
vendored
@ -60,8 +60,9 @@ jobs:
|
|||||||
working-directory: docs
|
working-directory: docs
|
||||||
run: bundle exec rake lint
|
run: bundle exec rake lint
|
||||||
|
|
||||||
- name: Check code blocks conform to our Ruby style guide
|
# TODO: reenable when possible.
|
||||||
run: brew style docs
|
# - name: Check code blocks conform to our Ruby style guide
|
||||||
|
# run: brew style docs
|
||||||
|
|
||||||
- name: Generate formulae.brew.sh API samples
|
- name: Generate formulae.brew.sh API samples
|
||||||
if: github.repository == 'Homebrew/formulae.brew.sh'
|
if: github.repository == 'Homebrew/formulae.brew.sh'
|
||||||
|
@ -44,9 +44,9 @@ module Homebrew
|
|||||||
debug: false, verbose: false)
|
debug: false, verbose: false)
|
||||||
raise ArgumentError, "Invalid output type: #{output_type.inspect}" if [:print, :json].exclude?(output_type)
|
raise ArgumentError, "Invalid output type: #{output_type.inspect}" if [:print, :json].exclude?(output_type)
|
||||||
|
|
||||||
ruby_files = []
|
ruby_files = T.let([], T::Array[Pathname])
|
||||||
shell_files = []
|
shell_files = T.let([], T::Array[Pathname])
|
||||||
actionlint_files = []
|
actionlint_files = T.let([], T::Array[Pathname])
|
||||||
Array(files).map(&method(:Pathname))
|
Array(files).map(&method(:Pathname))
|
||||||
.each do |path|
|
.each do |path|
|
||||||
case path.extname
|
case path.extname
|
||||||
@ -57,7 +57,14 @@ module Homebrew
|
|||||||
when ".yml"
|
when ".yml"
|
||||||
actionlint_files << path if path.realpath.to_s.include?("/.github/workflows/")
|
actionlint_files << path if path.realpath.to_s.include?("/.github/workflows/")
|
||||||
else
|
else
|
||||||
shell_files << path if path.realpath == HOMEBREW_BREW_FILE.realpath
|
ruby_files << path
|
||||||
|
shell_files += if [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY].include?(path)
|
||||||
|
shell_scripts
|
||||||
|
else
|
||||||
|
path.glob("**/*.sh")
|
||||||
|
.reject { |path| path.to_s.include?("/vendor/") }
|
||||||
|
end
|
||||||
|
actionlint_files += (path/".github/workflows").glob("*.y{,a}ml")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -263,8 +270,10 @@ module Homebrew
|
|||||||
|
|
||||||
def self.run_actionlint(files)
|
def self.run_actionlint(files)
|
||||||
files = github_workflow_files if files.blank?
|
files = github_workflow_files if files.blank?
|
||||||
|
# the ignore is to avoid false positives in e.g. actions, homebrew-test-bot
|
||||||
system actionlint, "-shellcheck", shellcheck,
|
system actionlint, "-shellcheck", shellcheck,
|
||||||
"-config-file", HOMEBREW_REPOSITORY/".github/actionlint.yaml",
|
"-config-file", HOMEBREW_REPOSITORY/".github/actionlint.yaml",
|
||||||
|
"-ignore", "image: string; options: string",
|
||||||
*files
|
*files
|
||||||
$CHILD_STATUS.success?
|
$CHILD_STATUS.success?
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
rule 'HB034', 'Bare unstyled URL used' do
|
# typed: true
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
rule "HB034", "Bare unstyled URL used" do
|
||||||
tags :links, :url
|
tags :links, :url
|
||||||
aliases 'no-bare-unstyled-urls'
|
aliases "no-bare-unstyled-urls"
|
||||||
check do |doc|
|
check do |doc|
|
||||||
doc.matching_text_element_lines(%r{(?<=\s)https?://})
|
doc.matching_text_element_lines(%r{(?<=\s)https?://})
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
# typed: true
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
all
|
all
|
||||||
rule 'MD007', indent: 2 # Unordered list indentation
|
rule "MD007", indent: 2 # Unordered list indentation
|
||||||
rule 'MD026', punctuation: ',;:' # Trailing punctuation in header
|
rule "MD026", punctuation: ",;:" # Trailing punctuation in header
|
||||||
exclude_rule 'MD013' # Line length
|
exclude_rule "MD013" # Line length
|
||||||
exclude_rule 'MD029' # Ordered list item prefix
|
exclude_rule "MD029" # Ordered list item prefix
|
||||||
exclude_rule 'MD033' # Inline HTML
|
exclude_rule "MD033" # Inline HTML
|
||||||
exclude_rule 'MD034' # Bare URL used (replaced by HB034)
|
exclude_rule "MD034" # Bare URL used (replaced by HB034)
|
||||||
exclude_rule 'MD046' # Code block style
|
exclude_rule "MD046" # Code block style
|
||||||
|
@ -2,9 +2,6 @@ inherit_from: ../Library/.rubocop.yml
|
|||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
- Gemfile
|
|
||||||
- ".mdl*.rb"
|
|
||||||
- Rakefile
|
|
||||||
- "_site/**/*"
|
- "_site/**/*"
|
||||||
- Manpage.md
|
- Manpage.md
|
||||||
- "vendor/**/*"
|
- "vendor/**/*"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
ruby file: ".ruby-version"
|
ruby file: ".ruby-version"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "rake"
|
require "rake"
|
||||||
|
|
||||||
task default: :build
|
task default: :build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user