App-cloc
view release on metacpan or search on metacpan
name per line. Only exact matches are ignored;
relative path names will be resolved starting from
the directory where cloc is invoked.
See also --list-file.
--fullpath Modifies the behavior of --match-f, --not-match-f,
and --not-match-d to include the file's path
in the regex, not just the file's basename.
(This does not expand each file to include its
absolute path, instead it uses as much of
the path as is passed in to cloc.)
Note: --match-d always looks at the full
path and therefore is unaffected by --fullpath.
--include-lang=<L1>[,L2,] Count only the given comma separated languages
L1, L2, L3, et cetera.
--match-d=<regex> Only count files in directories matching the Perl
regex. For example
--match-d='/(src|include)/'
only counts files in directories containing
/src/ or /include/. Unlike --not-match-d,
--match-f, and --not-match-f, --match-d always
compares the fully qualified path against the
next;
} elsif ($opt_force_git or $file_or_dir =~ m/$hash_regex/) {
$git_hash{$file_or_dir} = $i;
} # else the input can't be understood; ignore for now
}
return unless %git_hash;
my $have_tar_git = external_utility_exists($ON_WINDOWS ? "unzip" : "tar --version") &&
external_utility_exists("git --version");
if (!$have_tar_git) {
warn "One or more inputs looks like a git hash but " .
"either git or tar is unavailable.\n";
return;
}
my %repo_listing = (); # $repo_listing{hash}{files} = 1;
foreach my $hash (sort keys %git_hash) {
my $git_list_cmd = "git ls-tree --name-only -r $hash";
print "$git_list_cmd\n" if $opt_v;
foreach my $file (`$git_list_cmd`) {
$file =~ s/\s+$//;
# file name.
my %normalized = ();
foreach my $F (@files) {
my $F_norm = $F;
if ($ON_WINDOWS) {
$F_norm = lc $F_norm; # for case insensitive file name comparisons
$F_norm =~ s{\\}{/}g; # Windows directory separators to Unix
$F_norm =~ s{^\./}{}g; # remove leading ./
if (($F_norm !~ m{^/}) and ($F_norm !~ m{^\w:/})) {
# looks like a relative path; prefix with cwd
$F_norm = lc "$cwd/$F_norm";
}
} else {
$F_norm =~ s{^\./}{}g; # remove leading ./
if ($F_norm !~ m{^/}) {
# looks like a relative path; prefix with cwd
$F_norm = lc "$cwd/$F_norm";
}
}
# Remove trailing / so it does not interfere with further regex code
# that does not expect it
$F_norm =~ s{/+$}{};
$normalized{ $F_norm } = $F;
}
return %normalized;
} # 1}}}
# (such as /usr/src/redhat/BUILD/ispell-3.1/dicts/czech/glob.p),
# others are C extractions
# (such as /usr/src/redhat/BUILD/linux/include/linux/umsdos_fs.p
# and some files in linuxconf).
# However, test files in "p2c" really are Pascal, for example.
# Note that /usr/src/redhat/BUILD/ucd-snmp-4.1.1/ov/bitmaps/UCD.20.p
# is actually C code. The heuristics determine that they're not Pascal,
# but because it ends in ".p" it's not counted as C code either.
# I believe this is actually correct behavior, because frankly it
# looks like it's automatically generated (it's a bitmap expressed as code).
# Rather than guess otherwise, we don't include it in a list of
# source files. Let's face it, someone who creates C files ending in ".p"
# and expects them to be counted by default as C files in SLOCCount needs
# their head examined. I suggest examining their head
# with a sucker rod (see syslogd(8) for more on sucker rods).
# This heuristic counts as Pascal such files such as:
# /usr/src/redhat/BUILD/teTeX-1.0/texk/web2c/tangleboot.p
# Which is hand-generated. We don't count woven documents now anyway,
# so this is justifiable.
( run in 0.568 second using v1.01-cache-2.11-cpan-64827b87656 )