You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Øyvind Sæbø (Jira)" <ji...@apache.org> on 2021/03/19 19:34:00 UTC

[jira] [Updated] (TINKERPOP-2539) Nested closing parentheses, commas and punctuation at the end of lines are not considered when checking if a line exceeds max line length

     [ https://issues.apache.org/jira/browse/TINKERPOP-2539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Øyvind Sæbø updated TINKERPOP-2539:
-----------------------------------
    Description: 
This issue is migrated from [https://github.com/OyvindSabo/gremlint/issues/44].  It is mentioned in a comment in the Gremlint code, and since OyvindSabo/gremlint will be retired, I'm adding it here now so the comment in tinkerpop/gremlint can refer to this Jira task instead.


h3. The issue:

Currently, for nested steps, lines can sometimes be longer than the specified maximum line length because the function which checks the length does not know how deeply nested the steps are. Furthermore, commas or punctuation at the end of lines are not taken into consideration.


h3. An example where closing parentheses are ignored:

Consider the following query formatted with a max line length of 66:
{code:java}
g.V().hasLabel('person').groupCount().by(values('age').choose(is(lt(28)),constant('young'),choose(is(lt(30)), constant('old'), constant('very old')))){code}
 
 It is formatted like this (67 characters wide):
{code:java}
g.V().
  hasLabel('person').
  groupCount().
    by(
      values('age').
      choose(
        is(lt(28)),
        constant('young'),
        choose(is(lt(30)), constant('old'), constant('very old')))){code}
 
 It is expected to be formatted like this:
{code:java}
g.V().
  hasLabel('person').
  groupCount().
    by(
      values('age').
      choose(
        is(lt(28)),
        constant('young'),
        choose(
          is(lt(30)),
          constant('old'),
          constant('very old')))){code}
 

A test case for this should be added to gremlint/src/formatQuery/__tests__/maxLineLength.test.ts.


h3. An example where punctuation at the end of the line is ignored:

Consider the following query formatted with a max line length of 45:
{code:java}
g.V().hasLabel('person').where(outE('created').count().is(P.gte(2))).count(){code}
 

It is formatted like this (46 characters wide):
{code:java}
g.V().
  hasLabel('person').
  where(outE('created').count().is(P.gte(2))).
  count(){code}
 

It is expected to be formatted like this:
{code:java}
g.V().
  hasLabel('person').
  where(
    outE('created').count().is(P.gte(2))).
  count(){code}
 

There is currently a commented out test for this in gremlint/src/formatQuery/__tests__/maxLineLength.test.ts which should be uncommented upon completion of this task.


h3. An example where comma at the end of the line is ignored:

Consider the following query formatted with a max line length of 22:
{code:java}
g.V().choose(hasLabel('person'), out('created'), identity()).values('name'){code}
 

It is formatted like this (23 characters wide):
{code:java}
g.V().
  choose(
    hasLabel('person'),
    out('created'),
    identity()).
  values('name'){code}
 

It is expected to be formatted like this:
{code:java}
g.V().
  choose(
    hasLabel(
      'person'),
    out('created'),
    identity()).
  values('name'){code}
 

A test case for this should be added to gremlint/src/formatQuery/__tests__/maxLineLength.test.ts.

 

  was:
This issue is migrated from [https://github.com/OyvindSabo/gremlint/issues/44].  It is mentioned in a comment in the Gremlint code, and since OyvindSabo/gremlint will be retired, I'm adding it here now so the comment in tinkerpop/gremlint can refer to this Jira task instead.
h3. The issue:

Currently, for nested steps, lines can sometimes be longer than the specified maximum line length because the function which checks the length does not know how deeply nested the steps are. Furthermore, commas or punctuation at the end of lines are not taken into consideration.
h3. An example where closing parentheses are ignored:

Consider the following query formatted with a max line length of 66:
{code:java}
g.V().hasLabel('person').groupCount().by(values('age').choose(is(lt(28)),constant('young'),choose(is(lt(30)), constant('old'), constant('very old')))){code}
 
 It is formatted like this (67 characters wide):
{code:java}
g.V().
  hasLabel('person').
  groupCount().
    by(
      values('age').
      choose(
        is(lt(28)),
        constant('young'),
        choose(is(lt(30)), constant('old'), constant('very old')))){code}
 
 It is expected to be formatted like this:
{code:java}
g.V().
  hasLabel('person').
  groupCount().
    by(
      values('age').
      choose(
        is(lt(28)),
        constant('young'),
        choose(
          is(lt(30)),
          constant('old'),
          constant('very old')))){code}
 

A test case for this should be added to gremlint/src/formatQuery/__tests__/maxLineLength.test.ts.
h3. An example where punctuation at the end of the line is ignored:

Consider the following query formatted with a max line length of 45:
{code:java}
g.V().hasLabel('person').where(outE('created').count().is(P.gte(2))).count(){code}
 

It is formatted like this (46 characters wide):
{code:java}
g.V().
  hasLabel('person').
  where(outE('created').count().is(P.gte(2))).
  count(){code}
 

It is expected to be formatted like this:
{code:java}
g.V().
  hasLabel('person').
  where(
    outE('created').count().is(P.gte(2))).
  count(){code}
 

There is currently a commented out test for this in gremlint/src/formatQuery/__tests__/maxLineLength.test.ts which should be uncommented upon completion of this task.
h3. An example where comma at the end of the line is ignored:

Consider the following query formatted with a max line length of 22:
{code:java}
g.V().choose(hasLabel('person'), out('created'), identity()).values('name'){code}
 

It is formatted like this (23 characters wide):
{code:java}
g.V().
  choose(
    hasLabel('person'),
    out('created'),
    identity()).
  values('name'){code}
 

It is expected to be formatted like this:
{code:java}
g.V().
  choose(
    hasLabel(
      'person'),
    out('created'),
    identity()).
  values('name'){code}
 

A test case for this should be added to `gremlint/src/formatQuery/__tests__/maxLineLength.test.ts`.

 


> Nested closing parentheses, commas and punctuation at the end of lines are not considered when checking if a line exceeds max line length
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2539
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2539
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: gremlint
>    Affects Versions: 3.5.0
>            Reporter: Øyvind Sæbø
>            Priority: Minor
>             Fix For: 3.5.0
>
>
> This issue is migrated from [https://github.com/OyvindSabo/gremlint/issues/44].  It is mentioned in a comment in the Gremlint code, and since OyvindSabo/gremlint will be retired, I'm adding it here now so the comment in tinkerpop/gremlint can refer to this Jira task instead.
> h3. The issue:
> Currently, for nested steps, lines can sometimes be longer than the specified maximum line length because the function which checks the length does not know how deeply nested the steps are. Furthermore, commas or punctuation at the end of lines are not taken into consideration.
> h3. An example where closing parentheses are ignored:
> Consider the following query formatted with a max line length of 66:
> {code:java}
> g.V().hasLabel('person').groupCount().by(values('age').choose(is(lt(28)),constant('young'),choose(is(lt(30)), constant('old'), constant('very old')))){code}
>  
>  It is formatted like this (67 characters wide):
> {code:java}
> g.V().
>   hasLabel('person').
>   groupCount().
>     by(
>       values('age').
>       choose(
>         is(lt(28)),
>         constant('young'),
>         choose(is(lt(30)), constant('old'), constant('very old')))){code}
>  
>  It is expected to be formatted like this:
> {code:java}
> g.V().
>   hasLabel('person').
>   groupCount().
>     by(
>       values('age').
>       choose(
>         is(lt(28)),
>         constant('young'),
>         choose(
>           is(lt(30)),
>           constant('old'),
>           constant('very old')))){code}
>  
> A test case for this should be added to gremlint/src/formatQuery/__tests__/maxLineLength.test.ts.
> h3. An example where punctuation at the end of the line is ignored:
> Consider the following query formatted with a max line length of 45:
> {code:java}
> g.V().hasLabel('person').where(outE('created').count().is(P.gte(2))).count(){code}
>  
> It is formatted like this (46 characters wide):
> {code:java}
> g.V().
>   hasLabel('person').
>   where(outE('created').count().is(P.gte(2))).
>   count(){code}
>  
> It is expected to be formatted like this:
> {code:java}
> g.V().
>   hasLabel('person').
>   where(
>     outE('created').count().is(P.gte(2))).
>   count(){code}
>  
> There is currently a commented out test for this in gremlint/src/formatQuery/__tests__/maxLineLength.test.ts which should be uncommented upon completion of this task.
> h3. An example where comma at the end of the line is ignored:
> Consider the following query formatted with a max line length of 22:
> {code:java}
> g.V().choose(hasLabel('person'), out('created'), identity()).values('name'){code}
>  
> It is formatted like this (23 characters wide):
> {code:java}
> g.V().
>   choose(
>     hasLabel('person'),
>     out('created'),
>     identity()).
>   values('name'){code}
>  
> It is expected to be formatted like this:
> {code:java}
> g.V().
>   choose(
>     hasLabel(
>       'person'),
>     out('created'),
>     identity()).
>   values('name'){code}
>  
> A test case for this should be added to gremlint/src/formatQuery/__tests__/maxLineLength.test.ts.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)