Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#7 Brace placement affecting LOC

v1.0 (example)
open
nobody
None
1
2013-09-10
2013-09-10
No

Brace placement seems to affect the "lines of code" count. For example, the following:

public static void main(final String[] the_args)
{
if (the_args.length > 0)
{
System.err.println("Invalid number of arguments.");
System.exit(1);
}
}

is counted as 5 lines of code, whereas:

public static void main(final String[] the_args) {
if (the_args.length > 0) {
System.err.println("Invalid number of arguments.");
System.exit(1);
}
}

is counted as 4 lines of code. Really, they probably should both be 3 lines of code because braces on lines by themselves shouldn't count as lines...

Discussion