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
Use latest rubocop and target ruby 2.5 #40
Conversation
Since Puppetlabs only support Puppet 6+ now, I think we can even consider jumping to targeting Ruby 2.5 which is the version Puppet 6 use and has reached EOL only a few weeks ago? |
I'm starting to add Rubocop to theforeman modules and I'm running into this as well now. |
I agree, I think we should move forward with it |
Related Github formatter introduced in Rubocop 1.2: puppetlabs/puppetlabs_spec_helper#340 |
puppetlabs/puppetlabs_spec_helper#340 has been merged. Once there's a release out, it'd be great if this PR also raised the minimum spec helper version to that. |
This seems to have been released just after your message: |
Some extra motivation Puppetlabs now expect rubocop-performance to be present which needs newer rubocop. e.g. puppetlabs-inifile results in
|
Okay so with extra commit on top for even latest rubocop again and targeting ruby 2.5 traylenator@20b292c Ignored modules
Invalid config in module
Per module countse.g
Count of un-Correctable Critical problemse.g.
Count of un-Correctable Critical by modulee.g.
|
It is probably worth updating the PR title to match how this has evolved too. |
@traylenator looks like a move in the right direction. Do you mind adding your changes to this PR? Naming/HeredocDelimiterNaming and RSpec/* are the most frequent offenses. Maybe we can ignore them if this is a concern? |
@smortex unsure how to update this PR with my changes - short of creating a whole new PR ? |
@traylenator Are you able to push to this PR now? |
25de071
to
16a6ca4
Compare
Codecov Report
@@ Coverage Diff @@
## master #40 +/- ##
=======================================
Coverage 28.33% 28.33%
=======================================
Files 2 2
Lines 60 60
=======================================
Hits 17 17
Misses 43 43 Continue to review full report at Codecov.
|
51bec0f
to
15ad3aa
Compare
rubocop.yml
Outdated
TargetRubyVersion: 1.9 | ||
# Ruby 2.4 is the oldest version we can use with the latest version of rubocop (1.11.0 as of 13/03/2021). | ||
# Puppet agent 5 ships with ruby 2.4. Puppetserver 5 has JRuby 2.1.x which is only ruby 2.3 compatible, but this | ||
# is unlikely to cause many issues. If/when it does, we can disable the relevant cop inline as appropriate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a note that we chose Ruby 2.5 because that's in Puppet Agent 6 vendored and that's the oldest agent we still support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of date docs updated.
15ad3aa
to
e5fc4de
Compare
These are very high. Should we ignore these? |
I'm happy to create todo files so that we don't disable the cops for all future code too. |
Actually, I'm happy either way! :) |
Given it's test code and many Puppet developers are not Ruby developers, I'm leaning to disabling the cops. IMHO we're not going for perfect code quality so let's not set the bar too high. |
Updated. (but not tested!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. (but not tested!)
217 -> 123 offenses detected on WIP puppet-elasticsearch
FWIW, with more testing I am experiencing a lot of these:
Autocorrect fails at fixing these, and the manual fix is not that better IMHO: - end.empty?
+ end.
+ empty? Any multi-line block / hash followed by Maybe we can disable this test (Layout/DotPosition)? |
@smortex Rubocop bug fixed in rubocop/rubocop#10207 |
4.0.0 provides rubocop annotations in GitHub Actions. This version was tested in voxpupuli/puppet-wireguard#9.
It was decided that leaving these enabled word create too much unnecessary work.
c8cb454
to
7c0ad20
Compare
I will merge this now and make a new major release. If the rubocop config doesn't turn out be be useable/we experience trouble we've always the option to adjust it. |
Thanks for merging - was offline a couple of weeks. |
No description provided.