diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 00000000..51a9e68d --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,40 @@ +name: Ensure Rubocop Passes + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby and install gems + uses: ./.github/actions/setup-ruby-deps + + - name: Restore Rubocop Cache + uses: actions/cache@v3 + with: + path: .rubocop_cache + key: rubocop-cache-${{ runner.os }}-${{ hashFiles('**/*.rb') }} + restore-keys: | + rubocop-cache-${{ runner.os }}- + + - name: Run Rubocop and Save Output + run: | + mkdir -p tmp + bundle exec rubocop --format progress | tee tmp/rubocop-output.txt + shell: bash + + - name: Upload Rubocop Report + uses: actions/upload-artifact@v4 + with: + name: rubocop-report + path: tmp/rubocop-output.txt + + - name: Save Rubocop Cache + uses: actions/cache@v3 + with: + path: .rubocop_cache + key: rubocop-cache-${{ runner.os }}-${{ hashFiles('**/*.rb') }} diff --git a/.rubocop.yml b/.rubocop.yml index c707ccd6..f93f6786 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ require: - rubocop - - rubocop-rails + inherit_from: .rubocop_todo.yml plugins: diff --git a/Gemfile.lock b/Gemfile.lock index 862db323..5ebb134b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -377,11 +377,11 @@ PLATFORMS aarch64-linux aarch64-linux-gnu aarch64-linux-musl - arm64-darwin-23 arm-linux arm-linux-gnu arm-linux-musl arm64-darwin + arm64-darwin-23 x86-linux x86-linux-gnu x86-linux-musl diff --git a/app/controllers/abbreviated_treatment_reports_controller.rb b/app/controllers/abbreviated_treatment_reports_controller.rb index 3810c1a8..b0341e50 100644 --- a/app/controllers/abbreviated_treatment_reports_controller.rb +++ b/app/controllers/abbreviated_treatment_reports_controller.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - class AbbreviatedTreatmentReportsController < ApplicationController def create @abbreviated_treatment_report = AbbreviatedTreatmentReport.new diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index bec845cf..4a14def4 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -9,10 +9,8 @@ options = Selenium::WebDriver::Chrome::Options.new # Force use of pinned Chrome binary if present (e.g., from GitHub Actions) - chrome_bin = ENV['CHROME_BIN'] - if chrome_bin && File.exist?(chrome_bin) - options.binary = chrome_bin - end + chrome_bin = ENV.fetch('CHROME_BIN', nil) + options.binary = chrome_bin if chrome_bin && File.exist?(chrome_bin) options.add_argument('--headless') options.add_argument('--disable-gpu')