Allman/bsd/break
A1
int Foo(bool isFoo)
{
if (isFoo)
{
bar();
return 1;
}
else
return 0;
}
Java/attach
A2
int Foo(bool isFoo) {
if (isFoo) {
bar();
return 1;
} else
return 0;
}
KR
A3
int Foo(bool isFoo)
{
if (isFoo) {
bar();
return 1;
} else
return 0;
}
Stroustrup
A4
int Foo(bool isFoo)
{
if (isFoo) {
bar();
return 1;
} else
return 0;
}
Whitesmith
A5
int Foo(bool isFoo)
{
if (isFoo)
{
bar();
return 1;
}
else
return 0;
}
Banner/ratliff
A6
int Foo(bool isFoo) {
if (isFoo) {
bar();
return 1;
}
else
return 0;
}
GNU
A7
int Foo(bool isFoo)
{
if (isFoo)
{
bar();
return 1;
}
else
return 0;
}
Linux/knf
A8
int Foo(bool isFoo)
{
if (isFoo) {
bar();
return 1;
} else
return 0;
}
Horstmann/runin
A9
int Foo(bool isFoo)
{ if (isFoo)
{ bar();
return 1;
}
else
return 0;
}
1tbs/otbs
A10
int Foo(bool isFoo)
{
if (isFoo) {
bar();
return 1;
} else {
return 0;
}
}
Pico
A11
int Foo(bool isFoo)
{ if (isFoo)
{ bar();
return 1; }
else
return 0; }
Lisp/python
A12
int Foo(bool isFoo) {
if (isFoo) {
bar();
return 1; }
else
return 0; }
A14
int Foo(bool isFoo) {
if (isFoo) {
bar();
return 1;
} else
return 0;
}
VTK
A15
int Foo(bool isFoo)
{
if (isFoo)
{
bar();
return 1;
}
else
return 0;
}
Mozilla
A16
int Foo(bool isBar)
{
if (isBar) {
bar();
return 1;
} else
return 0;
}
None
Yes
xn
namespace FooName {
...
}
No
namespace FooName
{
...
}
Yes
xc
class Foo {
public:
Foo() {
isFoo();
}
};
No
class Foo
{
public:
Foo() {
isFoo();
}
};
Yes
xl
class Foo
{
public:
Foo() {
isFoo();
}
};
No
class Foo
{
public:
Foo()
{
isFoo();
}
};
Yes
xk
#ifdef __cplusplus
extern "C" {
#endif
No
#ifdef __cplusplus
extern "C"
{
#endif
Yes
xV
do
{
bar();
++x;
} while x == 1;
No
do
{
bar();
++x;
}
while x == 1;
Spaces
s
int*Foo(bool*isBar)
{
****if*(isBar)*{
********bar();
****}
****else*{
********bar(arg1,
************arg2,
************arg3);
****}
}
Tab
t
int*Foo(bool*isBar)
{
--->if*(isBar)*{
--->--->bar();
--->}
--->else*{
--->--->bar(arg1,
--->--->****arg2,
--->--->****arg3);
--->}
}
Force tab
T
int*Foo(bool*isBar)
{
--->if*(isBar)*{
--->--->bar();
--->}
--->else*{
--->--->bar(arg1,
--->--->--->arg2,
--->--->--->arg3);
--->}
}
Range : 2-20
*Attach to previous short
//indent_number4
int Foo(bool isBar)
{
bar();
}
//indent_number5
int Foo(bool isBar)
{
bar();
}
Yes
C
class Foo
{
public:
Foo();
virtual ~Foo();
};
No
class Foo
{
public:
Foo();
virtual ~Foo();
};
Yes
xG
class Foo
{
public:
Foo();
virtual ~Foo();
};
No
class Foo
{
public:
Foo();
virtual ~Foo();
};
Yes
S
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
No
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
Yes
K
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
No
switch (foo)
{
case 1:
a += 1;
break;
case 2:
{
a += 2;
break;
}
}
Yes
N
namespace foospace
{
class Foo
{
public:
Foo();
virtual ~Foo();
};
}
No
namespace foospace
{
class Foo
{
public:
Foo();
virtual ~Foo();
};
}
Yes
xU
void Foo(bool bar1,
bool bar2)
{
isLongFunction(bar1,
bar2);
isLongVariable = foo1
|| foo2;
}
No
void Foo(bool bar1,
bool bar2)
{
isLongFunction(bar1,
bar2);
isLongVariable = foo1
|| foo2;
}
Range : 0-4
xt
isLongVariable =
foo1 ||
foo2;
isLongFunction(
bar1,
bar2);
becomes (with indent-continuation=3):
isLongVariable =
foo1 ||
foo2;
isLongFunction(
bar1,
bar2);
Yes
L
void Foo() {
while (isFoo) {
if (isFoo)
goto error;
...
error:
...
}
}
No
void Foo() {
while (isFoo) {
if (isFoo)
goto error;
...
error:
...
}
}
Yes
xW
#ifdef _WIN32
#include <windows.h>
#ifndef NO_EXPORT
#define EXPORT
#endif
#endif
No
#ifdef _WIN32
#include <windows.h>
#ifndef NO_EXPORT
#define EXPORT
#endif
#endif
Yes
w
#define Is_Foo(arg,op) \
((arg).compare(op)==0)
#define Is_Bar(arg,a,b) \
(Is_Foo((arg), (a)) \
|| Is_Foo((arg), (b)))
No
#define Is_Foo(arg,op) \
((arg).compare(op)==0)
#define Is_Bar(arg,a,b) \
(Is_Foo((arg), (a)) \
|| Is_Foo((arg), (b)))
Yes
xw
isFoo = true;
#ifdef UNICODE
text = wideBuff;
#else
text = buff;
#endif;
No
isFoo = true;
#ifdef UNICODE
text = wideBuff;
#else
text = buff;
#endif;
Yes
Y
void Foo()
{
// comment
if (isFoo)
bar();
}
No
void Foo()
{
// comment
if (isFoo)
bar();
}
0 indent
m0
if (a < b
|| c > d)
foo++;
if (a < b
|| c > d)
{
foo++;
}
1 indent
m1
if (a < b
|| c > d)
foo++;
if (a < b
|| c > d)
{
foo++;
}
2 indents
m2
if (a < b
|| c > d)
foo++;
if (a < b
|| c > d)
{
foo++;
}
0.5 indent
m3
if (a < b
|| c > d)
foo++;
if (a < b
|| c > d)
{
foo++;
}
Range : 40-120
M
fooArray[] = { red,
green,
blue };
fooFunction(barArg1,
barArg2,
barArg3);
becomes (with larger value)
fooArray[] = { red,
green,
blue };
fooFunction(barArg1,
barArg2,
barArg3);
Yes
f
isFoo = true;
if (isFoo) {
bar();
} else {
anotherBar();
}
isBar = false;
No
isFoo = true;
if (isFoo) {
bar();
} else {
anotherBar();
}
isBar = false;
Yes
F
isFoo = true;
if (isFoo) {
bar();
} else {
anotherBar();
}
isBar = false;
No
isFoo = true;
if (isFoo) {
bar();
} else {
anotherBar();
}
isBar = false;
Yes
p
if (foo == 2)
a = bar((b - c) * a, d--);
No
if (foo==2)
a=bar((b-c)*a,d--);
Yes
xg
if (isFoo(a, b)
bar(a, b);
No
if (isFoo(a,b)
bar(a,b);
Yes
P
if ( isFoo ( a, b ) )
bar ( a, b );
No
if (isFoo(a, b))
bar(a, b);
Yes
d
if (isFoo (a, b) )
bar (a, b);
No
if (isFoo(a, b))
bar(a, b);
Yes
D
if ( isFoo( a, b ) )
bar( a, b );
No
if (isFoo(a, b))
bar(a, b);
Yes
xd
if (isFoo ((a+2), b))
bar (a, b);
No
if (isFoo((a+2), b))
bar(a, b);
Yes
H
if (isFoo(a, b))
bar(a, b);
No
if(isFoo(a, b))
bar(a, b);
Yes
U
if(isFoo(a, b))
bar(a, b);
No
if ( isFoo( a, b ) )
bar ( a, b );
Yes
xe
void Foo()
{
foo1 = 1;
foo2 = 2;
}
No
void Foo()
{
foo1 = 1;
foo2 = 2;
}
Yes
E
void Foo(bool isFoo) {
****if (isFoo) {
********bar();
****}
****
****else {
********anotherBar();
****}
}
No
void Foo(bool isFoo) {
****if (isFoo) {
********bar();
****}
****else {
********anotherBar();
****}
}
None
char *foo1;
char& foo2;
//remains unchanged.
Type
k1
char* foo1;
char& foo2;
Middle
k2
char * foo1;
char & foo2;
Name
k3
char *foo1;
char &foo2;
Same
char &foo1;
//same as pointer.
None
W0
char &foo1;
//remains unchanged.
Type
W1
char& foo1;
Middle
W2
char & foo1;
Name
W3
char &foo1;
Yes
y
void Foo(bool isFoo) {
if (isFoo) {
bar();
}
else {
anotherBar();
}
}
No
void Foo(bool isFoo) {
if (isFoo) {
bar();
} else {
anotherBar();
}
}
Yes
e
if (isFoo) {
bar();
}
else
if (isFoo1()) {
bar1();
}
else
if (isFoo2()) {
bar2();
}
No
if (isFoo) {
bar();
}
else if (isFoo1()) {
bar1();
}
else if (isFoo2()) }
bar2;
}
Yes
xb
void Foo(bool isFoo)
{
if (isFoo1)
bar1();
if (isFoo2) {
bar2();
}
}
No
void Foo(bool isFoo)
{
if (isFoo1) bar1();
if (isFoo2) { bar2(); }
}
Yes
j
if (isFoo) {
isFoo = false;
}
No
if (isFoo)
isFoo = false;
Yes
J
if (isFoo)
{ isFoo = false; }
No
if (isFoo)
isFoo = false;
Yes
xj
if (isFoo)
isFoo = false;
No
if (isFoo)
{
isFoo = false;
}
Yes
xB
void
Foo(bool isFoo) {}
No
void Foo(bool isFoo) {}
Yes
xD
void
Foo(bool isFoo);
No
void Foo(bool isFoo);
Yes
xf
void Foo(bool isFoo) {}
No
void
Foo(bool isFoo) {}
Yes
xh
void Foo(bool isFoo);
No
void
Foo(bool isFoo);
Yes
O
if (isFoo)
{ isFoo = false; cout << isFoo << endl; }
//remains unchanged.
No
if (isFoo)
{ isFoo = false; cout << isFoo << endl; }
Yes
o
if (isFoo)
{
isFoo = false; cout << isFoo << endl;
}
//remains unchanged.
No
if (isFoo)
{
isFoo = false; cout << isFoo << endl;
}
Yes
c
int Foo(bool isBar)********//Foo
{
int a****= b;
}
No
int Foo(bool isBar)--->--->//Foo
{
int a--->= b;
}
Yes
xy
Stack<int,List<int>> stack1;
No
Stack< int,List< int > > stack1;
Yes
xp
/*
comment line 1
comment line 2
*/
No
/*
* comment line 1
* comment line 2
*/
Yes
xC
if (thisVariable1 == thatVariable1
|| thisVariable2 == thatVariable2
|| thisVariable3 == thatVariable3)
bar();
No
if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3)
bar();
Range : 50-200
*Attach to previous short
//Max code length50
if (thisVariable1 == thatVariable1
|| thisVariable2 == thatVariable2
|| thisVariable3 == thatVariable3)
bar();
//Max code length100
if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2
|| thisVariable3 == thatVariable3)
bar();
Yes
xL
if (thisVariable1 == thatVariable1 ||
thisVariable2 == thatVariable2 ||
thisVariable3 == thatVariable3)
bar();
No
if (thisVariable1 == thatVariable1
|| thisVariable2 == thatVariable2
|| thisVariable3 == thatVariable3)
bar();
Yes
xQ
- (void)foo1;
- (void)foo2;
No
-(void)foo1;
- (void)foo2;
Yes
xR
-(void) foo1;
-(void) foo2;
No
- (void) foo1;
- (void) foo2;
Yes
xq
-(void) foo1;
-(void) foo2;
No
-(void)foo1;
-(void) foo2;
Yes
xr
-(void)foo1;
-(void)foo2;
No
-(void) foo1;
-(void) foo2;
Yes
xS
-(void)foo1: (bool) barArg1;
-(void)foo2: (bool) barArg2;
No
-(void)foo1:(bool)barArg1;
-(void)foo2: (bool) barArg2;
Yes
xs
-(void)foo1:(bool)barArg1;
-(void)foo2:(bool)barArg2;
No
-(void)foo1: (bool) barArg1;
-(void)foo2: (bool) barArg2;
Yes
xM
-(void)deleteKey:(id)key
atIndex:(int)index
ofNode:(Node*)node;
No
-(void)deleteKey:(id)key
atIndex:(int)index
ofNode:(Node*)node;
Do no change
-(id)write :(NSString*)path
order :(int)ord
{
[file writeData :headData
atOffset :rootOffset];
}
//remains unchanged.
None
xP0
-(id)write:(NSString*)path
order:(int)ord
{
[file writeData:headData
atOffset:rootOffset];
}
All
xP1
-(id)write : (NSString*)path
order : (int)ord
{
[file writeData : headData
atOffset : rootOffset];
}
After
xP2
-(id)write: (NSString*)path
order: (int)ord
{
[file writeData: headData
atOffset: rootOffset];
}
Before
xP3
-(id)write :(NSString*)path
order :(int)ord
{
[file writeData :headData
atOffset :rootOffset];
}