Tool for automatic style of coding guidelines

Bernd Petrovitsch bernd at petrovitsch.priv.at
Sat Jan 28 06:40:01 EST 2012


On Fre, 2012-01-27 at 13:55 -0500, Greg Freemyer wrote:
[...]
> BUT, can checkpatch actually modify the files?  I think I've only used
> it to identify issues, not resolve them.

Yup, and one wants actually no automatic repair in general because the
main goal of (the) coding style guide(s) is to keep a common "layout" so
that the code is easily readable and understandable and *not* to follow
some hard-coded rules.
Yes, for "spaces to tabs" one can do that (and actually emacsens can do
it with "indent-region" etc. without much hassle and it shouldn't be
that hard with global-find-and-replace in any decent editor).

So it's OK to "break" rules if the source gets obscured by following it.
The prime example is probably the line length where it doesn't get
better in any way (au contraire IMHO - it gets much worse) if
	printk("this is a very long format string and it is here for good reason");
is split on 2 lines.

And
	if (some_condition)
		x = 1;
	else {
		x = 4711;
		y = 45;
	}
also hurts my eyes.

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at




More information about the Kernelnewbies mailing list