OyvindSabo / gremlint

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

Problem with relative alignment between lines within closure #76

Closed OyvindSabo closed 3 years ago

OyvindSabo commented 3 years ago

Consider the following query:

g.V().filter(map{ one   = 1
                  two   = 2
                  three = 3 }))

With a max line length of 28 it is (expectedly) formatted like this:

g.V().
  filter(map{ one   = 1
              two   = 2
              three = 3 }))

However, with a max line length of 25 it is formatted like this:

g.V().
  filter(
    map{ one   = 1
             two   = 2
             three = 3 }))

With a max line length of 25 it should rather be formatted like this:

g.V().
  filter(
    map{ one   = 1
         two   = 2
         three = 3 }))
OyvindSabo commented 3 years ago

I found another similar issue.

Consider the following query:

g.V().out().filter(map{ it.get().value('sell_price') -
                        it.get().value('buy_price') }.is(gt(50)))

Formatted with a max line length of 40 it is (correctly) formatted like this:

g.V().
  out().
  filter(
    map{ it.get().value('sell_price') -
         it.get().value('buy_price') }.
    is(gt(50)))

However, when formatted with a max line length of 50, it is (incorrectly) formatted like this:

g.V().
  out().
  filter(
    map{ it.get().value('sell_price') -
                                it.get().value('buy_price') }.is(gt(50)))

When it should rather be formatted like this:

g.V().
  out().
  filter(
    map{ it.get().value('sell_price') -
         it.get().value('buy_price') }.is(gt(50)))