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

Use constants for token start/end symbols #285

Merged
merged 3 commits into from
May 3, 2019

Conversation

pfarrel
Copy link
Contributor

@pfarrel pfarrel commented Feb 21, 2019

I forgot to include this change in my previous PR: #282

private String reconstructImage() {
StringBuilder builder = new StringBuilder().append(master.getImage());

for (Node n : getChildren()) {
builder.append(n.getMaster().getImage());
}

builder.append("{% ").append(getEndName()). append(" %}");
builder.append(TokenScannerSymbols.TOKEN_EXPR_START).append(TokenScannerSymbols.TOKEN_TAG).append(" ")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this just one append with a String.format for readability? The StringBuilder makes sense for the above code however makes this bit hard to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, done. I think it's a bit better now.

@codecov-io
Copy link

codecov-io commented Feb 21, 2019

Codecov Report

Merging #285 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #285      +/-   ##
============================================
+ Coverage     72.28%   72.32%   +0.03%     
  Complexity     1497     1497              
============================================
  Files           234      234              
  Lines          4648     4654       +6     
  Branches        739      739              
============================================
+ Hits           3360     3366       +6     
  Misses         1033     1033              
  Partials        255      255
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/com/hubspot/jinjava/tree/TagNode.java 75% <100%> (+5%) 9 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 815fdfd...4e9a773. Read the comment docs.

Copy link
Collaborator

@mattcoley mattcoley left a comment

Choose a reason for hiding this comment

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

LGTM

int TOKEN_EXPR_START = '{';
int TOKEN_EXPR_END = '}';
int TOKEN_NEWLINE = '\n';
char TOKEN_PREFIX_CHAR = '{';
Copy link
Contributor

Choose a reason for hiding this comment

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

for convenience it might be nice to have constants for {%, %}, {{ and }}

@pfarrel pfarrel merged commit 3355490 into master May 3, 2019
@pfarrel pfarrel deleted the use-constants-for-token-tags branch May 3, 2019 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants