diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82605be717..3deb1f07aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,8 +104,8 @@ jobs: id: gems run: brew install-bundler-gems - - name: Run brew cask style - run: brew cask style + - name: Run brew style ${{ matrix.tap }} + run: brew style ${{ matrix.tap }} if: always() && steps.gems.outcome == 'success' && !matrix.cask - name: Run brew cask audit ${{ matrix.cask.token }} diff --git a/cmd/brewcask-ci.rb b/cmd/brewcask-ci.rb index 752f0e0d21..2027c6e4b6 100644 --- a/cmd/brewcask-ci.rb +++ b/cmd/brewcask-ci.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require "utils/github" require "utils/formatter" diff --git a/cmd/lib/changed_files.rb b/cmd/lib/changed_files.rb index 98babaa3e5..e30157a98a 100644 --- a/cmd/lib/changed_files.rb +++ b/cmd/lib/changed_files.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ChangedFiles def self.collect(tap) commit_range_start = system_command!("git", args: ["rev-parse", "origin/master"]).stdout.chomp diff --git a/cmd/lib/check.rb b/cmd/lib/check.rb index 7942c8c70a..675c4af70d 100644 --- a/cmd/lib/check.rb +++ b/cmd/lib/check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "forwardable" module Check @@ -77,7 +79,7 @@ module Check end def self.errors(before, after, cask:) - uninstall_directives = cask.artifacts.select { |a| a.class == Cask::Artifact::Uninstall }.first&.directives || {} + uninstall_directives = cask.artifacts.find { |a| a.class == Cask::Artifact::Uninstall }&.directives || {} diff = {} diff --git a/cmd/lib/ci_matrix.rb b/cmd/lib/ci_matrix.rb index 42452c0951..ea0b30dddc 100644 --- a/cmd/lib/ci_matrix.rb +++ b/cmd/lib/ci_matrix.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative "changed_files" module CiMatrix @@ -9,7 +11,11 @@ module CiMatrix changed_files = ChangedFiles.collect(tap) ruby_files_in_wrong_directory = - changed_files[:modified_ruby_files] - (changed_files[:modified_cask_files] + changed_files[:modified_command_files] + changed_files[:modified_github_actions_files]) + changed_files[:modified_ruby_files] - ( + changed_files[:modified_cask_files] + + changed_files[:modified_command_files] + + changed_files[:modified_github_actions_files] + ) if ruby_files_in_wrong_directory.any? ruby_files_in_wrong_directory.each do |path| @@ -35,17 +41,16 @@ module CiMatrix audit_args = ["--download", appcast_arg, "--online"] - if changed_files[:added_files].include?(path) - audit_args << "--new-cask" - end + audit_args << "--new-cask" if changed_files[:added_files].include?(path) { - name: "test (#{cask.token})", - cask: { + name: "test (#{cask.token})", + tap: tap.name, + cask: { token: cask.token, path: "./#{path}", }, - audit_args: audit_args, + audit_args: audit_args, skip_install: labels.include?("ci-skip-install"), } end diff --git a/cmd/lib/generate-matrix.rb b/cmd/lib/generate-matrix.rb index 829018ba2e..b9e73e1688 100755 --- a/cmd/lib/generate-matrix.rb +++ b/cmd/lib/generate-matrix.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require "utils/github" @@ -13,6 +13,7 @@ tap = Tap.from_path(Dir.pwd) syntax_job = { name: "syntax", + tap: tap.name, } matrix = [syntax_job] diff --git a/developer/bin/cask-pr-inspect-download b/developer/bin/cask-pr-inspect-download index a49a2c036e..f6da054999 100755 --- a/developer/bin/cask-pr-inspect-download +++ b/developer/bin/cask-pr-inspect-download @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require "json" require "open-uri" diff --git a/developer/bin/cask-pr-local-check b/developer/bin/cask-pr-local-check index ee7efb2805..cdc69e43a5 100755 --- a/developer/bin/cask-pr-local-check +++ b/developer/bin/cask-pr-local-check @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require "json" require "open-uri" diff --git a/developer/bin/find-appcast b/developer/bin/find-appcast index 35d31c2a97..0f9a2584b4 100755 --- a/developer/bin/find-appcast +++ b/developer/bin/find-appcast @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require "open3" require "pathname" diff --git a/developer/bin/generate_cask_token b/developer/bin/generate_cask_token index 5acc0ec017..0c5299be97 100755 --- a/developer/bin/generate_cask_token +++ b/developer/bin/generate_cask_token @@ -1,11 +1,11 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + # # generate_cask_token # # todo: # -# remove Ruby 2.0 dependency and change shebang line -# # detect Cask files which differ only by the placement of hyphens. # # merge entirely into "brew cask create" command @@ -34,7 +34,7 @@ EXPANDED_SYMBOLS = { "@" => "at", }.freeze -CASK_FILE_EXTENSION = ".rb".freeze +CASK_FILE_EXTENSION = ".rb" # Hardcode App names that cannot be transformed automatically. # Example: in "x48.app", "x48" is not a version number. @@ -357,10 +357,8 @@ def warnings return @warnings if @warnings @warnings = [] - unless APP_EXCEPTION_PATS.rassoc(cask_token) - if /\d/.match?(cask_token) - @warnings.push "WARNING: '#{cask_token}' contains digits. Digits which are version numbers should be removed." - end + if !APP_EXCEPTION_PATS.rassoc(cask_token) && /\d/.match?(cask_token) + @warnings.push "WARNING: '#{cask_token}' contains digits. Digits which are version numbers should be removed." end filename = project_root.join("Casks", cask_file_name) if filename.exist? diff --git a/developer/bin/list_login_items_for_app b/developer/bin/list_login_items_for_app index d3143766b5..ef4e016c26 100755 --- a/developer/bin/list_login_items_for_app +++ b/developer/bin/list_login_items_for_app @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + # # list_login_items_for_app # diff --git a/developer/bin/list_running_app_ids b/developer/bin/list_running_app_ids index 8bb3169cc3..4e210a22f4 100755 --- a/developer/bin/list_running_app_ids +++ b/developer/bin/list_running_app_ids @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + # # list_running_app_ids # @@ -100,7 +102,7 @@ def report_apps running.add "#{bundle_id.ljust($COLUMNS / 2)}\t#{app_name}" end - puts "bundle_id".ljust($COLUMNS / 2) + "\tapp_name" + puts "#{"bundle_id".ljust($COLUMNS / 2)}\tapp_name" puts "-" * $COLUMNS puts running.to_a.sort.join "\n" end