public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* my handy-dandy, "coding style" script
@ 2006-12-19 15:46 Robert P. J. Day
  2006-12-19 16:41 ` Dave Jones
  0 siblings, 1 reply; 13+ messages in thread
From: Robert P. J. Day @ 2006-12-19 15:46 UTC (permalink / raw)
  To: Linux kernel mailing list


  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."

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-01-02  1:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-19 15:46 my handy-dandy, "coding style" script Robert P. J. Day
2006-12-19 16:41 ` Dave Jones
2006-12-19 17:42   ` Bob Copeland
2006-12-19 20:27     ` Jan Engelhardt
2006-12-19 21:24       ` David Rientjes
2006-12-19 22:01         ` Jan Engelhardt
2006-12-19 23:09           ` David Rientjes
2006-12-20 22:42       ` Bill Davidsen
2006-12-21 20:52         ` Jan Engelhardt
     [not found]           ` <1166741599.27218.7.camel@localhost>
2006-12-21 23:29             ` Jan Engelhardt
     [not found]               ` <1166744416.14803.1.camel@localhost>
2006-12-21 23:56                 ` Jan Engelhardt
2006-12-22  0:57               ` David Rientjes
2007-01-02  1:21       ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox