first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / scripts / buildor / buildor_find_bad.sh
1 #!/bin/bash
2
3 # looks for bad usages in source files.
4
5 # this script is by no means finished.  it also may not be very accurate yet.
6
7 # look for files that provide a copyright year, but are still tied to a
8 # non-variable end year.  we are replacing all end years with $now, since
9 # we intend the copyright to last as long as legally valid.
10 echo "---> Looking for incorrect year attributions..."
11 find $* -type f -exec grep -li "[0-9][0-9]-[12][90]" {} ';' | grep -v ".*\.svn.*"
12
13 # look for includes that are more than one level but which are using double
14 # quotes instead of angle brackets.
15 echo "---> Looking for inappropriate double quote usage in #includes now..."
16 find $* -type f -exec grep -li "#include.*\"[a-zA-Z0-9._]*\/[a-zA-Z0-9._]*\"" {} ';' | grep -v ".*\.svn.*"
17
18 # look for includes that are using the dreaded dos style backslash for
19 # directory separators.  those are non-portable, but forward slash works
20 # everywhere.
21 echo "---> Looking for backslash usage in #includes now..."
22 find $* -type f -exec grep -li "#include[^\"]*\"[^\"]*\\\\[^\"]*\"" {} ';' | grep -v ".*\.svn.*"
23 find $* -type f -exec grep -li "#include[^<]*<[^>]*\\\\[^>]*>" {} ';' | grep -v ".*\.svn.*"
24
25 # check for if statements with dangerous assignments involved.
26 echo "---> Looking for dangerous assignments in source now..."
27 find $* -type f -exec grep -li "if[^A-Za-z0-9]*(.*[a-z A-Z()]=[-+a-z A-Z()!].*)" {} ';' | grep -v ".*\.svn.*"
28 # not quite right; this needs to be done from a parser so we can catch the
29 # best matching occurrences.
30