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

Cookstyle not detecting some bad Ruby Syntax #733

Closed
kmf opened this issue Sep 1, 2020 · 3 comments
Closed

Cookstyle not detecting some bad Ruby Syntax #733

kmf opened this issue Sep 1, 2020 · 3 comments

Comments

@kmf
Copy link

kmf commented Sep 1, 2020

Description

Chef Workstation 20.8.125 - cookstyle doesn't detect some Ruby stuff

Chef Workstation Version

Chef Workstation 20.8.125
was working with Chef Workstation 20.6.62

Platform Version

MacOS 10.15.6

Test Code

# execute 'run_me' do
  command 'somefile.sh'
end

Current output

Chef Workstation 20.8.125 - Cookstyle 6.15.5, RuboCop 0.89.1

Inspecting 1 file
.

1 file inspected, no offenses detected

Expected output

Chef Workstation 20.6.62 - Cookstyle 6.7.3, RuboCop 0.85.0

Inspecting 1 file
E

Offenses:

test.rb:3:1: E: Lint/Syntax: unexpected token kEND
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops)
end
^^^

1 file inspected, 1 offense detected
@tyler-ball tyler-ball transferred this issue from chef/chef-workstation Sep 2, 2020
@tyler-ball
Copy link
Contributor

Thanks @kmf - I moved this issue over to the Cookstyle repo

@tas50
Copy link
Contributor

tas50 commented Sep 2, 2020

I noticed this the other day. Something changed in Rubocop itself and I need to track that down.

@tas50
Copy link
Contributor

tas50 commented Sep 3, 2020

This is fixed in #735

I checked out an old release with an older RuboCop and this cop was running even though we have it disabled. In newer releases it doesn't run. I just enabled it in our config, which is what we should have had from the start. Thanks for the report @kmf

@tas50 tas50 closed this as completed Sep 3, 2020
tas50 added a commit to chef/chef-workstation that referenced this issue Sep 3, 2020
Cookstyle was no longer detecting bad ruby syntax due to a change (fix?)
in the RuboCop engine. This is one of the most useful parts of cookstyle
so this is a pretty major regression

See chef/cookstyle#733

Treetop was monkeypatching String.blank? which was breaking the usage of
Ruby's implementation by Cookstyle/RuboCop. This was causing:

rubocop/rubocop#8636

Signed-off-by: Tim Smith <tsmith@chef.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants