Skip to content
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

Cleanup existing liquid tags #9085

Conversation

atsmith813
Copy link
Contributor

@atsmith813 atsmith813 commented Jul 2, 2020

What type of PR is this? (check all applicable)

  • Refactor

Description

In #8917 and digging through the liquid gem source code, we found that the third argument passed to initialize in liquid tags is parse_context, not tokens.

While updating these references, I also:

  • Ensured super is called in every liquid tag.
  • Denoted unused arguments in initialize methods.

I intentionally skipped PollTag, I need to update more logic on that. That'll be a separate PR.

Related Tickets & Documents

Closes #9024

QA Instructions, Screenshots, Recordings

Specs should be appropriate here since I'm not changing any logic or behavior. If you'd like, you can include a bunch of different liquid tags in an article locally to ensure they work 🎉 .

Added tests?

  • no, because they aren't needed

Added to documentation?

  • no documentation needed

cleanup_gif

@pr-triage pr-triage bot added the PR: draft bot applied label for PR's that are a work in progress label Jul 2, 2020
@atsmith813 atsmith813 marked this pull request as ready for review July 2, 2020 22:13
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: draft bot applied label for PR's that are a work in progress labels Jul 2, 2020
Copy link
Contributor

@vaidehijoshi vaidehijoshi left a comment

Choose a reason for hiding this comment

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

This looks like a solid refactor. ✅

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jul 2, 2020
@@ -2,7 +2,7 @@ class KatexTag < Liquid::Block
PARTIAL = "liquids/katex".freeze
KATEX_EXISTED = "katex_existed".freeze

def initialize(tag_name, markup, tokens)
def initialize(_tag_name, markup, _parse_context)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that markup could benefit from being written as _markup here since it seems unused - thoughts? 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

@juliannatetreault Ah but it is being used here; it's just a little obfuscated since it is initialized by the gem itself

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh, I see! Thanks for pointing that out.

Copy link
Contributor

@juliannatetreault juliannatetreault left a comment

Choose a reason for hiding this comment

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

Everything looks nice and cleaned up! 🧽 ✨

Copy link
Contributor

@rhymes rhymes left a comment

Choose a reason for hiding this comment

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

Nice!

app/liquid_tags/github_tag.rb Outdated Show resolved Hide resolved
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Jul 3, 2020
@atsmith813 atsmith813 added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jul 3, 2020
@atsmith813 atsmith813 force-pushed the atsmith813/cleanup-existing-liquid-tags-9024 branch from a27f068 to a8e85b4 Compare July 3, 2020 22:55
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Jul 3, 2020
@atsmith813 atsmith813 added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jul 3, 2020
@atsmith813 atsmith813 merged commit 9af9a48 into forem:master Jul 6, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Jul 6, 2020
@atsmith813 atsmith813 deleted the atsmith813/cleanup-existing-liquid-tags-9024 branch July 6, 2020 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup existing liquid tags with new updates
4 participants