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

ci: Error: RuboCop found unsupported Ruby version 2.4 #8649

Closed
kmk3 opened this issue Apr 20, 2021 · 0 comments · Fixed by #8651
Closed

ci: Error: RuboCop found unsupported Ruby version 2.4 #8649

kmk3 opened this issue Apr 20, 2021 · 0 comments · Fixed by #8651
Labels
frozen-due-to-age has-pull-request Somebody suggested a solution to fix this issue

Comments

@kmk3
Copy link
Contributor

kmk3 commented Apr 20, 2021

My Environment

Software Version(s)
Operating System Artix Linux
jekyll Latest
github-pages Latest

Expected Behaviour

When submitting a PR, style-check works.

From #8646 / https://github.com/jekyll/jekyll/runs/2386310191?check_suite_focus=true:

Log of the last ci job that worked
        +style-check | RUBY=2.5
        +style-check | --> RUN script/fmt
        +style-check | RuboCop 1.12.1
        +style-check | The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.

        +style-check | Please also note that can also opt-in to new cops by default by adding this to your config:
        +style-check |   AllCops:
        +style-check |     NewCops: enable
        +style-check | Minitest/AssertWithExpectedArgument: # (new in 0.11)
        +style-check |   Enabled: true
        +style-check | Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
        +style-check |   Enabled: true
        +style-check | Performance/RedundantSplitRegexpArgument: # (new in 1.10)
        +style-check |   Enabled: true
        +style-check | For more information: https://docs.rubocop.org/rubocop/versioning.html
        +style-check | Inspecting 134 files
        +style-check | ......................................................................................................................................

        +style-check | 134 files inspected, no offenses detected
              output | --> exporting outputs
=================================== SUCCESS ====================================

Current Behavior

style-check fails because rubocop dies.

From #8646 / https://github.com/jekyll/jekyll/runs/2394239794?check_suite_focus=true

Log of the first ci job that failed
        +style-check | RUBY=2.5
        +style-check | --> RUN script/fmt
        +style-check | RuboCop 1.13.0
        +style-check | Error: RuboCop found unsupported Ruby version 2.4 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after version 1.12.
        +style-check | Supported versions: 2.5, 2.6, 2.7, 3.0

        +style-check | Try running `script/fmt -a` to automatically fix errors
        +style-check | Command /bin/sh -c script/fmt failed with exit code 2
        +style-check | 
        +style-check | ERROR: Command exited with non-zero code: RUN script/fmt
Repeating the output of the command that caused the failure
================================ FAILURE [main] ================================
        +style-check *failed* | ERROR: Command exited with non-zero code: RUN script/fmt
        +style-check *failed* | RUBY=2.5
Error: bkClient.Build: failed to solve: executor failed running [/bin/sh -c  /usr/bin/earth_debugger /bin/sh -c 'script/fmt']: exit code: 2
        +style-check *failed* | --> RUN script/fmt
        +style-check *failed* | RuboCop 1.13.0
        +style-check *failed* | Error: RuboCop found unsupported Ruby version 2.4 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after version 1.12.
        +style-check *failed* | Supported versions: 2.5, 2.6, 2.7, 3.0

        +style-check *failed* | Try running `script/fmt -a` to automatically fix errors
        +style-check *failed* | Command /bin/sh -c script/fmt failed with exit code 2
        +style-check *failed* | 
Error: Process completed with exit code 1.

Key parts:

RuboCop 1.13.0

Error: RuboCop found unsupported Ruby version 2.4 in TargetRubyVersion
parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after
version 1.12.

Code Sample

$ bundle exec rubocop --version
1.13.0
$ bundle exec rubocop
Error: RuboCop found unsupported Ruby version 2.4 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after version 1.12.
Supported versions: 2.5, 2.6, 2.7, 3.0

Note: Jekyll dropping Ruby 2.4 had already been planned:

See also:

kmk3 added a commit to kmk3/jekyll that referenced this issue Apr 21, 2021
Rubocop 1.13 was released today (2021-04-20) and it has dropped support
for Ruby 2.4[1][2].  This causes rubocop to die on the spot when
trying to run it:

    $ bundle exec rubocop --version
    1.13.0
    $ bundle exec rubocop
    Error: RuboCop found unsupported Ruby version 2.4 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after version 1.12.
    Supported versions: 2.5, 2.6, 2.7, 3.0

And thus the "style_check" ci job is currently broken[3].

Rubocop 1.10 and 1.11 don't work either because of a rename:

    $ bundle exec rubocop
    Error: unrecognized cop Style/StringChars found in .rubocop.yml
    Did you mean `Style/StringMethods`?

