Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard action Ruby version is different from application Ruby #9

Open
willtcarey opened this issue Mar 8, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@willtcarey
Copy link

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:

  • Our app is configured to run in Ruby 2.7 (but could be 3.0, 3.1, etc)
  • The standardrb action that Github Actions runs is hardcoded to be run from Ruby 3.2.2
    FROM ruby:3.2.2-alpine

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

  • Version v0.0.5

Workflow File

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: StandardRB Linter
        uses: standardrb/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          USE_BUNDLE_VERSION: true
@willtcarey willtcarey added the bug Something isn't working label Mar 8, 2024
parndt added a commit to parndt/standard-ruby-action that referenced this issue May 30, 2024
I noticed while investigating standardrb#9 that the Ruby version is hardcoded.

In lieu of fixing that just yet I thought I could at least bring it up to date.
@searls
Copy link
Contributor

searls commented Jun 17, 2024

@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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants