OyvindSabo / gremlint

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

Prevent unnecessary wrapping of modulator steps #36

Closed OyvindSabo closed 3 years ago

OyvindSabo commented 5 years ago

Currently, when a traversal is long enough to be wrapped over multiple lines, modulators are wrapped to new lines and indented with two spaces relative to the step they are modulating. However, in many cases, it would make more sense if the modulator was simply appended to the end of the previous line.

For instance, the following query:

g.V().hasLabel("person").group().by(values("name", "age").fold()).unfold().filter(select(values).count(local).is(gt(1)))

is formatted to this:

g.V().
  hasLabel("person").
  group().
    by(values("name", "age").fold()).
  unfold().
  filter(
    select(values).
    count(local).
    is(gt(1)))

when it might be more natural that it was formatted like this (assuming that the specified maximum line length allows it):

g.V().
  hasLabel("person").
  group().by(values("name", "age").fold()).
  unfold().
  filter(
    select(values).
    count(local).
    is(gt(1)))