* Tool for automatic style of coding guidelines
@ 2012-01-27 12:20 Prajosh Premdas
2012-01-27 14:18 ` Philipp Ittershagen
2012-01-27 18:15 ` Greg KH
0 siblings, 2 replies; 7+ messages in thread
From: Prajosh Premdas @ 2012-01-27 12:20 UTC (permalink / raw)
To: kernelnewbies
Hi
I have developed some kernel drivers and would like to send the patches for
review. But i find that I have not followed the coding guideline for tabs
and spaces properly, which can be easily corrected by using some tools like
astyle.
Can any body please help me with the proper commands string for the astyle
tool? Or could any body please suggest me with any new tool like indent etc
which you are using
--
Regards,
Prajosh Premdas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120127/c4b9ebf5/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Tool for automatic style of coding guidelines
2012-01-27 12:20 Tool for automatic style of coding guidelines Prajosh Premdas
@ 2012-01-27 14:18 ` Philipp Ittershagen
2012-01-27 18:55 ` Greg Freemyer
2012-01-27 18:15 ` Greg KH
1 sibling, 1 reply; 7+ messages in thread
From: Philipp Ittershagen @ 2012-01-27 14:18 UTC (permalink / raw)
To: kernelnewbies
Hi Prajosh,
On Fri, Jan 27, 2012 at 1:20 PM, Prajosh Premdas
<premdas.prajosh@gmail.com> wrote:
> Hi
>
> I have developed some kernel drivers and would like to send the patches for
> review. But i find that I have not followed the coding guideline for tabs
> and spaces properly, which can be easily corrected by using some tools like
> astyle.
>
> Can any body please help me with the proper commands string for the astyle
> tool? Or could any body please suggest me with any new tool like indent etc
> which you are using
>
there is a script called checkpatch.pl in the srcipts/ subdirectory.
It will show you the problems with your code style among other things.
The kernel maintainers strongly suggest to use the script before
posting any patches so that any major (style) flaws like indent etc.
can be fixed before posting the patch to the mailing list.
Hope this helps!
Philipp
O
^ permalink raw reply [flat|nested] 7+ messages in thread
* Tool for automatic style of coding guidelines
2012-01-27 14:18 ` Philipp Ittershagen
@ 2012-01-27 18:55 ` Greg Freemyer
2012-01-28 11:40 ` Bernd Petrovitsch
0 siblings, 1 reply; 7+ messages in thread
From: Greg Freemyer @ 2012-01-27 18:55 UTC (permalink / raw)
To: kernelnewbies
On Fri, Jan 27, 2012 at 9:18 AM, Philipp Ittershagen
<p.ittershagen@googlemail.com> wrote:
> Hi Prajosh,
>
> On Fri, Jan 27, 2012 at 1:20 PM, Prajosh Premdas
> <premdas.prajosh@gmail.com> wrote:
>> Hi
>>
>> I have developed some kernel drivers and would like to send the patches for
>> review. But i find that I have not followed the coding guideline for tabs
>> and spaces properly, which can be easily corrected by using some tools like
>> astyle.
>>
>> Can any body please help me with the proper commands string for the astyle
>> tool? Or could any body please suggest me with any new tool like indent etc
>> which you are using
>>
>
> there is a script called checkpatch.pl in the srcipts/ subdirectory.
> It will show you the problems with your code style among other things.
> The kernel maintainers strongly suggest to use the script before
> posting any patches so that any major (style) flaws like indent etc.
> can be fixed before posting the patch to the mailing list.
>
>
> Hope this helps!
>
> ?Philipp
And don't forget it has various options (see checkpatch -h).
One is "-f" which allows you to check a normal source file, not a patch.
BUT, can checkpatch actually modify the files? I think I've only used
it to identify issues, not resolve them.
Greg
^ permalink raw reply [flat|nested] 7+ messages in thread
* Tool for automatic style of coding guidelines
2012-01-27 18:55 ` Greg Freemyer
@ 2012-01-28 11:40 ` Bernd Petrovitsch
0 siblings, 0 replies; 7+ messages in thread
From: Bernd Petrovitsch @ 2012-01-28 11:40 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Tool for automatic style of coding guidelines
2012-01-27 12:20 Tool for automatic style of coding guidelines Prajosh Premdas
2012-01-27 14:18 ` Philipp Ittershagen
@ 2012-01-27 18:15 ` Greg KH
2012-01-28 18:35 ` Adil Mujeeb
1 sibling, 1 reply; 7+ messages in thread
From: Greg KH @ 2012-01-27 18:15 UTC (permalink / raw)
To: kernelnewbies
On Fri, Jan 27, 2012 at 05:50:30PM +0530, Prajosh Premdas wrote:
> Hi?
>
> I have developed some kernel drivers and would like to send the patches for
> review. But i find that I have not followed the coding guideline for tabs and
> spaces properly, which can be easily corrected by using some tools like
> astyle.?
>
> Can any body please help me with the proper commands string for the astyle
> tool? Or could any body please suggest me with any new tool like indent etc
> which you are using
scripts/Lindent will give you a good start, but odds are you really want
to do this by hand, it will be easier in the end as indent can do some
strange things at times.
good luck,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Tool for automatic style of coding guidelines
2012-01-27 18:15 ` Greg KH
@ 2012-01-28 18:35 ` Adil Mujeeb
2012-01-30 15:06 ` Prajosh Premdas
0 siblings, 1 reply; 7+ messages in thread
From: Adil Mujeeb @ 2012-01-28 18:35 UTC (permalink / raw)
To: kernelnewbies
On Fri, Jan 27, 2012 at 11:45 PM, Greg KH <greg@kroah.com> wrote:
> On Fri, Jan 27, 2012 at 05:50:30PM +0530, Prajosh Premdas wrote:
>> Hi
>>
>> I have developed some kernel drivers and would like to send the patches for
>> review. But i find that I have not followed the coding guideline for tabs and
>> spaces properly, which can be easily corrected by using some tools like
>> astyle.
>>
>> Can any body please help me with the proper commands string for the astyle
>> tool? Or could any body please suggest me with any new tool like indent etc
>> which you are using
>
> scripts/Lindent will give you a good start, but odds are you really want
> to do this by hand, it will be easier in the end as indent can do some
> strange things at times.
>
> good luck,
>
> greg k-h
You can see this excellent video [1] where Greg has explained how to
submit your first patch.
[1] http://www.youtube.com/watch?v=LLBrBBImJt4
Regards,
Adil
^ permalink raw reply [flat|nested] 7+ messages in thread
* Tool for automatic style of coding guidelines
2012-01-28 18:35 ` Adil Mujeeb
@ 2012-01-30 15:06 ` Prajosh Premdas
0 siblings, 0 replies; 7+ messages in thread
From: Prajosh Premdas @ 2012-01-30 15:06 UTC (permalink / raw)
To: kernelnewbies
Thanks for the suggestions and video links
Got the patches clean for review
On Sun, Jan 29, 2012 at 12:05 AM, Adil Mujeeb <mujeeb.adil@gmail.com> wrote:
> On Fri, Jan 27, 2012 at 11:45 PM, Greg KH <greg@kroah.com> wrote:
> > On Fri, Jan 27, 2012 at 05:50:30PM +0530, Prajosh Premdas wrote:
> >> Hi
> >>
> >> I have developed some kernel drivers and would like to send the patches
> for
> >> review. But i find that I have not followed the coding guideline for
> tabs and
> >> spaces properly, which can be easily corrected by using some tools like
> >> astyle.
> >>
> >> Can any body please help me with the proper commands string for the
> astyle
> >> tool? Or could any body please suggest me with any new tool like indent
> etc
> >> which you are using
> >
> > scripts/Lindent will give you a good start, but odds are you really want
> > to do this by hand, it will be easier in the end as indent can do some
> > strange things at times.
> >
> > good luck,
> >
> > greg k-h
>
> You can see this excellent video [1] where Greg has explained how to
> submit your first patch.
>
> [1] http://www.youtube.com/watch?v=LLBrBBImJt4
>
> Regards,
> Adil
>
--
Regards,
Prajosh Premdas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120130/c2bde284/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-01-30 15:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-27 12:20 Tool for automatic style of coding guidelines Prajosh Premdas
2012-01-27 14:18 ` Philipp Ittershagen
2012-01-27 18:55 ` Greg Freemyer
2012-01-28 11:40 ` Bernd Petrovitsch
2012-01-27 18:15 ` Greg KH
2012-01-28 18:35 ` Adil Mujeeb
2012-01-30 15:06 ` Prajosh Premdas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).