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
Bump Rubocop to v0.48 #5997
Bump Rubocop to v0.48 #5997
Conversation
IMO an array of symbols read better when the constituent entries appear to to be symbols (e.g. [:label, :type] instead of %i(label type))
This cop recommends using sqiggly-heredocs (`<<~`) -- a Ruby 2.3 feature or otherwise depend on external libraries like Activesupport, Powerpack, or Unindent. The better alternative is to disable this cop for as long as we support Rubies older than v2.3 Ref: rubocop/rubocop#4028
@jekyll/ecosystem |
All of the tests are failing |
@@ -138,6 +138,8 @@ Style/StringLiterals: | |||
EnforcedStyle: double_quotes | |||
Style/StringLiteralsInInterpolation: | |||
EnforcedStyle: double_quotes | |||
Style/SymbolArray: | |||
Enabled: false |
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.
This is an opinion and not a fact, this needs to be shipped as a unique pull request for everyone else to comment.
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.
Agreed.
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.
this needs to be shipped as a unique pull request for everyone else to comment.
This PR will ship with this cop disabled
in line with behavior from 0.47.1
It can enabled
via a dedicated PR
@@ -106,7 +106,7 @@ def siteify_file(file, overrides_front_matter = {}) | |||
front_matter = { | |||
"title" => title, | |||
"permalink" => "/docs/#{slug}/", | |||
"note" => "This file is autogenerated. Edit /#{file} instead." | |||
"note" => "This file is autogenerated. Edit /#{file} instead.", |
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.
This is not the Ruby way. This is the Go way.
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.
We follow this style at Jekyll since last few releases of Rubocop
lib/jekyll/utils.rb
Outdated
@@ -139,7 +139,7 @@ def parse_date(input, msg = "Input could not be parsed.") | |||
# Returns true if the YAML front matter is present. | |||
# rubocop: disable PredicateName | |||
def has_yaml_header?(file) | |||
!!(File.open(file, "rb", &:readline) =~ %r!\A---\s*\r?\n!) | |||
!File.open(file, "rb", &:readline) !~ %r!\A---\s*\r?\n! |
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.
You still have a !
so this change does nothing but superficially confuse the user. !!
is straight forward and easy to spot from the get-go, where as !
then later !~
is confusing, without a significant performance improvement, this suites nothing.
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.
The changes in this commit was made by rubocop -a
I'm investigating.. 😭 |
…ds cop This reverts commit 1a00f8f and additionally disables InverseMethods StyleCop
Many bugfixes have been applied following the release of v0.48. Check if those buggfixes apply to our failing tests.
Note: Will remove the last two temporary commits as and when associated issues have been resolved elsewhere. Labelled |
Gemfile
Outdated
@@ -25,9 +25,9 @@ group :test do | |||
gem "nokogiri" | |||
gem "rspec" | |||
gem "rspec-mocks" | |||
gem "rubocop", "~> 0.47.1" | |||
gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__)) | |||
gem "rubocop", :git => "https://github.com/smakagon/rubocop", :branch => "4227_ambiguous_block_association_false_positive" |
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.
Clearly we don't want to merge this.
The |
Removed the temporary patch commit from a fork of Rubocop, which has been merged into Rubocop's |
Gemfile
Outdated
@@ -25,7 +25,7 @@ group :test do | |||
gem "nokogiri" | |||
gem "rspec" | |||
gem "rspec-mocks" | |||
gem "rubocop", :git => "https://github.com/bbatsov/rubocop" | |||
gem "rubocop", "~> 0.48.1" |
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.
👍
ping @pathawks requesting a re-review 😃 |
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.
Some comments/questions/concerns!
Style/IndentationWidth: | ||
Severity: error | ||
Style/InverseMethods: | ||
Enabled: false |
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.
What is this?
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.
} | ||
assert_nil( | ||
@files.find { |doc| doc.relative_path == "_slides/non-outputted-slide.html" } | ||
) |
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.
What about
assert_nil @files.find do |doc|
...
end
Or does it complain about not having parentheses?
refute_nil( | ||
@site.posts.index do |post| | ||
post.relative_path == "_posts/2017-2-5-i-dont-like-zeroes.md" | ||
end |
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 in all these cases what we should do is pull out the method with the block, or use a unified helper (i thought we had one?):
post_of_interest = @site.posts.find {|post| post.relative_path == "_posts/2017-2-5-i-dont-like-zeroes.md" }
refute_nil post_of_interest
or, with a helper method
refute_nil find_by(:relative_path, "_posts/2017-2-5-i-dont-like-zeroes.md", @site.posts)
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.
❤️ the helper method idea. Tackle in another PR?
@jekyllbot: merge +dev |
This was disabled in #5997 because it was new to Rubocop. I think it can be enabled now.
Fixes #5992, fixes #6005
WIPRubocop
0.48
introduced some new cops that broke our tests. While we temporarily locked to the previous version0.47.1
, this pull will remove the lock to bump Rubocop tov0.48
and beyond.Lets discuss if the fixes proposed here are acceptable.
The remaining catches appear to me as
bugs
in Rubocop-0.48