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
Errors thrown from Layout/BlockAlignment
cop when running with ruby-head
#10258
Comments
Can you please add some minimal reproduction code? |
I am unable to repro locally as ruby 3.1.0 is not supported on my operating system (osx), but it would be something like
|
This may have encountered Ruby 3.1 incompatibilities. RuboCop 1.22.3 or newer resolve this issue. Can you upgrade to RuboCop 1.22.3 or newer? |
@koic We cannot, as our helper library currently supports Ruby v2.4+ |
If this is a CI issue, could you setup a different gemfile for different ruby versions? Keep 2.4 on the older RuboCop version and use a newer version for other versions. This would be slightly non-trivial because you might end up needing .rubocop.yml changes for different RuboCop versions, but it is doable. |
Alternatively, you can disable # Prevents Ruby 3.1 incompatibility error. You can enable this cop when Ruby 2.4 support is dropped.
# See https://github.com/rubocop/rubocop/issues/10258
Layout/BlockAlignment:
Enabled: false |
`undefined method `op_asgn_type?'` error is occured on Ruby 3.1 c.f. rubocop/rubocop#10258 (comment)
It's actual with Ruby 3.1 :( Without Ruby 2.4 support. |
`undefined method `op_asgn_type?'` error is occured on Ruby 3.1 c.f. rubocop/rubocop#10258 (comment)
While backwards compatibility is great, I just want to mention that Ruby 2.4's official end-of-life was nearly 2 years ago, with 2.6's end-of-life coming up this month. |
The runtime Ruby version and analysis Ruby version code are different. For example, RuboCop should be able to analysis Ruby 2.4 code using Ruby 3.1 runtime. I've opened #10632. |
…ersion: 2.4` Fixes rubocop#10258 and reverts part of rubocop#9648. Only the Ruby version (2.4) to runtime should have been dropped, not code analysis. This PR makes Ruby 2.4 code analysis with `TargetRubyVersion: 2.4`. So, this keeps it compatible with `TargetRubyVersion` up to RuboCop 1.12.1 as semver. It aims to solve essentially the same problem as rubocop#10626.
… 2.4` Fixes #10258 and reverts part of #9648. Only the Ruby version (2.4) to runtime should have been dropped, not code analysis. This PR makes Ruby 2.4 code analysis with `TargetRubyVersion: 2.4`. So, this keeps it compatible with `TargetRubyVersion` up to RuboCop 1.12.1 as semver. It aims to solve essentially the same problem as #10626.
The specified Rubocop version was quite old. Running the specs against Ruby 3.1 isn't possible without upgrading due to [this issue](rubocop/rubocop#10258).
Running Rubocop < 1.22.3 on Ruby v3.1 generates `An error occurred while Layout/BlockAlignment cop was inspecting` error. This fixes the error by bumping standard to the latest version which also updates Rubocop version, as suggested in rubocop/rubocop#10258
When running rubocop 1.12.1 with ruby 3.2.2, it appears below error An error occurred while Layout/BlockAlignment cop was inspecting /lkp/lkp-tests/stats/proc-vmstat:3:0. undefined method `op_asgn_type?' for [s(:block, s(:send, s(:gvar, :$stdin), :each_line), s(:args, s(:arg, :line)), This requires to have higher version of rubocop. Link: rubocop/rubocop#10258 Signed-off-by: Philip Li <philip.li@intel.com>
Our rubocop linter started erroring suddenly yesterday during our daily CRON build when testing against
ruby-head
via GitHub Actions.Expected behavior
Expected rubocop to exit with success, like in the last successful build. No changes have been introduced to the codebase since this run.
Actual behavior
ruby-head
build failure with debug output enabled. The output has been copied below:RuboCop version
The text was updated successfully, but these errors were encountered: