diff --git a/scripts/comment.pl b/scripts/comment.pl deleted file mode 100755 index 57a310e8f..000000000 --- a/scripts/comment.pl +++ /dev/null @@ -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 = ; - 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) -} - - diff --git a/scripts/define.pl b/scripts/define.pl deleted file mode 100755 index a6b7c0296..000000000 --- a/scripts/define.pl +++ /dev/null @@ -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 = ; - 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) -} - - diff --git a/scripts/magic-numbers.pl b/scripts/magic-numbers.pl deleted file mode 100755 index 9c9917d98..000000000 --- a/scripts/magic-numbers.pl +++ /dev/null @@ -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 = ; - 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) -} - - diff --git a/scripts/readme.txt b/scripts/readme.txt deleted file mode 100644 index dabb1159e..000000000 --- a/scripts/readme.txt +++ /dev/null @@ -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. - diff --git a/scripts/tabs.pl b/scripts/tabs.pl deleted file mode 100755 index bf58359ae..000000000 --- a/scripts/tabs.pl +++ /dev/null @@ -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 = ; - 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) -} - -