Menu

#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


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.