Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Issue 116 Name and Reuse Repeating Conditions #131
Issue 116 Name and Reuse Repeating Conditions #131
Changes from 15 commits
e275f1b
bf1f21c
b1183b4
e7eaede
980e5e3
ef16c7e
add2194
4b3c180
b00acc0
1e95bd4
8607d31
3dbf928
9bf6f8c
79116cd
cb4e942
e712735
5f2ecfb
4e13818
8e1877b
55e8072
de0a612
8e9ff91
8afaf88
a8b8904
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This API has to be rewritten as it decouples expression from the attribute.
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.
@piotr-wilczynski You should take a look at this :)
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.
this method is giving You all of the expressions that exists in node, but if You want the have relation between attribute and expresion You can always check if there is any expression in the attribute and proceed somehow. There is a method called htlExpression
default void htlExpression(Expression expression, Node node)
It is probably what You are looking for @chutch ?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.
This time also, the method name is misleading since "reused" has a positive connotation whereas in your case reused means "the same condition used couple of times needlessly".
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.
Conditions inverted and method name changed to
isConditionReusedCorrectly()
.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.
Please extract 'getRawText' and 'text.replaceAll("[${}]", "")' to method and reuse it in '103' line.
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.
Extracted
private Set<String> clearExpressions(List<Expression> expressions){ return expressions.stream() .map(Expression::getRawText) .map(text -> text.replaceAll("[${}]", "")) .collect(Collectors.toSet()); }
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.
what is 14?
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.
fixed.
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.
maybe ... ?
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.
fixed