force use of curly braces - how to ?

Hello

I'm refactoring a large code base and there are many instances of single lines statements inside loops and control of flow without the use of 'curly braces'. This makes it hard to read and understand the code. I would like to 'Clean up' the code and get ReSharper to add curly braces everywhere, for if-else, for-loop, etc. Is there a setting like that anywhere. I couldn't find anything. 

Thanks!

1
10 comments
Avatar
Permanently deleted user

Hello,

We don't have this code style settings yet, the feature request is https://youtrack.jetbrains.com/issue/RSCPP-20266. In general, code style cleanup is lacking in C++ compared to C# at the moment, but we plan to improve it.

Thanks!

0

As per the comment above: In general, code style cleanup is lacking in C++ compared to C# at the moment, but we plan to improve it.-- that was over a year ago - has any progress been made with this.  Mostly I am interested in the curly brace for single lines.  Do you have a time line when you expect to improve the C++ cleanup options

0
Avatar
Permanently deleted user

Hello Nathan,

I'm not sure we'll have time for a fully fledged code style settings page, but we can easily add a standalone inspection (turned off by default) for compound statements without braces. I'll try to implement this in 2019.3.

Thanks!

0

Hi Igor, is this feature implemented yet? I have the 2019.2.3 Resharper version. so I guess not but I would like to keep updated if this released

 

Thank you so much!

0
Avatar
Permanently deleted user

Hey,

Sorry, no news to share yet. I'll update this thread when the feature is available.

0

Is it available somewhere in Resharper 2019.3? I looked for it but couldn't find it

0
Avatar
Permanently deleted user

No, sorry about that :( I'll try add this to 2020.1, will ping when it's available in an EAP build.

There are lots of other goodies in 2019.3 however, take a look at https://blog.jetbrains.com/rscpp/resharper-cpp-2019-3/ if you haven't already.

0

Any word on the update yet? :)

0
Avatar
Permanently deleted user

We've finally added braces style support in 2021.1.

1

Thanks Igor!  Thats good to know that feature now exists!  thanks for letting me know.  Better late than never!  :-)

0

Please sign in to leave a comment.