Skip to content

Bump rubocop to use v0.50.x#6368

Merged
jekyllbot merged 6 commits intojekyll:masterfrom
ashmaroli:bump-rubocop
Sep 22, 2017
Merged

Bump rubocop to use v0.50.x#6368
jekyllbot merged 6 commits intojekyll:masterfrom
ashmaroli:bump-rubocop

Conversation

@ashmaroli
Copy link
Copy Markdown
Member

Fixes #6367

Copy link
Copy Markdown
Member

@pathawks pathawks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to do this 🍻👍

urls_only_differ_by_case = false
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
urls.each do |_case_insensitive_url, real_urls|
urls.each_value do |real_urls|
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Copy link
Copy Markdown
Member

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! One code update suggestion and some thoughts on the configuration changes. Instead of turning them off, it might be better to exclude certain files if we decide that the rule is helpful (most are).

private
# rubocop:disable Performance/HashEachMethods
def make_accessible(hash = @config)
hash.keys.each do |key|
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use each_key here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each_key broke our test-suite..

Comment thread .rubocop.yml
Metrics/PerceivedComplexity:
Max: 8
Naming/FileName:
Enabled: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What fails for this one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From their docs,

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

and flags us for the following:
- 'Gemfile'
- 'Rakefile'
- 'lib/theme_template/Gemfile'
- 'test/fixtures/test-dependency-theme/test-dependency-theme.gemspec'
- 'test/fixtures/test-theme/test-theme.gemspec'

which IMO is a bug because this cop existed as an enabled-by-default-cop earlier known as Style/FileName

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... that looks like a bug. Weird.

Comment thread .rubocop.yml Outdated
Naming/FileName:
Enabled: false
Naming/HeredocDelimiterCase:
Enabled: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should enable this!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay.. I'll go with enforcing uppercase (default)

Comment thread .rubocop.yml
Naming/HeredocDelimiterCase:
Enabled: false
Naming/HeredocDelimiterNaming:
Enabled: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What fails for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 'features/support/helpers.rb'
  • 'test/test_redcarpet.rb'
  • 'test/test_tags.rb'

are flagged for presence of EOS as the delimiter

Comment thread .rubocop.yml
Style/DoubleNegation:
Enabled: false
Style/FileName:
Style/Encoding:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just exclude problematic files?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cop flags files that contain the following magic comment because from Ruby 2.0+, UTF-8 is the default source file encoding:

# encoding: UTF-8

So, IMO, we switch to when_needed if we're to enable the cop -- only enforce an encoding comment if there are non-ASCII chars

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do when_needed, then!

Comment thread .rubocop.yml
Lint/UselessAccessModifier:
Enabled: false
Lint/Void:
Enabled: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What even is this? 😂

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cop checks for the use of a return with a value in a context where it will be ignored.
In our case specifically, this cop (incorrectly ?) flags Site#config= similar to the documented example

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh we must return some value and it doesn't like that! We can enable it in a subsequent pass.

Comment thread .rubocop.yml
Lint/EndAlignment:
Severity: error
Lint/RescueWithoutErrorClass:
Enabled: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooo we should enable this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about it though, since unnamed rescue means rescuing StandardError by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but it's always better to rescue explicitly what you want to rescue instead of everything. We can do this in a subsequent pass.

Comment thread .rubocop.yml
Enabled: false
Layout/EndOfLine:
EnforcedStyle: lf
EnforcedStyle: native
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done we want lf here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, we do.. but if a developer on Windows were to run script/fmt they'd unnecessarily get taxed by Rubocop. In my own experience, it has been irritating..
A properly configured Git on Windows automatically indexes files compatible for cross-platform use.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pathawks
Copy link
Copy Markdown
Member

@jekyllbot: merge +dev

@jekyllbot jekyllbot merged commit 00bad8b into jekyll:master Sep 22, 2017
jekyllbot added a commit that referenced this pull request Sep 22, 2017
@ashmaroli ashmaroli deleted the bump-rubocop branch September 22, 2017 13:17
@jekyll jekyll locked and limited conversation to collaborators Jul 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update dependency constraint to allow for rubocop v0.50.0

5 participants