my handy-dandy, "coding style" script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  just for fun, i threw the following together to peruse the tree (or
any subdirectory) and look for stuff that violates the CodingStyle
guide.  clearly, it's far from complete and very ad hoc, but it's
amusing.  extra searches happily accepted.

rday



#!/bin/sh

DIR=${1-.}

echo -e "\n===== Deprecated 'depends' in Kconfig files ...\n"
grep depends $(find . -name Kconfig) | grep -v "depends on"

echo -e "\n===== Potentially unnecessary casting of k[cmz]alloc() calls ...\n"
grep -Er "\([^\)]+\) ?k[cmz]alloc ?\(" *

echo -e "\n===== Discouraged kcalloc(1,...) calls ...\n"
grep -Er "kcalloc ?\(1," *

echo -e "\n===== Where ARRAY_SIZE() should be used ...\n"
grep -Er "sizeof\((.*)\) ?/ ?sizeof\(\1\[0\]\)" *

echo -e "\n===== Where FIELD_SIZEOF() should be used ...\n"
grep -Er "sizeof ?\( ?\( ?\([^\*]*[^ ] ?\*\) ?0 ?\)->[^\)]+\)" *

echo -e "\n===== People who seem to be redefining MAX() or MIN() ...\n"
grep -Er "# +define +MAX ?\(" *
grep -Er "# +define +MIN ?\(" *

echo -e "\nDone."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux