App-cloc
view release on metacpan or search on metacpan
my $sec = 'SUM:';
$res .= "$sec\n";
foreach (@rows) {
$res .= sprintf(" %-18s %14s %14s %14s %14s\n",
$_, $HoH{$sec}{"${_}${dl}${cols[0]}"},
$HoH{$sec}{"${_}${dl}${cols[1]}"},
$HoH{$sec}{"${_}${dl}${cols[2]}"},
$HoH{$sec}{"${_}${dl}${cols[3]}"});
}
$res .= sprintf("%s\n", "-" x $width);
return $res;
} # 1}}}
sub get_time { # {{{1
if ($HAVE_Time_HiRes) {
return Time::HiRes::time();
} else {
return time();
}
} # 1}}}
sub really_is_D { # {{{1
# Ref bug 131, files ending with .d could be init.d scripts
# instead of D language source files.
my ($file , # in
$rh_Err , # in hash of error codes
$raa_errors , # out
) = @_;
print "-> really_is_D($file)\n" if $opt_v > 2;
my $possible_script = peek_at_first_line($file, $rh_Err, $raa_errors);
print "<- really_is_D($file)\n" if $opt_v > 2;
return $possible_script; # null string if D, otherwise a language
} # 1}}}
sub no_autogen_files { # {{{1
# ref https://github.com/AlDanial/cloc/issues/151
my ($print,) = @_;
print "-> no_autogen($print)\n" if $opt_v > 2;
# These sometimes created manually?
# acinclude.m4
# configure.ac
# Makefile.am
my @files = qw (
aclocal.m4
announce-gen
autogen.sh
bootstrap
compile
config.guess
config.h.in
config.rpath
config.status
config.sub
configure
configure.in
depcomp
gendocs.sh
gitlog-to-changelog
git-version-gen
gnupload
gnu-web-doc-update
install-sh
libtool
libtool.m4
link-warning.h
ltmain.sh
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.in
ltversion.m4
Makefile.in
mdate-sh
missing
mkinstalldirs
test-driver
texinfo.tex
update-copyright
useless-if-before-free
vc-list-files
ylwrap
);
if ($print) {
printf "cloc will ignore these %d files with --no-autogen:\n", scalar @files;
foreach my $F (@files) {
print " $F\n";
}
print "Additionally, Go files with '// Code generated by .* DO NOT EDIT.'\n";
print "on the first line are ignored.\n";
}
print "<- no_autogen()\n" if $opt_v > 2;
return @files;
} # 1}}}
# subroutines copied from SLOCCount
my %lex_files = (); # really_is_lex()
my %expect_files = (); # really_is_expect()
my %php_files = (); # really_is_php()
sub really_is_lex { # {{{1
# Given filename, returns TRUE if its contents really is lex.
# lex file must have "%%", "%{", and "%}".
# In theory, a lex file doesn't need "%{" and "%}", but in practice
# they all have them, and requiring them avoid mislabeling a
# non-lexfile as a lex file.
my $filename = shift;
chomp($filename);
my $is_lex = 0; # Value to determine.
my $percent_percent = 0;
my $percent_opencurly = 0;
my $percent_closecurly = 0;
# Return cached result, if available:
if ($lex_files{$filename}) { return $lex_files{$filename};}
open(LEX_FILE, "<$filename") ||
die "Can't open $filename to determine if it's lex.\n";
while(<LEX_FILE>) {
$percent_percent++ if (m/^\s*\%\%/);
( run in 0.762 second using v1.01-cache-2.11-cpan-b16cb0d3907 )