From 948ab8604b62f8855d97c8d0c13f89e76bbef953 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Sun, 29 May 2022 10:20:33 +0200 Subject: [PATCH] Run rubocop via Rakefile --- .github/workflows/rubocop.yml | 4 +--- Rakefile | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 4466c89..d442459 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -25,8 +25,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - # If running on a self-hosted runner, check it meets the requirements - # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners - name: Set up Ruby uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf with: @@ -38,7 +36,7 @@ jobs: - name: Rubocop run run: | bash -c " - bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif + bundle exec rake lint_github [[ $? -ne 2 ]] " diff --git a/Rakefile b/Rakefile index 24bf06e..5f6bced 100644 --- a/Rakefile +++ b/Rakefile @@ -14,3 +14,10 @@ require 'rubocop/rake_task' desc 'Run RuboCop' RuboCop::RakeTask.new(:lint) + +desc 'Run RuboCop for GitHub' +RuboCop::RakeTask.new(:lint_github) do |t| + t.requires << 'code_scanning' + t.formatters << 'CodeScanning::SarifFormatter' + t.options << '-o' << 'rubocop.sarif' +end