-
Notifications
You must be signed in to change notification settings - Fork 56
Simple cypher formatter #25
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
Conversation
c8659a6
to
fd18892
Compare
3a42a35
to
01d6b90
Compare
d9eba1a
to
e50375d
Compare
config/checkstyle/suppression.xml
Outdated
<suppress files="DataSourceV\d+.java" checks="VisibilityModifier"/> | ||
<suppress files="DataSourcesComponentState.java" checks="VisibilityModifier"/> | ||
<suppress files="DataSourceContainerV\d+.java" checks="VisibilityModifier"/> | ||
<suppress files="[\w_]+Test.java" checks="[a-zA-Z0-9]*"/> | ||
<suppress files="CypherCodeStyleSettings.java" checks="MemberName"/> |
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.
yo dawg
|
||
private boolean isNonStarCount(@NotNull ASTNode node) { | ||
IElementType type = node.getElementType(); | ||
return type == CypherTypes.K_COUNT && TreeUtil.findParent(node, CypherTypes.COUNT_STAR) == null; |
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.
Check direct parent
private boolean isLookupFunction(@NotNull ASTNode node) { | ||
IElementType type = node.getElementType(); | ||
return (type == CypherTypes.K_NODE || type == CypherTypes.K_REL || type == CypherTypes.K_RELATIONSHIP) | ||
&& TreeUtil.findParent(node, CypherTypes.LOOKUP) != null; |
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.
check direct parent
&& TreeUtil.findChildBackward(element.getNode(), CypherTypes.K_COUNT) == null) { | ||
String text = element.getText(); | ||
char first = text.charAt(0); | ||
return Character.toLowerCase(first) + text.substring(1); |
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.
check 1-char length function names
int singleCount = CharMatcher.is('\'').countIn(text); | ||
int doubleCount = CharMatcher.is('"').countIn(text); | ||
|
||
text = text.replace("\\", ""); |
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.
\n will be wiped out :(
This change is