mattbrictson/airbrussh

unsupported Ruby version 1.9 in `TargetRubyVersion` parameter (in vendor/bundle/ruby/3.3.0/gems/airbrussh-1.5.2/.rubocop.yml)

andrer0cha opened this issue · 3 comments

I have airbrush installed as a dependency from Capistrano.
It seems to be blocking my Github Actions because of this line.

My .rubocop.yml

require:
  - rubocop-rails
  - rubocop-rspec
  - rubocop-factory_bot
  - rubocop-capybara

AllCops:
  TargetRubyVersion:
  SuggestExtensions: false
  Exclude:
    - "db/schema.rb"
    - "package.json"
    - "yarn.lock"
    - "Procfile.dev"
    - "bin/*"
    - "package-lock.json"
    - "spec/support/helpers/auth_helper.rb"
  NewCops: enable

Style/StringLiterals:
  Enabled: true
  EnforcedStyle: single_quotes

Style/StringLiteralsInInterpolation:
  Enabled: true
  EnforcedStyle: single_quotes

Style/Documentation:
  Enabled: false

# Customize rules
Layout/LineLength:
  Enabled: false

Metrics/MethodLength:
  Max: 35

Metrics/AbcSize:
   Enabled: false

Metrics/BlockLength:
  Max: 70

RSpec/ExampleLength:
  Enabled: false

RSpec/NestedGroups:
  Enabled: false

RSpec/MultipleExpectations:
  Enabled: false

RSpec/EmptyExampleGroup:
  Exclude:
    - "spec/requests/**/*"

Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.3.0'
gem 'rails', '~> 7.2.0'

gem 'bootsnap', require: false
gem 'cancancan'
gem 'devise'
gem 'devise-jwt'
gem 'dry-initializer'
gem 'dry-initializer-rails'
gem 'graphql', '~> 2.3'
gem 'importmap-rails'
gem 'jbuilder'
gem 'jquery-rails', '~> 4.4'
gem 'nokogiri'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-google-oauth2'
gem 'omniauth-rails_csrf_protection'
gem 'pg'
gem 'puma', '~> 4.3.9'
gem 'redis', '~> 4.0'
gem 'rolify'
gem 'sassc-rails'
gem 'selenium-webdriver'
gem 'sprockets-rails'
gem 'stimulus-rails'
gem 'toastr-rails'
gem 'turbo-rails'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'vite_rails'

group :development do
  gem 'capistrano',         require: false
  gem 'capistrano3-puma',   require: false
  gem 'capistrano-bundler', require: false
  gem 'capistrano-rails',   require: false
  gem 'capistrano-rbenv',   require: false
  gem 'graphiql-rails'
  gem 'letter_opener'
end

group :development, :test do
  gem 'cpf_faker'
  gem 'factory_bot'
  gem 'factory_bot_rails'
  gem 'faker'
  gem 'overcommit'
  gem 'pry-byebug'
  gem 'rspec'
  gem 'rspec-rails'
  gem 'rubocop'
  gem 'rubocop-capybara'
  gem 'rubocop-factory_bot'
  gem 'rubocop-rails'
  gem 'rubocop-rspec'
  gem 'rubocop-rspec_rails'
  gem 'shoulda-matchers', '~> 5.0'
  gem 'test-prof', '~> 1.2'
end

Github actions:

name: CI
on: push

jobs:
  rubocop:
    name: Rubocop
    runs-on: ubuntu-latest # Informa o SO que será usado nos testes
    steps:
      # Pega o código do projeto
      - name: Checkout code
        uses: actions/checkout@v4

      # Configura o Ruby e instala as dependências
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true

      # Executa o Rubocop
      - name: Lint code
        run: bundle exec rubocop

  rspec:
    name: RSpec
    needs: rubocop
    runs-on: ubuntu-20.04
    env:
      RAILS_ENV: test
      DATABASE_URL: postgres://postgres:example@localhost:5432/db_test
    services:
      postgres:
        image: postgres:latest
        ports: ['5432:5432']
        env:
          POSTGRES_DB: db_test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: example
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true

      - name: Install postgres client dependencies
        run: sudo apt-get install libpq-dev

      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: 20.6.0

      - name: NPM package cache
        uses: actions/cache@v4
        with:
          path: ./node_modules
          key: ${{ runner.os }}-npm-v1-${{ hashFiles('./npm.lock') }}

      - name: Install NPM packages
        run: npm install --pure-lockfile

      - name: Create database
        run: |
          bundle exec rails db:create
          # Se o projeto usar `schema.rb`
          bundle exec rails db:schema:load
          # Se o projeto usar `structure.sql`
          bundle exec rails db:structure:load
          # Se o projeto não usar nenhum dos dois
          bundle exec rails db:migrate

      - name: Run tests
        run: bundle exec rspec spec

Error message from failed pipeline:
Screenshot 2024-08-28 at 12 01 00

Interesting! Thanks for pointing this out.

One problem is that it doesn't really make sense for airbrussh to include its .rubocop.yml as part of the gem. That is an internal file that isn't meant to be published.

However I think the primary issue here is that your rubocop job is scanning the contents of vendor/bundle. In other words, your CI is trying to lint the source code of every one of your gem dependencies, which shouldn't be happening. Make sure you are excluding vendor/bundle in your own .rubocop.yml, by adding it under AllCopsExclude, like this:

AllCops:
  Exclude:
    - "vendor/**/*"

RuboCop's default config recommends excluding the following:

Exclude:
  - 'node_modules/**/*'
  - 'tmp/**/*'
  - 'vendor/**/*'
  - '.git/**/*'

https://github.com/rubocop/rubocop/blob/4a338bbd7d19ffb3875f429d3169aa91640790f5/config/default.yml#L65-L69

Since your config overrides the default Exclude values, you should make sure to explicitly add RuboCop's recommended values into your own config.

Thank you, I'm adding it to my Rubocop's exclude option :D

Closing in favor of #158