Open GoogleCodeExporter opened 8 years ago
Further investigation shows that the issue is related to end-of-line comments
that
share the same line as code. These lines get counted twice, once as NBLC and
once as
a comment. The XML output for total lines is:
$fileInfoHash{'totalLines'} = $src_lines + $cmnt_lines + $blank_lines;
where the console output for total lines is:
$CNTS{'Lines'}
The following patch seems to resolve the issue for me. However, there may be a
good
reason that totalLines was recalculated for the XML output so this patch may
not be
the correct fix.
--- workspace/archives/sclc-2.5.525/src/sclc 2007-05-25 14:37:24.000000000
-0400
+++ /usr/local/bin/sclc 2008-02-28 09:26:31.000000000 -0500
@@ -2356,6 +2356,7 @@
my $src_lines = 0;
my $cmnt_lines = 0;
my $blank_lines = 0;
+ my $lines = 0;
foreach (@$Name) {
my $set = $CNTS{lc $_};
@@ -2366,7 +2367,8 @@
}
elsif ($_ eq 'Lines') {
# Don't need lines with included blanks.
- #$lines = $$Count{"$type$_"};
+ $lines = $$Count{"$type$_"};
+ $fileInfoHash{'totalLines'} = $lines;
}
elsif ($_ eq 'Blank') {
$blank_lines = $$Count{"$type$_"} || 0;
@@ -2381,7 +2383,7 @@
}
}
# calculate total lines (cmmnts + src + blank)
- $fileInfoHash{'totalLines'} = $src_lines + $cmnt_lines + $blank_lines;
+ #$fileInfoHash{'totalLines'} = $src_lines + $cmnt_lines + $blank_lines;
# Get MPI and OpenMP counts
if($language eq 'C++' || $language eq 'C' || $language eq 'FORTRAN') {
Original comment by mike.i...@gmail.com
on 28 Feb 2008 at 2:28
Issue 9 has been merged into this issue.
Original comment by lorinh
on 6 Apr 2010 at 1:42
Original issue reported on code.google.com by
mike.i...@gmail.com
on 27 Feb 2008 at 8:13Attachments: