[PATCH] D16286: [clang-tidy] Readability check for redundant parenthesis in return expression.

Richard via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 11:28:03 PST 2016


LegalizeAdulthood added a comment.

With readability checks, there are always people who disagree about what makes for more readable code.  I think I have seen this back-and-forth discussion with **every** readability check since I've been paying attention.  It simply isn't possible to make everyone happy and we shouldn't even try.

As I stated earlier on this review, IMO the way to deal with complex expressions is not to shotgun blast extra parentheses into the expression, but to extract variables or functions with intention revealing names that break out meaningful subexpressions.

For checks relating to readability or style, I think it is fair to simply assume that the results are subjective.  At the risk of sounding tautological, those who don't want the transformation shouldn't ask clang-tidy to perform the transformation.

There are already tons of transformations that clang-tidy performs that aren't to my personal taste, but are there because of a particular style guide (LLVM, google, etc.) or because the author of the check desires the transformation that is implemented.

I don't think such transformations should be denied from clang-tidy simply because of a difference of opinion.

One could argue that this check should be part of the google module.  The google style guide specifically forbids writing return with extra parenthesis.


http://reviews.llvm.org/D16286





More information about the cfe-commits mailing list