From de3b9a713157b9b1df32d975e0beadbd71a931ee Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:36:22 +0900 Subject: [PATCH 01/17] =?UTF-8?q?=F0=9F=90=9A=20chore:=20sh=20-c=20'git=20?= =?UTF-8?q?ignore=20sublimetext,vim,visualstudiocode,jetbrains+all,linux,o?= =?UTF-8?q?sx,windows=20|=20tee=20.gitignore'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 242 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 240 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 34a39ac..75173d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,240 @@ -# Folders to ignore -.vscode/ \ No newline at end of file + +# Created by https://www.toptal.com/developers/gitignore/api/sublimetext,vim,visualstudiocode,jetbrains+all,linux,osx,windows +# Edit at https://www.toptal.com/developers/gitignore?templates=sublimetext,vim,visualstudiocode,jetbrains+all,linux,osx,windows + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### JetBrains+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### SublimeText ### +# Cache files for Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# Workspace files are user-specific +*.sublime-workspace + +# Project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using Sublime Text +# *.sublime-project + +# SFTP configuration file +sftp-config.json +sftp-config-alt*.json + +# Package control specific files +Package Control.last-run +Package Control.ca-list +Package Control.ca-bundle +Package Control.system-ca-bundle +Package Control.cache/ +Package Control.ca-certs/ +Package Control.merged-ca-bundle +Package Control.user-ca-bundle +oscrypto-ca-bundle.crt +bh_unicode_properties.cache + +# Sublime-github package stores a github token in this file +# https://packagecontrol.io/packages/sublime-github +GitHub.sublime-settings + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# Support for Project snippet scope +.vscode/*.code-snippets + +# Ignore code-workspaces +*.code-workspace + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/sublimetext,vim,visualstudiocode,jetbrains+all,linux,osx,windows From 81583cdb614c95936cf942172b962786c5f7e4e3 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:36:54 +0900 Subject: [PATCH 02/17] =?UTF-8?q?=F0=9F=94=A8=20chore(shfmt):=20Initial=20?= =?UTF-8?q?setup=20of=20`EditorConfig`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4039ff1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false From 9d1a06f6278045f788e81997e032e5c9c067cefc Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:42:42 +0900 Subject: [PATCH 03/17] =?UTF-8?q?=F0=9F=94=A7=20chore(setup):=20Fill=20out?= =?UTF-8?q?=20``=20placeholders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 6 +++--- README.md | 4 ++-- action.yml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 763b8bf..34b6258 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: test-check: - name: runner / (github-check) + name: runner / rails_best_practices (github-check) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -19,7 +19,7 @@ jobs: test-pr-check: if: github.event_name == 'pull_request' - name: runner / (github-pr-check) + name: runner / rails_best_practices (github-pr-check) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -33,7 +33,7 @@ jobs: test-pr-review: if: github.event_name == 'pull_request' - name: runner / (github-pr-review) + name: runner / rails_best_practices (github-pr-review) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 646648d..eaa2e85 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ inputs: reviewdog_flags: description: 'Additional reviewdog flags' default: '' - ### Flags for ### + ### Flags for rails_best_practices ### locale: description: '-locale flag of misspell. (US/UK)' default: '' @@ -69,7 +69,7 @@ on: [pull_request] jobs: # TODO: change `linter_name`. linter_name: - name: runner / + name: runner / rails_best_practices runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/action.yml b/action.yml index 112cb6d..992168a 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ -name: 'TODO: Run with reviewdog' -description: 'TODO: 🐶 Run with reviewdog on pull requests to improve code review experience.' +name: 'Run rails_best_practices with reviewdog' +description: '🐶 Run rails_best_practices with reviewdog on pull requests to improve code review experience.' author: 'TODO: ' inputs: github_token: @@ -28,7 +28,7 @@ inputs: reviewdog_flags: description: 'Additional reviewdog flags' default: '' - ### Flags for ### + ### Flags for rails_best_practices ### locale: description: '-locale flag of misspell. (US/UK)' default: '' From b7027a56362870911643667d91212c55e9b81d82 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:43:21 +0900 Subject: [PATCH 04/17] =?UTF-8?q?=F0=9F=94=A7=20chore(setup):=20Fill=20out?= =?UTF-8?q?=20``=20placeholders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 992168a..47bce23 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ name: 'Run rails_best_practices with reviewdog' description: '🐶 Run rails_best_practices with reviewdog on pull requests to improve code review experience.' -author: 'TODO: ' +author: 'blooper05' inputs: github_token: description: 'GITHUB_TOKEN' From 4aeb932aea966623b0c7819854acb017e02ad5ae Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:50:53 +0900 Subject: [PATCH 05/17] =?UTF-8?q?=F0=9F=93=9D=20docs(readme):=20Replace=20?= =?UTF-8?q?`reviewdog/action-composite-template`=20with=20our=20repo=20nam?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index eaa2e85..7fd96e0 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ -# action-composite-template - - -[![Test](https://github.com/reviewdog/action-composite-template/workflows/Test/badge.svg)](https://github.com/reviewdog/action-composite-template/actions?query=workflow%3ATest) -[![reviewdog](https://github.com/reviewdog/action-composite-template/workflows/reviewdog/badge.svg)](https://github.com/reviewdog/action-composite-template/actions?query=workflow%3Areviewdog) -[![depup](https://github.com/reviewdog/action-composite-template/workflows/depup/badge.svg)](https://github.com/reviewdog/action-composite-template/actions?query=workflow%3Adepup) -[![release](https://github.com/reviewdog/action-composite-template/workflows/release/badge.svg)](https://github.com/reviewdog/action-composite-template/actions?query=workflow%3Arelease) -[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/reviewdog/action-composite-template?logo=github&sort=semver)](https://github.com/reviewdog/action-composite-template/releases) +# action-rails_best_practices + +[![Test](https://github.com/blooper05/action-rails_best_practices/workflows/Test/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3ATest) +[![reviewdog](https://github.com/blooper05/action-rails_best_practices/workflows/reviewdog/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Areviewdog) +[![depup](https://github.com/blooper05/action-rails_best_practices/workflows/depup/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Adepup) +[![release](https://github.com/blooper05/action-rails_best_practices/workflows/release/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Arelease) +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/blooper05/action-rails_best_practices?logo=github&sort=semver)](https://github.com/blooper05/action-rails_best_practices/releases) [![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr) ![github-pr-review demo](https://user-images.githubusercontent.com/3797062/73162963-4b8e2b00-4132-11ea-9a3f-f9c6f624c79f.png) @@ -61,7 +60,6 @@ inputs: ``` ## Usage - ```yaml name: reviewdog @@ -73,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: reviewdog/action-composite-template@v1 + - uses: blooper05/action-rails_best_practices@v1 with: github_token: ${{ secrets.github_token }} # Change reviewdog reporter if you need [github-check,github-pr-review,github-pr-check]. @@ -98,7 +96,7 @@ ref: https://help.github.com/en/articles/about-actions#versioning-your-action ### Lint - reviewdog integration -This reviewdog action template itself is integrated with reviewdog to run lints +This reviewdog action rails_best_practices itself is integrated with reviewdog to run lints which is useful for Docker container based actions. ![reviewdog integration](https://user-images.githubusercontent.com/3797062/72735107-7fbb9600-3bde-11ea-8087-12af76e7ee6f.png) From db78651619fc85f53b0efedb401fc21b6bf203c4 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:51:39 +0900 Subject: [PATCH 06/17] =?UTF-8?q?=F0=9F=94=A7=20chore(setup):=20Update=20b?= =?UTF-8?q?randing=20icon=20and=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 47bce23..5d2eb72 100644 --- a/action.yml +++ b/action.yml @@ -54,7 +54,6 @@ runs: INPUT_TOOL_NAME: ${{ inputs.tool_name }} # Ref: https://haya14busa.github.io/github-action-brandings/ -# TODO: update branding if you want. branding: - icon: 'check' - color: 'blue' + icon: 'check-circle' + color: 'red' From 33fa301427e4205bc4e8057736fbdbbb743cf0c0 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 19:52:25 +0900 Subject: [PATCH 07/17] =?UTF-8?q?=F0=9F=93=9D=20docs(readme):=20Replace=20?= =?UTF-8?q?`linter=5Fname`=20with=20ours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7fd96e0..baf273b 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,7 @@ inputs: name: reviewdog on: [pull_request] jobs: - # TODO: change `linter_name`. - linter_name: + rails_best_practices: name: runner / rails_best_practices runs-on: ubuntu-latest steps: From 542b342377af9c683812804984c7d7dbb8960a0f Mon Sep 17 00:00:00 2001 From: blooper05 Date: Thu, 2 Jun 2022 23:41:53 +0900 Subject: [PATCH 08/17] =?UTF-8?q?=E2=9C=A8=20feat:=20Initial=20implementat?= =?UTF-8?q?ion=20to=20run=20`rails=5Fbest=5Fpractices`=20with=20`reviewdog?= =?UTF-8?q?`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.yml | 3 +++ script.sh | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 5d2eb72..4ea800b 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,9 @@ runs: - uses: reviewdog/action-setup@v1 with: reviewdog_version: v0.14.1 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 - run: $GITHUB_ACTION_PATH/script.sh shell: bash env: diff --git a/script.sh b/script.sh index 37e663f..9ef0846 100755 --- a/script.sh +++ b/script.sh @@ -7,16 +7,14 @@ fi export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" -echo '::group::🐶 Installing misspell ... https://github.com/client9/misspell' -TEMP_PATH="$(mktemp -d)" -PATH="${TEMP_PATH}:$PATH" -wget -O - -q https://git.io/misspell | sh -s -- -b "${TEMP_PATH}" +echo '::group::🐶 Installing rails_best_practices ... https://github.com/flyerhzm/rails_best_practices' +gem install --no-document rails_best_practices echo '::endgroup::' -echo '::group:: Running misspell with reviewdog 🐶 ...' +echo '::group:: Running rails_best_practices with reviewdog 🐶 ...' # shellcheck disable=SC2086 -misspell -locale="${INPUT_LOCALE}" . | - reviewdog -efm="%f:%l:%c: %m" \ +rails_best_practices --without-color --silent . | + reviewdog -efm="%f:%l - %m" -efm="%-G%.%#" \ -name="linter-name (misspell)" \ -reporter="${INPUT_REPORTER}" \ -filter-mode="${INPUT_FILTER_MODE}" \ From 2bfe87a5c2c03d44a0ecd17bb30c2e4402595130 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 01:34:39 +0900 Subject: [PATCH 09/17] =?UTF-8?q?=E2=9C=85=20test:=20Update=20testdata=20t?= =?UTF-8?q?o=20be=20detected=20by=20`rails=5Fbest=5Fpractices`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 4 +++- testdata/app/models/user.rb | 5 +++++ testdata/subdir/text.md | 2 -- testdata/text.md | 5 ----- 4 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 testdata/app/models/user.rb delete mode 100644 testdata/subdir/text.md delete mode 100644 testdata/text.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34b6258..86b94a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,7 @@ jobs: reporter: github-check level: info locale: "US" + workdir: ./testdata/ test-pr-check: if: github.event_name == 'pull_request' @@ -29,7 +30,7 @@ jobs: reporter: github-pr-check level: warning locale: "US" - workdir: ./testdata/subdir/ + workdir: ./testdata/ test-pr-review: if: github.event_name == 'pull_request' @@ -44,6 +45,7 @@ jobs: reporter: github-pr-review level: error locale: "US" + workdir: ./testdata/ reviewdog_flags: -filter-mode=file -fail-on-error - name: check the exit code if: ${{ !success() }} diff --git a/testdata/app/models/user.rb b/testdata/app/models/user.rb new file mode 100644 index 0000000..c9c1049 --- /dev/null +++ b/testdata/app/models/user.rb @@ -0,0 +1,5 @@ +# refs. https://github.com/flyerhzm/rails_best_practices/blob/HEAD/spec/rails_best_practices/reviews/default_scope_is_evil_review_spec.rb#L12-L14 +# refs. https://github.com/flyerhzm/rails_best_practices/blob/HEAD/spec/rails_best_practices/reviews/protect_mass_assignment_review_spec.rb#L17-L18 +class User < ActiveRecord::Base + default_scope -> { order('created_at desc') } +end diff --git a/testdata/subdir/text.md b/testdata/subdir/text.md deleted file mode 100644 index 5b33346..0000000 --- a/testdata/subdir/text.md +++ /dev/null @@ -1,2 +0,0 @@ -Determinisitic result is important! - diff --git a/testdata/text.md b/testdata/text.md deleted file mode 100644 index 5025db8..0000000 --- a/testdata/text.md +++ /dev/null @@ -1,5 +0,0 @@ -Determinisitic result is important. - -colour # <= Check -locale - -langauge From adde6f3014fcb33c144929397192dcad15368379 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 10:45:37 +0900 Subject: [PATCH 10/17] =?UTF-8?q?=F0=9F=8E=A8=20style(actions):=20Unify=20?= =?UTF-8?q?workflow=20names=20in=20lower=20case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86b94a9..c200bf2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test +name: test on: push: branches: diff --git a/README.md b/README.md index baf273b..247d744 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # action-rails_best_practices -[![Test](https://github.com/blooper05/action-rails_best_practices/workflows/Test/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3ATest) +[![test](https://github.com/blooper05/action-rails_best_practices/workflows/test/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Atest) [![reviewdog](https://github.com/blooper05/action-rails_best_practices/workflows/reviewdog/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Areviewdog) [![depup](https://github.com/blooper05/action-rails_best_practices/workflows/depup/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Adepup) [![release](https://github.com/blooper05/action-rails_best_practices/workflows/release/badge.svg)](https://github.com/blooper05/action-rails_best_practices/actions?query=workflow%3Arelease) From 2951481799a601b71e6a4fdf90639516b9603e11 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 00:43:50 +0900 Subject: [PATCH 11/17] =?UTF-8?q?=E2=9C=A8=20feat:=20Add=20`tool=5Fname`?= =?UTF-8?q?=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ action.yml | 7 +++++-- script.sh | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 247d744..7d96319 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,9 @@ inputs: github_token: description: 'GITHUB_TOKEN' default: '${{ github.token }}' + tool_name: + description: 'Tool name to use for reviewdog reporter' + default: 'rails_best_practices' workdir: description: 'Working directory relative to the root directory.' default: '.' diff --git a/action.yml b/action.yml index 4ea800b..2ecdedb 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,9 @@ inputs: github_token: description: 'GITHUB_TOKEN' default: '${{ github.token }}' + tool_name: + description: 'Tool name to use for reviewdog reporter' + default: 'rails_best_practices' workdir: description: 'Working directory relative to the root directory.' default: '.' @@ -47,14 +50,14 @@ runs: # INPUT_ is not available in Composite run steps # https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611 INPUT_GITHUB_TOKEN: ${{ inputs.github_token }} + INPUT_TOOL_NAME: ${{ inputs.tool_name }} + INPUT_WORKDIR: ${{ inputs.workdir }} INPUT_LEVEL: ${{ inputs.level }} INPUT_REPORTER: ${{ inputs.reporter }} INPUT_FILTER_MODE: ${{ inputs.filter_mode }} INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }} INPUT_ESLINT_FLAGS: ${{ inputs.eslint_flags }} - INPUT_WORKDIR: ${{ inputs.workdir }} - INPUT_TOOL_NAME: ${{ inputs.tool_name }} # Ref: https://haya14busa.github.io/github-action-brandings/ branding: diff --git a/script.sh b/script.sh index 9ef0846..a291f92 100755 --- a/script.sh +++ b/script.sh @@ -15,7 +15,7 @@ echo '::group:: Running rails_best_practices with reviewdog 🐶 ...' # shellcheck disable=SC2086 rails_best_practices --without-color --silent . | reviewdog -efm="%f:%l - %m" -efm="%-G%.%#" \ - -name="linter-name (misspell)" \ + -name="${INPUT_TOOL_NAME}" \ -reporter="${INPUT_REPORTER}" \ -filter-mode="${INPUT_FILTER_MODE}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ From b40b682a53b3bc58267d02fe1e135945bfd1d01f Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 01:02:59 +0900 Subject: [PATCH 12/17] =?UTF-8?q?=E2=9C=A8=20feat:=20Add=20`rails=5Fbest?= =?UTF-8?q?=5Fpractices=5Fflags`=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 3 --- README.md | 4 ++-- action.yml | 6 +++--- script.sh | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c200bf2..0334ca7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,6 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-check level: info - locale: "US" workdir: ./testdata/ test-pr-check: @@ -29,7 +28,6 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-check level: warning - locale: "US" workdir: ./testdata/ test-pr-review: @@ -44,7 +42,6 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review level: error - locale: "US" workdir: ./testdata/ reviewdog_flags: -filter-mode=file -fail-on-error - name: check the exit code diff --git a/README.md b/README.md index 7d96319..509a5ff 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ inputs: description: 'Additional reviewdog flags' default: '' ### Flags for rails_best_practices ### - locale: - description: '-locale flag of misspell. (US/UK)' + rails_best_practices_flags: + description: 'rails_best_practices flags (rails_best_practices --without-color --silent . )' default: '' ``` diff --git a/action.yml b/action.yml index 2ecdedb..1ba9e0f 100644 --- a/action.yml +++ b/action.yml @@ -32,8 +32,8 @@ inputs: description: 'Additional reviewdog flags' default: '' ### Flags for rails_best_practices ### - locale: - description: '-locale flag of misspell. (US/UK)' + rails_best_practices_flags: + description: 'rails_best_practices flags (rails_best_practices --without-color --silent . )' default: '' runs: using: 'composite' @@ -57,7 +57,7 @@ runs: INPUT_FILTER_MODE: ${{ inputs.filter_mode }} INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }} INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }} - INPUT_ESLINT_FLAGS: ${{ inputs.eslint_flags }} + INPUT_RAILS_BEST_PRACTICES_FLAGS: ${{ inputs.rails_best_practices_flags }} # Ref: https://haya14busa.github.io/github-action-brandings/ branding: diff --git a/script.sh b/script.sh index a291f92..fa06b11 100755 --- a/script.sh +++ b/script.sh @@ -13,7 +13,7 @@ echo '::endgroup::' echo '::group:: Running rails_best_practices with reviewdog 🐶 ...' # shellcheck disable=SC2086 -rails_best_practices --without-color --silent . | +rails_best_practices --without-color --silent . ${INPUT_RAILS_BEST_PRACTICES_FLAGS} | reviewdog -efm="%f:%l - %m" -efm="%-G%.%#" \ -name="${INPUT_TOOL_NAME}" \ -reporter="${INPUT_REPORTER}" \ From 60ed6d6b3a83b4cad3ee6dee9c553f0e0494e396 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 11:39:33 +0900 Subject: [PATCH 13/17] =?UTF-8?q?=F0=9F=93=9D=20docs(readme):=20Add=20desc?= =?UTF-8?q?ription=20about=20this=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 509a5ff..b065202 100644 --- a/README.md +++ b/README.md @@ -10,17 +10,11 @@ ![github-pr-review demo](https://user-images.githubusercontent.com/3797062/73162963-4b8e2b00-4132-11ea-9a3f-f9c6f624c79f.png) ![github-pr-check demo](https://user-images.githubusercontent.com/3797062/73163032-70829e00-4132-11ea-8481-f213a37db354.png) -This is a template repository for -[reviewdog](https://github.com/reviewdog/reviewdog) action with release -automation based on [action composition](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action). -Click `Use this template` button to create your reviewdog action :dog:! +This action runs [rails_best_practices] with [reviewdog] on pull requests to improve +code review experience. -If you want to create your own reviewdog action from scratch without using this -template, please check and copy release automation flow. -It's important to manage release workflow and sync reviewdog version for all -reviewdog actions. - -This repo contains a sample action to run [misspell](https://github.com/client9/misspell). +[rails_best_practices]:https://github.com/flyerhzm/rails_best_practices +[reviewdog]:https://github.com/reviewdog/reviewdog ## Input From 6c4f9ecb7acb5dc7539bb59c5e89e9a15f86ff86 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 11:43:31 +0900 Subject: [PATCH 14/17] =?UTF-8?q?=F0=9F=93=9D=20docs(actions):=20Sync=20`i?= =?UTF-8?q?nput`=20section=20of=20`action.yml`=20with=20that=20of=20`READM?= =?UTF-8?q?E.md`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - action.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b065202..97ed1a4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ code review experience. ## Input - ```yaml inputs: github_token: diff --git a/action.yml b/action.yml index 1ba9e0f..c440939 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,7 @@ inputs: description: 'Report level for reviewdog [info,warning,error]' default: 'error' reporter: - description: 'Reporter of reviewdog command [github-check,github-pr-review].' + description: 'Reporter of reviewdog command [github-check,github-pr-review,github-pr-check].' default: 'github-check' filter_mode: description: | From b6fd8987f522039377748a879579a3887769f157 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 11:47:20 +0900 Subject: [PATCH 15/17] =?UTF-8?q?=F0=9F=93=9D=20docs(readme):=20Fix=20`Lin?= =?UTF-8?q?t`=20section,=20this=20is=20not=20a=20Docker=20container=20base?= =?UTF-8?q?d=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 97ed1a4..a16b053 100644 --- a/README.md +++ b/README.md @@ -91,16 +91,20 @@ ref: https://help.github.com/en/articles/about-actions#versioning-your-action ### Lint - reviewdog integration -This reviewdog action rails_best_practices itself is integrated with reviewdog to run lints -which is useful for Docker container based actions. +This reviewdog action itself is integrated with reviewdog to run lints +which is useful for [action composition] based actions. + +[action composition]:https://docs.github.com/en/actions/creating-actions/creating-a-composite-action ![reviewdog integration](https://user-images.githubusercontent.com/3797062/72735107-7fbb9600-3bde-11ea-8087-12af76e7ee6f.png) Supported linters: - [reviewdog/action-shellcheck](https://github.com/reviewdog/action-shellcheck) -- [reviewdog/action-hadolint](https://github.com/reviewdog/action-hadolint) +- [reviewdog/action-shfmt](https://github.com/reviewdog/action-shfmt) +- [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) - [reviewdog/action-misspell](https://github.com/reviewdog/action-misspell) +- [reviewdog/action-alex](https://github.com/reviewdog/action-alex) ### Dependencies Update Automation This repository uses [reviewdog/action-depup](https://github.com/reviewdog/action-depup) to update From d72d4aa9e38e7ff4d9ef513841ef42df512293e1 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 19:16:57 +0900 Subject: [PATCH 16/17] =?UTF-8?q?=F0=9F=93=9D=20docs(readme):=20Update=20d?= =?UTF-8?q?emo=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a16b053..c071fca 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/blooper05/action-rails_best_practices?logo=github&sort=semver)](https://github.com/blooper05/action-rails_best_practices/releases) [![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr) -![github-pr-review demo](https://user-images.githubusercontent.com/3797062/73162963-4b8e2b00-4132-11ea-9a3f-f9c6f624c79f.png) -![github-pr-check demo](https://user-images.githubusercontent.com/3797062/73163032-70829e00-4132-11ea-8481-f213a37db354.png) +![github-pr-review demo](https://user-images.githubusercontent.com/5299525/171834705-b2517107-e616-4289-8ed9-4e160164701c.png) +![github-pr-check demo](https://user-images.githubusercontent.com/5299525/171834709-130da062-3518-4b28-9a1c-24b58fe686b4.png) This action runs [rails_best_practices] with [reviewdog] on pull requests to improve code review experience. From 829bad6e95f08cfe0eac835c60b1df553fbe17f0 Mon Sep 17 00:00:00 2001 From: blooper05 Date: Fri, 3 Jun 2022 19:26:45 +0900 Subject: [PATCH 17/17] =?UTF-8?q?=F0=9F=91=B7=20ci(test):=20Use=20`filter?= =?UTF-8?q?=5Fmode`=20and=20`fail=5Fon=5Ferror`=20inputs=20instead=20of=20?= =?UTF-8?q?`reviewdog=5Fflags`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0334ca7..7f3bf77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,8 @@ jobs: reporter: github-pr-review level: error workdir: ./testdata/ - reviewdog_flags: -filter-mode=file -fail-on-error + filter_mode: file + fail_on_error: true - name: check the exit code if: ${{ !success() }} run: echo 'The previous step should fail' && exit 1