mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* scripts: checkpatch.pl & Lindent (minor complaint)
@ 2013-11-12 14:42 Mimi Zohar
  2013-11-12 15:44 ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Mimi Zohar @ 2013-11-12 14:42 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: linux-kernel, Joe Perches

Hi, 

scripts/Lindent and scripts/checkpatch disagree whether the fields in a
statically initialized array should be blank separated.  

static struct ima_rule_entry default_rules[] = {
        {.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},

Lindent adds a blank before '.fsmagic', which checkpatch then complains
about (eg. commit 75834fc3).

thanks,

Mimi


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

* Re: scripts: checkpatch.pl & Lindent (minor complaint)
  2013-11-12 14:42 scripts: checkpatch.pl & Lindent (minor complaint) Mimi Zohar
@ 2013-11-12 15:44 ` Joe Perches
  2013-11-12 16:09   ` Mimi Zohar
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2013-11-12 15:44 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: Andy Whitcroft, linux-kernel

On Tue, 2013-11-12 at 09:42 -0500, Mimi Zohar wrote: 
> scripts/Lindent and scripts/checkpatch disagree whether the fields in a
> statically initialized array should be blank separated.  
> 
> static struct ima_rule_entry default_rules[] = {
>         {.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},
> 
> Lindent adds a blank before '.fsmagic', which checkpatch then complains
> about (eg. commit 75834fc3).

Perhaps I don't understand what you mean.

Lindent _doesn't_add a blank and checkpatch
seems to do the right thing here.

I'd just as soon delete Lindent.

$ git log --format=email -p -1 75834fc3 | ./scripts/checkpatch.pl -
WARNING: line over 80 characters
#35: FILE: security/integrity/ima/ima_policy.c:52:
+	{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},

ERROR: space required after that ',' (ctx:VxV)
#35: FILE: security/integrity/ima/ima_policy.c:52:
+	{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},
 	                       ^
[...]

$ ./scripts/Lindent security/integrity/ima/ima_policy.c 
$ git diff security/integrity/ima/ima_policy.c | ./scripts/checkpatch.pl -
ERROR: space required after that ',' (ctx:VxV)
#10: FILE: security/integrity/ima/ima_policy.c:72:
+	{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags =
 	                       ^

ERROR: space required after that ',' (ctx:VxV)
#10: FILE: security/integrity/ima/ima_policy.c:72:
+	{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags =
 	                                                   ^
[...]



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

* Re: scripts: checkpatch.pl & Lindent (minor complaint)
  2013-11-12 15:44 ` Joe Perches
@ 2013-11-12 16:09   ` Mimi Zohar
  2013-11-12 16:30     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Mimi Zohar @ 2013-11-12 16:09 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, linux-kernel

On Tue, 2013-11-12 at 07:44 -0800, Joe Perches wrote:
> On Tue, 2013-11-12 at 09:42 -0500, Mimi Zohar wrote: 
> > scripts/Lindent and scripts/checkpatch disagree whether the fields in a
> > statically initialized array should be blank separated.  
> > 
> > static struct ima_rule_entry default_rules[] = {
> >         {.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},
> > 
> > Lindent adds a blank before '.fsmagic', which checkpatch then complains
> > about (eg. commit 75834fc3).
> 
> Perhaps I don't understand what you mean.

> Lindent _doesn't_add a blank and checkpatch
> seems to do the right thing here.

Sorry, my mistake.  It's the reverse.  Checkpatch complains about the
missing blank, which Lindent then removes.

#40: FILE: security/integrity/ima/ima_policy.c:52:
+	{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags =
IMA_FSMAGIC},

ERROR: space required after that ',' (ctx:VxV)
#40: FILE: security/integrity/ima/ima_policy.c:52:
+	{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags =
IMA_FSMAGIC},
 	                       ^
ERROR: space required after that ',' (ctx:VxV)

Mimi


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

* Re: scripts: checkpatch.pl & Lindent (minor complaint)
  2013-11-12 16:09   ` Mimi Zohar
@ 2013-11-12 16:30     ` Joe Perches
  2013-11-12 16:51       ` Mimi Zohar
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2013-11-12 16:30 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: Andy Whitcroft, linux-kernel

On Tue, 2013-11-12 at 11:09 -0500, Mimi Zohar wrote:
> On Tue, 2013-11-12 at 07:44 -0800, Joe Perches wrote:
> > On Tue, 2013-11-12 at 09:42 -0500, Mimi Zohar wrote: 
> > > scripts/Lindent and scripts/checkpatch disagree whether the fields in a
> > > statically initialized array should be blank separated.  
> > > 
> > > static struct ima_rule_entry default_rules[] = {
> > >         {.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},
> > > 
> > > Lindent adds a blank before '.fsmagic', which checkpatch then complains
> > > about (eg. commit 75834fc3).
> > 
> > Perhaps I don't understand what you mean.
> 
> > Lindent _doesn't_add a blank and checkpatch
> > seems to do the right thing here.
> 
> Sorry, my mistake.  It's the reverse.  Checkpatch complains about the
> missing blank, which Lindent then removes.

My suggestion is not to use Lindent.

If you want a semi-automated source-code reformatting tool,
use scripts/checkpatch.pl --fix



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

* Re: scripts: checkpatch.pl & Lindent (minor complaint)
  2013-11-12 16:30     ` Joe Perches
@ 2013-11-12 16:51       ` Mimi Zohar
  2013-11-12 16:56         ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Mimi Zohar @ 2013-11-12 16:51 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, linux-kernel

On Tue, 2013-11-12 at 08:30 -0800, Joe Perches wrote:
> On Tue, 2013-11-12 at 11:09 -0500, Mimi Zohar wrote:
> > On Tue, 2013-11-12 at 07:44 -0800, Joe Perches wrote:
> > > On Tue, 2013-11-12 at 09:42 -0500, Mimi Zohar wrote: 
> > > > scripts/Lindent and scripts/checkpatch disagree whether the fields in a
> > > > statically initialized array should be blank separated.  
> > > > 
> > > > static struct ima_rule_entry default_rules[] = {
> > > >         {.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},
> > > > 
> > > > Lindent adds a blank before '.fsmagic', which checkpatch then complains
> > > > about (eg. commit 75834fc3).
> > > 
> > > Perhaps I don't understand what you mean.
> > 
> > > Lindent _doesn't_add a blank and checkpatch
> > > seems to do the right thing here.
> > 
> > Sorry, my mistake.  It's the reverse.  Checkpatch complains about the
> > missing blank, which Lindent then removes.
> 
> My suggestion is not to use Lindent.
> 
> If you want a semi-automated source-code reformatting tool,
> use scripts/checkpatch.pl --fix

Thanks, perhaps this suggestion should be reflected in
Documentation/CodingStyle.

Mimi


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

* Re: scripts: checkpatch.pl & Lindent (minor complaint)
  2013-11-12 16:51       ` Mimi Zohar
@ 2013-11-12 16:56         ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2013-11-12 16:56 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: Andy Whitcroft, linux-kernel

On Tue, 2013-11-12 at 11:51 -0500, Mimi Zohar wrote:
> On Tue, 2013-11-12 at 08:30 -0800, Joe Perches wrote:
[]
> > My suggestion is not to use Lindent.
> > 
> > If you want a semi-automated source-code reformatting tool,
> > use scripts/checkpatch.pl --fix
> 
> Thanks, perhaps this suggestion should be reflected in
> Documentation/CodingStyle.

I sent a patch awhile ago

https://lkml.org/lkml/2013/2/11/390



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

end of thread, other threads:[~2013-11-12 16:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-12 14:42 scripts: checkpatch.pl & Lindent (minor complaint) Mimi Zohar
2013-11-12 15:44 ` Joe Perches
2013-11-12 16:09   ` Mimi Zohar
2013-11-12 16:30     ` Joe Perches
2013-11-12 16:51       ` Mimi Zohar
2013-11-12 16:56         ` Joe Perches

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

all inboxes | Powered by JetHome®