OyvindSabo / gremlint

Linter/Code formatter for Gremlin
https://gremlint.com
Apache License 2.0
11 stars 6 forks source link

Don't remove spacing before closures which are not inside a traversal #64

Closed OyvindSabo closed 3 years ago

OyvindSabo commented 3 years ago

Assuming a max line length of 35, the following

contains = {
  value -> it.get().contains(value)
}

g.V().filter(values('name').filter(contains('Gremlint')))

should be formatted to

contains = {
  value -> it.get().contains(value)
}

g.V().
  filter(
    values('name').
    filter(contains('Gremlint')))

and not

contains ={
  value -> it.get().contains(value)
}

g.V().
  filter(
    values('name').
    filter(contains('Gremlint')))

We should determine if a code block is a traversal, and If it is, we format it as usual, but if it is not, we just leave it alone.