removed the 'scripts' folder. I don't think it belongs in the cppcheck repo.
This commit is contained in:
parent
ca2e8b057b
commit
4258705ce3
|
@ -1,47 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# Missing comments (it is a good idea to write a comment before a variable declaration)
|
||||
# usage:
|
||||
# scripts/comment.pl lib/checkstl.cpp
|
||||
sub checkfile
|
||||
{
|
||||
my $filename = $_[0];
|
||||
|
||||
# parse file
|
||||
open(FILE, $filename);
|
||||
my @lines = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
# check comments..
|
||||
my $comment = false;
|
||||
my $linenr = 0;
|
||||
foreach $line (@lines)
|
||||
{
|
||||
$linenr = $linenr + 1;
|
||||
|
||||
# missing comment before variable declaration?
|
||||
if (($comment == 0) &&
|
||||
($line =~ /^\s+([a-z]+)? [a-z]+(\s)+[a-z][a-z0-9]*\s*[;=]/) &&
|
||||
(!($line =~ /return|delete|operator/)))
|
||||
{
|
||||
print "[$filename:$linenr] No comment before variable declaration\n";
|
||||
}
|
||||
|
||||
# set comment variable
|
||||
if (($line =~ /\/\//) || ($line =~ /\/\*/))
|
||||
{
|
||||
$comment = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$comment = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach $filename (@ARGV)
|
||||
{
|
||||
checkfile($filename)
|
||||
}
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# warn if there are #define in the code. it is often preferred with "const"
|
||||
# usage:
|
||||
# scripts/define.pl lib/checkstl.cpp
|
||||
|
||||
sub checkfile
|
||||
{
|
||||
my $filename = $_[0];
|
||||
|
||||
# parse file
|
||||
open(FILE, $filename);
|
||||
my @lines = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
# check comments..
|
||||
my $linenr = 0;
|
||||
foreach $line (@lines)
|
||||
{
|
||||
$linenr = $linenr + 1;
|
||||
|
||||
# is there a define?
|
||||
if ($line =~ /^#define\s+[A-Za-z0-9_]+\s+[^\s]/)
|
||||
{
|
||||
print "[$filename:$linenr] found #define\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach $filename (@ARGV)
|
||||
{
|
||||
checkfile($filename)
|
||||
}
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# warn if there are magic numbers in the code.
|
||||
# usage:
|
||||
# scripts/magic-numbers.pl lib/checkstl.cpp
|
||||
|
||||
sub checkfile
|
||||
{
|
||||
my $filename = $_[0];
|
||||
|
||||
# parse file
|
||||
open(FILE, $filename);
|
||||
my @lines = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
# check comments..
|
||||
my $linenr = 0;
|
||||
foreach $line (@lines)
|
||||
{
|
||||
$linenr = $linenr + 1;
|
||||
|
||||
# is there a magic number?
|
||||
if (($line =~ /[^a-zA-Z0-9_][0-9]{3,}/) &&
|
||||
(!($line =~ /define|const|(\/\/)/)))
|
||||
{
|
||||
print "[$filename:$linenr] Magic number\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach $filename (@ARGV)
|
||||
{
|
||||
checkfile($filename)
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
simple perl scripts that performs stylistic checking of C/C++ source code.
|
||||
|
||||
They are not intended to be 'released' as extra checks. I will just use them
|
||||
to check the Cppcheck source code.
|
||||
|
||||
feel free to try them.
|
||||
|
||||
feel free to add additional scripts.
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# warn if there are tabs in string constants, it can have surprising effects.
|
||||
# example usage:
|
||||
# scripts/tabs.pl lib/checkstl.cpp
|
||||
|
||||
sub checkfile
|
||||
{
|
||||
my $filename = $_[0];
|
||||
|
||||
# parse file
|
||||
open(FILE, $filename);
|
||||
my @lines = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
# check comments..
|
||||
my $linenr = 0;
|
||||
foreach $line (@lines)
|
||||
{
|
||||
$linenr = $linenr + 1;
|
||||
|
||||
# is there a tab in a string
|
||||
if ($line =~ /".*\t.*"/)
|
||||
{
|
||||
print "[$filename:$linenr] tab inside string constant\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach $filename (@ARGV)
|
||||
{
|
||||
checkfile($filename)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue