Skip to content

luizfonseca/github-actions-rubocop

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Action: Rubocop

Lint your Ruby code in parallel to your builds.

How it works

  • A Dockerfile with the following gems runs a rubocop check on your codebase using:
    • rubocop -v 1.63.4
    • rubocop-rspec -v 2.29.2
    • rubocop-performance -v 1.21.0
    • rubocop-rails -v 2.24.1
  • Errors are then reported per-line on the PR's checks tab.

Versions are fixed to avoid breaking changes on the gems. If you want to update the versions, you can do so by changing the Dockerfile in the repository and opening a PR to update the action.

Configuration

In order to run all the checks, you need to have a .rubocop.yml file in your repository. You can generate one by running rubocop --auto-gen-config on your project's root. This is optional, but it is recommended to have one to customize the checks to your project's needs.

In case no configuration is found, the action will use the default configuration file provided by the gems. For more information, check the rubocop documentation.

You can also customize the rubocop extensions that will run by adding the following to your .rubocop.yml file:

require:
  - rubocop-rspec
  - rubocop-performance
  - rubocop-rails

Supported Ruby versions

  • Ruby 3+ (older versions are supported on <=1.5.6 versions of this action)

Instructions

In order to use this action you will need to specify the $GITHUB_TOKEN alongside the check:

# Worflow example
name: CI
on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:

    - uses: actions/checkout@v1

    - name: Rubocop checks
        uses: luizfonseca/github-actions-rubocop@2.0.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

About

Github Action to Lint your Ruby code in parallel to your builds (Ruby 2+ and Ruby 3+)

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Ruby 85.6%
  • Dockerfile 13.3%
  • Shell 1.1%