Tobias Erdle's Blog

Development Engineer working with different technologies. Former Jakarta MVC & Eclipse Krazo Committer. All views are my own.

Github: erdlet | E-Mail: blog (at) erdlet (punkt) de

TIL: Exclude vendor directory from rubocop to avoid GitHub Actions problem

I spent now a few hours debugging my GitHub Actions Workflow which actually had a lot of trouble running rubocop (and PostgreSQL for tests, but that's another topic) because it tried to use the rubocop-discourse plugin which I don't need since I'm not using discourse. Anyway, I tried nearly everything and after excluding the vendor directory from rubocop, everything worked. I'm really not sure why this happens, but I want to share this in case someone else runs into the same trouble.

Finally the working .rubocop.yml contains the following exclusions for all cops:

AllCops:
  NewCops: enable
  Exclude:
    - "db/**/*"
    - "config/**/*"
    - "script/**/*"
    - "bin/**/*"
    - "vendor/**/*"

Also, this is the section I use inside my GitHub Actions manifest:

lint:
  runs-on: ubuntu-latest
  steps:
    - name: Checkout code
      uses: actions/checkout@v3
    - name: Install Ruby and gems
      uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
    - name: Security audit dependencies
      run: bundle exec bundler-audit --update
    - name: Security audit application code
      run: bundle exec brakeman -q -w2
    - name: Lint Ruby files
      run: bundle exec rubocop --parallel