From 86a7814bdabe5582dc827b94ef1fbd23422bd390 Mon Sep 17 00:00:00 2001 From: Maximilian Downey Twiss Date: Mon, 13 Nov 2023 18:46:43 +1100 Subject: [PATCH] Convert workflows to use reviewdog, run rubocop on tree (#8939) --- .github/workflows/Markdown-lint.yml | 4 ++-- .github/workflows/Rubocop.yml | 9 ++++----- .github/workflows/ShellCheck.yml | 4 ++-- .github/workflows/YAMLlint.yml | 4 +--- .mdl_style.rb | 4 ++-- .rubocop.yml | 2 +- lib/buildsystems/qmake.rb | 1 - lib/package.rb | 6 +++--- packages/alive.rb | 12 +++++------- packages/pipewire.rb | 12 ++++++------ packages/ruby_rubocop.rb | 2 +- tools/json.rb | 4 ++-- 12 files changed, 29 insertions(+), 35 deletions(-) diff --git a/.github/workflows/Markdown-lint.yml b/.github/workflows/Markdown-lint.yml index b5ae48ff9..e5d0fe5f0 100644 --- a/.github/workflows/Markdown-lint.yml +++ b/.github/workflows/Markdown-lint.yml @@ -7,6 +7,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Markdown-lint - uses: bewuethr/mdl-action@v1 + uses: reviewdog/action-markdownlint@v0 with: - style-file: .mdl_style.rb + markdownlint_flags: '-s .mdl_style.rb' diff --git a/.github/workflows/Rubocop.yml b/.github/workflows/Rubocop.yml index e698a8e19..626802024 100644 --- a/.github/workflows/Rubocop.yml +++ b/.github/workflows/Rubocop.yml @@ -6,9 +6,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Rubocop - uses: satmandu/Octocop@v0.0.3 + - uses: ruby/setup-ruby@v1 with: - github_token: ${{ secrets.github_token }} - reporter: github-pr-check - rubocop_flags: "-l -c .rubocop.yml" + ruby-version: '3.2' + - name: Rubocop + uses: reviewdog/action-rubocop@v2 diff --git a/.github/workflows/ShellCheck.yml b/.github/workflows/ShellCheck.yml index 1e7f2e2c6..e84b14ec3 100644 --- a/.github/workflows/ShellCheck.yml +++ b/.github/workflows/ShellCheck.yml @@ -7,6 +7,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: ShellCheck - uses: ludeeus/action-shellcheck@master + uses: reviewdog/action-shellcheck@v1 with: - ignore_paths: ./tools/* + exclude: './tools/*' diff --git a/.github/workflows/YAMLlint.yml b/.github/workflows/YAMLlint.yml index 77226a075..5341b7e76 100644 --- a/.github/workflows/YAMLlint.yml +++ b/.github/workflows/YAMLlint.yml @@ -7,6 +7,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: YAMLLint - uses: ibiqlik/action-yamllint@v3 - with: - config_file: .yamllint.yml + uses: reviewdog/action-yamllint@v1 diff --git a/.mdl_style.rb b/.mdl_style.rb index 5c6d0e432..51329237d 100644 --- a/.mdl_style.rb +++ b/.mdl_style.rb @@ -1,6 +1,6 @@ all -rule 'MD003', :style => :atx -rule 'MD029', :style => :ordered +rule 'MD003', style: :atx +rule 'MD029', style: :ordered exclude_rule 'MD002' # We use HTML

tag as the top level header exclude_rule 'MD013' # Ignore 80 character line length limit. diff --git a/.rubocop.yml b/.rubocop.yml index a398f008d..8948dc3f7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ AllCops: NewCops: enable - TargetRubyVersion: 3.1 + TargetRubyVersion: 3.2 Exclude: - 'lib/docopt.rb' diff --git a/lib/buildsystems/qmake.rb b/lib/buildsystems/qmake.rb index 342b5b12e..afe247295 100644 --- a/lib/buildsystems/qmake.rb +++ b/lib/buildsystems/qmake.rb @@ -1,7 +1,6 @@ require 'package' class Qmake < Package - def self.build system 'qmake' system 'make' diff --git a/lib/package.rb b/lib/package.rb index 1720c51b2..678463745 100644 --- a/lib/package.rb +++ b/lib/package.rb @@ -254,7 +254,7 @@ class Package env = @crew_env_options_hash end - cmd_args = args # after removing the env hash, all remaining args must be command args + cmd_args = args # after removing the env hash, all remaining args must be command args make_threads = CREW_NPROC modded_make_cmd = false @@ -262,7 +262,7 @@ class Package unless cmd_args.grep(/-j[[:space:]]?[0-9]+/).any? if cmd_args.size == 1 # involve a shell if the command is passed in one single string - cmd_args = ['bash', '-c', cmd_args[0].sub(/^(make)\b/, "\\1 <<>>")] + cmd_args = ['bash', '-c', cmd_args[0].sub(/^(make)\b/, '\\1 <<>>')] modded_make_cmd = true elsif cmd_args[0] == 'make' cmd_args.insert(1, '<<>>') @@ -280,7 +280,7 @@ class Package rescue RuntimeError => e if modded_make_cmd && make_threads != 1 # retry with single thread if command is `make` and is modified by crew - warn "Command \"#{cmd_args.map { |arg| arg.sub('<<>>', "-j#{make_threads}") } .join(' ')}\" failed, retrying with \"-j1\"...".yellow + warn "Command \"#{cmd_args.map { |arg| arg.sub('<<>>', "-j#{make_threads}") }.join(' ')}\" failed, retrying with \"-j1\"...".yellow make_threads = 1 retry else diff --git a/packages/alive.rb b/packages/alive.rb index 9168b836d..269171c07 100644 --- a/packages/alive.rb +++ b/packages/alive.rb @@ -9,18 +9,16 @@ class Alive < Autotools source_url 'https://ftpmirror.gnu.org/alive/alive-2.0.5.tar.lz' source_sha256 '94cf3dbffd9644405ed4944f94a7bb989674321607318c5a35d5fabc56a75089' - binary_url({ - }) - binary_sha256({ - }) + binary_url({}) + binary_sha256({}) depends_on 'guile' # R depends_on 'inetutils' # L def self.preflight - puts "You need to be in the VT-2 shell for the install of alive to work.".lightblue - puts "Make sure you have used Ctrl-Alt-{F2/Right arrow/Refresh} to switch to VT-2.".lightblue + puts 'You need to be in the VT-2 shell for the install of alive to work.'.lightblue + puts 'Make sure you have used Ctrl-Alt-{F2/Right arrow/Refresh} to switch to VT-2.'.lightblue puts "Then login as 'chronos' and install alive with 'crew install alive'.".lightblue - puts "You can then switch back to your regular Chromeos windows with Ctrl-Alt-{F1/Left arrow}.".lightblue + puts 'You can then switch back to your regular Chromeos windows with Ctrl-Alt-{F1/Left arrow}.'.lightblue end end diff --git a/packages/pipewire.rb b/packages/pipewire.rb index b122a7c14..ecb27b41b 100644 --- a/packages/pipewire.rb +++ b/packages/pipewire.rb @@ -4,12 +4,12 @@ class Pipewire < Package description 'PipeWire is a project that aims to greatly improve handling of audio and video under Linux.' homepage 'https://pipewire.org' version = if Gem::Version.new(CREW_KERNEL_VERSION.to_s) < Gem::Version.new('3.9') - '0.3.29' - elsif Gem::Version.new(CREW_KERNEL_VERSION.to_s) <= Gem::Version.new('5.4') - '0.3.60' - else - '0.3.84' - end + '0.3.29' + elsif Gem::Version.new(CREW_KERNEL_VERSION.to_s) <= Gem::Version.new('5.4') + '0.3.60' + else + '0.3.84' + end compatibility 'all' license 'LGPL-2.1+' source_url 'https://gitlab.freedesktop.org/pipewire/pipewire.git' diff --git a/packages/ruby_rubocop.rb b/packages/ruby_rubocop.rb index 258e2471a..ff04e7ea9 100644 --- a/packages/ruby_rubocop.rb +++ b/packages/ruby_rubocop.rb @@ -9,7 +9,7 @@ class Ruby_rubocop < Package version '1.57.2-ruby-3.2' compatibility 'all' source_url 'https://github.com/chromebrew/chromebrew/raw/master/.rubocop.yml' - source_sha256 'bfbed91f5e939d498da3619f8df7e9854c15df8b8eb29ebc052809b14d64c851' + source_sha256 '3942911bbee4c316617fa78825160726a398737db9a6085c743c9477acd55222' depends_on 'libyaml' depends_on 'ruby' diff --git a/tools/json.rb b/tools/json.rb index 7bbe59bf2..9a4f1542a 100644 --- a/tools/json.rb +++ b/tools/json.rb @@ -6,12 +6,12 @@ $LOAD_PATH.unshift '../lib' require_relative '../lib/const' require_relative '../lib/package' -output = Array.new +output = [] Dir.glob('../packages/*.rb').each do |filename| pkg = Package.load_package(filename) next if pkg.is_fake? - output << {name: File.basename(filename, '.rb').gsub("_","-"), description: pkg.description, homepage: pkg.homepage, version: pkg.version, license: pkg.license, compatibility: pkg.compatibility} + output << { name: File.basename(filename, '.rb').gsub('_', '-'), description: pkg.description, homepage: pkg.homepage, version: pkg.version, license: pkg.license, compatibility: pkg.compatibility } end File.write('repology.json', JSON.generate(output))