Should I match the curly brace of the previous author?

When working with code from several authors, I often encounter the problem of the preferences of curly shapes (same line and new line). Is this a good / bad practice or not even a problem when it comes to matching an existing style using your own preferences?

Does the situation change if you add new code to a class or modify an existing code? Finally, if the style needs to be matched, how far should the match go? i.e. file, class, subclasses, etc.

Example:

if(this)
{
    doThat();
}

Vs.

if(this){
    doThat();
}
+3
source share
6 answers

, , , , .

. , , .

+6

, . . . ....

+3

, . , , . .

+2

. , . , , .

, , ; , .: D

0

( ), , . , , , , . , , , , , lol

0

, , , . - , , . - , , , , , , , . , , , . , , , , .

0

Source: https://habr.com/ru/post/1783988/


All Articles