-
Notifications
You must be signed in to change notification settings - Fork 328
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
Fix archive tag bug #2031
Fix archive tag bug #2031
Conversation
|
||
Jekyll::Hooks.register :posts, :pre_render do |post| | ||
tags = post.data['tags'] || [] | ||
if tags.any? |
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.
Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
|
||
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.
Extra blank line detected.
# end | ||
# hash | ||
# 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.
Extra empty line detected at block body end.
|
||
Jekyll::Hooks.register :site, :pre_render do |site| | ||
tags = {} | ||
consolidated_arr = [] |
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.
Useless assignment to variable - consolidated_arr.
|
||
|
||
Jekyll::Hooks.register :site, :pre_render do |site| | ||
tags = {} |
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.
Useless assignment to variable - tags.
end | ||
|
||
|
||
Jekyll::Hooks.register :site, :pre_render do |site| |
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.
Unused block argument - site. You can omit the argument if you don't care about it.
|
||
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.
Extra blank line detected.
|
||
def clean_tag(tag) | ||
tag.gsub(/[^0-9A-Za-z]/, ' ').squeeze | ||
|
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.
Extra empty line detected at method body end.
|
||
def days(month_posts) | ||
hash = Hash.new { |h, key| h[key] = [] } | ||
month_posts.each { |p| hash[p.date.strftime("%d")] << p } |
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.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
||
def months(year_posts) | ||
hash = Hash.new { |h, key| h[key] = [] } | ||
year_posts.each { |p| hash[p.date.strftime("%m")] << p } |
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.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
if Jekyll::VERSION >= '3.0.0' | ||
@posts.docs.each { |p| hash[p.date.strftime("%Y")] << p } | ||
else | ||
@posts.each { |p| hash[p.date.strftime("%Y")] << p } |
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.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
||
# In Jekyll 3, Collection#each should be called on the #docs array directly. | ||
if Jekyll::VERSION >= '3.0.0' | ||
@posts.docs.each { |p| hash[p.date.strftime("%Y")] << p } |
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.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
end | ||
|
||
# Custom `post_attr_hash` method for years | ||
def years |
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.
Assignment Branch Condition size for years is too high. [17.15/15]
|
||
# hash[p.date.strftime("%Y")] << p | ||
end | ||
else |
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.
Redundant else-clause.
tag.gsub(/[^0-9A-Za-z]/, ' ').squeeze | ||
end | ||
|
||
def tags |
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.
Assignment Branch Condition size for tags is too high. [21.47/15]
Method has too many lines. [11/10]
def enabled?(archive) | ||
@config["enabled"] == true || @config["enabled"] == "all" || if @config["enabled"].is_a? Array | ||
@config["enabled"].include? archive | ||
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.
end at 87, 8 is not aligned with if at 85, 69.
Passed! LGTM! |
Closing because this is a PR to |
Nevermind!!! |
Closing in favor of #2033 |
Fixes issue(s) #1947
😎 PREVIEW
Changes proposed in this pull request:
/cc @coreycaitlin @awfrancisco