From 935c4194c68301f6ba28e3665e51c7190e14cb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20B=C3=A4lter?= Date: Mon, 11 Sep 2023 16:16:11 +0200 Subject: [PATCH 1/4] Allow passing arguments to rubocop --- action.yml | 5 ++++- rubocop.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index d5061ac..9771ed6 100644 --- a/action.yml +++ b/action.yml @@ -7,10 +7,13 @@ inputs: gem_versions: description: Gem versions to install default: rubocop:1.54.1 rubocop-rails:2.20.2 rubocop-rspec:2.22.0 + rubocop_args: + description: Arguments passed to rubocop cli + default: "" runs: using: composite steps: - - run: ruby $GITHUB_ACTION_PATH/rubocop.rb + - run: ruby $GITHUB_ACTION_PATH/rubocop.rb ${{ inputs.rubocop_args }} shell: bash env: GITHUB_TOKEN: ${{ inputs.github_token }} diff --git a/rubocop.rb b/rubocop.rb index ce9c77f..7a29453 100644 --- a/rubocop.rb +++ b/rubocop.rb @@ -36,7 +36,7 @@ # JSON reference: https://docs.rubocop.org/rubocop/formatters.html#json-formatter files_with_offenses = if changed_ruby_files.any? - command = "rubocop #{changed_ruby_files.map(&:path).join(' ')} --format json --force-exclusion" + command = "rubocop #{changed_ruby_files.map(&:path).join(' ')} --format json --force-exclusion #{ARGV.join(' ')}" puts "Running rubocop with: #{command}" JSON.parse(`#{command}`).fetch("files") From 7d0ca06d357f8440e7f0b0f35d6162622171884a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20B=C3=A4lter?= Date: Fri, 3 Nov 2023 10:08:40 +0100 Subject: [PATCH 2/4] Update readme --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 2e01e79..438c9f9 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,13 @@ Specifying `gem_versions` in the standard `gem install` format. with: gem_versions: rubocop:1.18.3 rubocop-rspec:2.0.0 rubocop-:1.2.0 ``` + +#### rubocop arguments + +You can pass arguments to rubocop. E.g. + +```yaml + - uses: reclaim-the-stack/rubocop-action@v1 + with: + rubocop_args: --config .rubocop.yml +``` From 6eba28a4646495627fd8f217bf7f42abbdd5832a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20B=C3=A4lter?= Date: Fri, 3 Nov 2023 14:28:21 +0100 Subject: [PATCH 3/4] args -> arguments --- README.md | 2 +- action.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 438c9f9..c08cc4f 100644 --- a/README.md +++ b/README.md @@ -61,5 +61,5 @@ You can pass arguments to rubocop. E.g. ```yaml - uses: reclaim-the-stack/rubocop-action@v1 with: - rubocop_args: --config .rubocop.yml + rubocop_arguments: --config .rubocop.yml ``` diff --git a/action.yml b/action.yml index 9771ed6..87c0c83 100644 --- a/action.yml +++ b/action.yml @@ -7,13 +7,13 @@ inputs: gem_versions: description: Gem versions to install default: rubocop:1.54.1 rubocop-rails:2.20.2 rubocop-rspec:2.22.0 - rubocop_args: + rubocop_arguments: description: Arguments passed to rubocop cli default: "" runs: using: composite steps: - - run: ruby $GITHUB_ACTION_PATH/rubocop.rb ${{ inputs.rubocop_args }} + - run: ruby $GITHUB_ACTION_PATH/rubocop.rb ${{ inputs.rubocop_arguments }} shell: bash env: GITHUB_TOKEN: ${{ inputs.github_token }} From 34ee430ebba927d91f9362f4e5183fcdb2caa158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20B=C3=A4lter?= Date: Fri, 3 Nov 2023 13:29:31 +0000 Subject: [PATCH 4/4] Better argument description Co-authored-by: David Backeus --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c08cc4f..a5f4bcd 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Specifying `gem_versions` in the standard `gem install` format. #### rubocop arguments -You can pass arguments to rubocop. E.g. +Allows you to pass additional arguments to rubocop. E.g. ```yaml - uses: reclaim-the-stack/rubocop-action@v1