-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Replace nested conditional with guard clauses #8294
Replace nested conditional with guard clauses #8294
Conversation
If you're willing to, the first two lines could be squashed as well: - page = context.registers[:page]
- site = context.registers[:site]
+ page, site = context.registers.values_at(:page, :site) |
It makes sense. We don't need to refer to twice |
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.
LGTM!
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.
❤️
@jekyllbot: merge +fix |
Thank you @torrocus |
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.
site.in_source_dir
lib/jekyll/tags/include.rb
Outdated
@@ -252,21 +252,21 @@ def tag_includes_dirs(context) | |||
Array(page_path(context)).freeze | |||
end | |||
|
|||
private | |||
|
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.
Ok
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.
lib/jekyll/tags/include.rb
This is refactoring.
Summary
I wanted to remove the
lib/jekyll/tags/include.rb
file from the exclusion list in.rubocop_todo.yml
.But when I looked there, I did a little refactoring.
Now this code is more readable.
Context
It isn't related to any GitHub issue.
The functionality is the same.