Skip to content

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

Merged
merged 8 commits into from
Feb 14, 2017
Merged

Simple cypher formatter #25

merged 8 commits into from
Feb 14, 2017

Conversation

Metaur
Copy link
Contributor

@Metaur Metaur commented Jan 18, 2017

This change is Reviewable

@Metaur Metaur force-pushed the simple-cypher-formatting branch from c8659a6 to fd18892 Compare January 18, 2017 12:28
@Metaur Metaur force-pushed the simple-cypher-formatting branch from 3a42a35 to 01d6b90 Compare January 31, 2017 08:52
@Metaur Metaur force-pushed the simple-cypher-formatting branch from d9eba1a to e50375d Compare February 13, 2017 15:57
@Metaur Metaur requested a review from FylmTM February 14, 2017 12:40
<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"/>
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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("\\", "");
Copy link
Contributor

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 :(

@FylmTM FylmTM merged commit 869af40 into master Feb 14, 2017
@FylmTM FylmTM deleted the simple-cypher-formatting branch February 14, 2017 15:27
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.

2 participants