standardrb / standard-ruby-action

MIT License
12 stars 13 forks source link

Standard action Ruby version is different from application Ruby #9

Open willtcarey opened 8 months ago

willtcarey commented 8 months ago

Bug Report

Describe the bug

Standardrb action reports different linting errors then we get locally because of Ruby version mismatches.

To Reproduce

Steps to reproduce the behavior:

Locally we have code like the following which does not report a lint error.

def perform(*args)
  other_method(*args)
end

When standardrb runs in Github Actions this code does report a linting error because this violates Standard's rules in Ruby 3.2.

Expected behavior

We expect to be able to run standardrb from the version of Ruby specified in our application so that the linting errors will match.

Action Version & Workflow File

Workflow File

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: StandardRB Linter
        uses: standardrb/standard-ruby-action@v0.0.5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          USE_BUNDLE_VERSION: true
searls commented 5 months ago

@willtcarey if I understand you right, I think setting a .standard.yml with ruby_version: 2.7 should fix you. While RuboCop drops support for EOL'd rubies, Standard is designed (to the extent RuboCop will allow us) run the linter from newer rubies against older (very old, even 1.8.7) language targets. Give that a try?

https://github.com/standardrb/standard?tab=readme-ov-file#configuring-ruby_version

willtcarey commented 5 months ago

That's a great point. My Ruby version is actually stored in my Gemfile.lock so maybe I need to look into why Rubocop wasn't picking that up. What I wound up going with involved passing a ruby version argument to this action and using that version when installing Standard and running. It worked out alright, but I'd like to remove that complexity and have Standard/Rubocop pick up my Ruby version automatically like it should be able to.

main...brandnewbox:standard-ruby-action:main#diff-1243c5424e

willtcarey commented 5 months ago

But anyways, it's good to know that despite the Ruby version being hardcoded, the action should be able to check lesser Ruby versions