1

I would like to catch cases like this:

if(a == 2 && b == 3)

and convert them to:

if((a == 2) && (b == 3))

I didn't see anything that sounded like this here - is there a way to enable this?

pablo285
  • 2,460
  • 4
  • 14
  • 38
David Doria
  • 9,873
  • 17
  • 85
  • 147

1 Answers1

1

There is no clang-tidy check that would do this transformation. The reason probably being that there is nothing wrong with the code you want to transform.

I don't even think that this transformation is something clang-tidy is intended for since this is just a question of coding style. Nowhere did I find a guideline that would prefer the first style over the second or vice versa.

You can write your own check but I don't think it's worth it. The only thing you can gain here is readability but even that is debatable at best.

pablo285
  • 2,460
  • 4
  • 14
  • 38