-
Notifications
You must be signed in to change notification settings - Fork 31
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
Inherit Jekyll's rubocop config for consistency #38
Conversation
This PR is the result of adding inherit_gem:\n jekyll: .rubocop.yml to .rubocop.yml and running rubocop -a so that this project follows Jekyll core's coding styles for consistency like other core plugins. This way, as Jekyll's Ruby style changes, so too will this project's. This PR does not fix the last offense: `lib/jekyll-mentions.rb:12:7: C: Assignment Branch Condition size for mentionify is too high. [21.93/20] def mentionify(doc)`
end | ||
|
||
def mention_username_pattern | ||
Regexp.new(HTML::Pipeline::MentionFilter::UsernamePattern.source, Regexp::IGNORECASE) | ||
Regexp.new(HTML::Pipeline::MentionFilter::UsernamePattern.source, | ||
Regexp::IGNORECASE) |
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.
Let's separate these arguments so they each have their own line:
Regexp.new(
Arg1,
Arg2
)
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.
Done.
Well done! You can add a |
@@ -15,7 +14,7 @@ def mentionify(doc) | |||
src = mention_base(doc.site.config) | |||
if doc.output.include? BODY_START_TAG | |||
parsed_doc = Nokogiri::HTML::Document.parse(doc.output) | |||
body = parsed_doc.at_css('body') | |||
body = parsed_doc.at_css("body") | |||
body.children = filter_with_mention(src).call(body.inner_html)[:output].to_s | |||
doc.output = parsed_doc.to_html | |||
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.
To get Rubocop to not yell at us about the method, you could move the contents of the first half of the condition to a private parse_as_html
or whatever method (or you can ignore it for now).
Nice work! |
@parkr I applied your recommendations @benbalter Sorry, I am not sure how to proper do this 😨 |
Nice. I believe adding |
@benbalter tests are OK now 🎉 |
LGTM. |
LGTM |
Thanks @DirtyF! |
@jekyllbot: merge +dev |
Based on jekyll/jekyll-seo-tag#109
This PR is the result of adding
inherit_gem:\n jekyll: .rubocop.yml
to.rubocop.yml
and runningrubocop -a
so that this project follows Jekyll core's coding styles for consistency like other core plugins. This way, as Jekyll's Ruby style changes, so too will this project's.Note, that this PR does not fix the last offense:
lib/jekyll-mentions.rb:12:7: C: Assignment Branch Condition size for mentionify is too high. [21.93/20] def mentionify(doc)