[mythtv] Inconsistencies in code recommendations regarding if/else bodies

David Hampton mythtv at love2code.net
Sat Aug 29 16:32:55 UTC 2020


On Sat, 2020-08-29 at 16:24 +0000, Gary Buhrmaster wrote:
> For quite some time now ctidy has been
> reporting:
> 
>   "warning: statement should be inside braces
> [readability-braces-around-statements]"
> 
> and various codes in the project have been
> updated accordingly.
> 
> HOWEVER, in the coding standards
> documentation at:
> 
>   https://www.mythtv.org/wiki/Coding_Standards
> 
> it explicitly says:
> 
>   "One-line if or else bodies do not need braces."
> 
> Since this would appear to be a change in the
> projects coding standards (it now does need
> the braces?), the person who made that change
> should likely update the wiki (or the ctidy checks
> if the braces are still not a hard requirement) so
> that future contributors know how to properly
> write their code.

Tidy is set to only complains about missing braces if the if/else body
is three or more lines long.  I've had it remove braces as well as add
braces. In today's commit I believe it was a couple of intervening
conditional compilation statements that caused tidy to recommend the
braces.

David




More information about the mythtv-dev mailing list