Also, for some reason bundler installs rubocop 1.13 even with the
current "~> 1.10" specification.  This happens both on my machine (Artix
Linux; ruby 3.0.1p64; rubygems 3.2.15; bundler 2.2.16) and on GitHub
Actions (Ubuntu 20.04; ruby 2.5; rubygems ?; bundler 2.2.16)[3].

So pin rubocop to the 1.12 series using the usual >= and < operators.

Example of another project doing something similar: [4].

Fixes jekyll#8649.

[1] https://github.com/rubocop/rubocop/releases/tag/v1.13.0
[2] rubocop/rubocop#9648
[3] https://github.com/jekyll/jekyll/runs/2394239794?check_suite_focus=true
[4] Shopify/job-iteration#79
@jekyllbot jekyllbot added the has-pull-request Somebody suggested a solution to fix this issue label Apr 21, 2021
kmk3 added a commit to kmk3/jekyll that referenced this issue Apr 21, 2021
Rubocop 1.13 was released today (2021-04-20) and it has dropped support
for Ruby 2.4[1][2].  This causes rubocop to die on the spot when
trying to run it:

    $ bundle exec rubocop --version
    1.13.0
    $ bundle exec rubocop
    Error: RuboCop found unsupported Ruby version 2.4 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after version 1.12.
    Supported versions: 2.5, 2.6, 2.7, 3.0

And thus the "style_check" ci job is currently broken[3].

Rubocop 1.10 and 1.11 don't work either because of a rename:

    $ bundle exec rubocop
    Error: unrecognized cop Style/StringChars found in .rubocop.yml
    Did you mean `Style/StringMethods`?

So pin rubocop to the 1.12 series.

Example of another project doing something similar: [4].

Fixes jekyll#8649.

[1] https://github.com/rubocop/rubocop/releases/tag/v1.13.0
[2] rubocop/rubocop#9648
[3] https://github.com/jekyll/jekyll/runs/2394239794?check_suite_focus=true
[4] Shopify/job-iteration#79
kmk3 added a commit to kmk3/jekyll that referenced this issue Apr 23, 2021
Rubocop 1.13 was released today (2021-04-20) and it has dropped support
for Ruby 2.4[1][2].  This causes rubocop to die on the spot when
trying to run it:

    $ bundle exec rubocop --version
    1.13.0
    $ bundle exec rubocop
    Error: RuboCop found unsupported Ruby version 2.4 in `TargetRubyVersion` parameter (in .rubocop.yml). 2.4-compatible analysis was dropped after version 1.12.
    Supported versions: 2.5, 2.6, 2.7, 3.0

And thus the "style_check" ci job is currently broken[3].

Rubocop 1.10 and 1.11 don't work either because of a rename:

    $ bundle exec rubocop
    Error: unrecognized cop Style/StringChars found in .rubocop.yml
    Did you mean `Style/StringMethods`?

The latter and arguably the former are breaking changes on minor
versions, which means that rubocop does not follow semantic
versioning[4][5].  Additionally, the gem was already pinned on a minor
version on commit fe64d98 ("style: add rubocop 1.9 cops (jekyll#8567)"), but
commit c9c9dc7 ("chore(deps): rubocop 1.10") pinned it only on the
major version (see also issue jekyll#8583)[6].  This back-and-forth happened
more than once:

* 2016-10-18: nil         to "~> 0.44.1" on commit cc19728 ("Restrict Rubocop version")
* 2017-01-14: "~> 0.44.1" to "~> 0.46"   on commit 4432482 ("bump Rubocop to latest version")
* 2017-03-28: "~> 0.47"   to "~> 0.47.1" on commit 86703f1 ("Use Rubocop v0.47.1 till we're ready for v0.48")
* 2020-10-21: "~> 0.93.0" to "~> 1.0"    on commit 1ae2a1d ("Bump RuboCop to v1.x")
* 2021-01-31: "~> 1.0"    to "~> 1.8.1"  on commit d460fae ("Pin rubocop version (jekyll#8564)")
* 2021-02-19: "~> 1.9.1"  to "~> 1.10"   on commit c9c9dc7 ("chore(deps): rubocop 1.10")

The above can be checked with one of the following commands:

    $ tig '-G"rubocop"' -- Gemfile
    # or
    $ git log -p '-G"rubocop"' -- Gemfile

So pin rubocop back on a minor version: the 1.12 series.

Example of another project doing something similar (found on [2]):
Shopify/job-iteration[7].

Fixes jekyll#8649.

[1] https://github.com/rubocop/rubocop/releases/tag/v1.13.0
[2] rubocop/rubocop#9648
[3] jekyll#8649
[4] https://semver.org/
[5] rubocop/rubocop#4243
[6] https://guides.rubygems.org/patterns/#declaring-dependencies
[7] Shopify/job-iteration#79
@jekyll jekyll locked and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age has-pull-request Somebody suggested a solution to fix this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants