diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c31d83e1ea241..90fa84c0ae6d7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -60,9 +60,8 @@ jobs: working-directory: docs run: bundle exec rake lint - # TODO: reenable when possible. - # - name: Check code blocks conform to our Ruby style guide - # 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 if: github.repository == 'Homebrew/formulae.brew.sh' diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index fa6fd4bede1e2..777be37c66669 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -151,8 +151,8 @@ def self.run_rubocop(files, output_type, files&.map!(&:expand_path) if files.blank? || files == [HOMEBREW_REPOSITORY] files = [HOMEBREW_LIBRARY_PATH] - elsif files.any? { |f| f.to_s.start_with?(HOMEBREW_REPOSITORY/"docs") || (f.basename == "docs") } - args << "--config" << (HOMEBREW_REPOSITORY/"docs/.rubocop.yml") + elsif files.any? { |f| f.to_s.start_with?(HOMEBREW_REPOSITORY/"docs") || (f.basename.to_s == "docs") } + args << "--config" << (HOMEBREW_REPOSITORY/"docs/docs_rubocop_style.yml") elsif files.none? { |f| f.to_s.start_with? HOMEBREW_LIBRARY_PATH } args << "--config" << (HOMEBREW_LIBRARY/".rubocop.yml") end diff --git a/docs/.rubocop.yml b/docs/.rubocop.yml index 3c4cadd3574b7..1c984c707e2de 100644 --- a/docs/.rubocop.yml +++ b/docs/.rubocop.yml @@ -2,9 +2,9 @@ inherit_from: ../Library/.rubocop.yml AllCops: Exclude: - - "_site/**/*" - - Manpage.md - - "vendor/**/*" + - "**/_site/**/*" + - "**/Manpage.md" + - "**/vendor/**/*" # These are included in docs deliberately to show what # `brew create` does and what the user should replace. @@ -19,7 +19,7 @@ FormulaAudit/Homepage: Layout/LineLength: Exclude: - - Bottles.md # The bottle block line length is long in its full form. + - "**/Bottles.md" # The bottle block line length is long in its full form. # Apparently Casks are allowed to have constant definitions in blocks and we document this. Lint/ConstantDefinitionInBlock: diff --git a/docs/docs_rubocop_style.yml b/docs/docs_rubocop_style.yml new file mode 120000 index 0000000000000..62a9e6e71f1c2 --- /dev/null +++ b/docs/docs_rubocop_style.yml @@ -0,0 +1 @@ +.rubocop.yml \ No newline at end of file