Menu ▾ ▴

#571 Logical Negation is not padded by pad-oper

closed-fixed
None
2024-06-30
2024-05-20
No

--pad-oper does not pad Logical Negation (NOT) for example:

if (!isFoo(bar)){}
if (!(isFoo(bar))){}

would be expected to be reformatted as:

if (! isFoo(bar)){}
if (! (isFoo(bar))){}

But instead does nothing.

I feel the later is easier to read as the NOT is more visible.

If this is not the intended behaviour of --pad-oper I would request a new command to split it, possible --pad-negation.

Discussion

  • André Simon

    André Simon - 2024-05-21
    • status: open --> open-accepted
    • assigned_to: André Simon
     
    👍
    1
  • André Simon

    André Simon - 2024-06-03

    The next release will have --pad-negation

     
    👍
    1
    • w-peuker

      w-peuker - 2024-06-03

      Will --pad-negation be just a flag or will we have different settings to get !, _!, !_, or _!_ ... I admit this might be overkill ...

       

      Last edit: w-peuker 2024-06-03
      • Gavin Barnett

        Gavin Barnett - 2024-06-03

        The original request in my organisation was for the_!_ example, so settings might be nice.

         
        • André Simon

          André Simon - 2024-06-06

          The new version 3.5 has two options --pad-negation and --pad-negation=before to toggle space before !. The options always add a space after.

           
          👍
          1

          Last edit: André Simon 2024-06-06
  • Gavin Barnett

    Gavin Barnett - 2024-06-06

    Thanks! That was so quick from report to response to release.
    Hope you have some cake today :-)

     
  • André Simon

    André Simon - 2024-06-30
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.