OyvindSabo / gremlint

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

Problem with relative indentation inside closures #79

Closed OyvindSabo closed 3 years ago

OyvindSabo commented 3 years ago

Considered the following query:

g.V().where(map{ buyPrice  = it.get().value('buy_price');
                 sellPrice = it.get().value('sell_price');
                 sellPrice - buyPrice; }.is(gt(50)))

Formatted with a max line length of 60 characters, it is currently formatted like this:

g.V().where(map{ buyPrice  = it.get().value('buy_price');
                             sellPrice = it.get().value('sell_price');
                             sellPrice - buyPrice; }.is(gt(50)))

but it should look like this:

g.V().where(map{ buyPrice  = it.get().value('buy_price');
                 sellPrice = it.get().value('sell_price');
                 sellPrice - buyPrice; }.is(gt(50)))

With a max line length of 45 characters it is currently formatted like this:

g.V().
  where(
    map{ buyPrice  = it.get().value('buy_price');
                     sellPrice = it.get().value('sell_price');
                     sellPrice - buyPrice; }.is(gt(50)))

But it should be formatted like this:

g.V().
  where(
    map{ buyPrice  = it.get().value('buy_price');
         sellPrice = it.get().value('sell_price');
         sellPrice - buyPrice; }.is(gt(50)))

WIth a max line length of 40 characters it is currently correctly formatted like this:

g.V().
  where(
    map{ buyPrice  = it.get().value('buy_price');
         sellPrice = it.get().value('sell_price');
         sellPrice - buyPrice; }.
    is(gt(50)))