2019-10-24 22:18:41

by zhongshiqi

[permalink] [raw]
Subject: [PATCH v2] coccicheck:support $COCCI being defined as a directory

Put a modification in scripts/coccicheck which supports users in
configuring COCCI parameter as a directory to traverse files in
directory whose next level directory contains rule files with Suffix of
cocci.

Signed-off-by: zhongshiqi <[email protected]>
---
Changes in v2:
1.fix patch subject according to the reply by Markus
<[email protected]>
2.change description in “imperative mood”

scripts/coccicheck | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index e04d328..a1c4197 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
coccinelle $f
done
+elif [ -d "$COCCI" ] ; then
+ for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
+ coccinelle $f
+ done
else
coccinelle $COCCI
fi
--
2.9.5


2019-10-24 22:18:55

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH v2] coccicheck:support $COCCI being defined as a directory



On Thu, 24 Oct 2019, zhongshiqi wrote:

> Put a modification in scripts/coccicheck which supports users in
> configuring COCCI parameter as a directory to traverse files in
> directory whose next level directory contains rule files with Suffix of
> cocci.

While I thought the original was fine, if we are going to strive for
perfection, there are some things that could be changed. First there
should be a space in the subject line after the :

Second the commit log could be more concise as:

Allow defining COCCI as a directory that contains .cocci files.

In general, at least in simple cases, it is not necessary to mention the
name of the file you are modifying in the comit log, because one can see
that just below from looking at the diffstat and the patch.

thanks,
julia

>
> Signed-off-by: zhongshiqi <[email protected]>
> ---
> Changes in v2:
> 1.fix patch subject according to the reply by Markus
> <[email protected]>
> 2.change description in “imperative mood”
>
> scripts/coccicheck | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index e04d328..a1c4197 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
> for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
> coccinelle $f
> done
> +elif [ -d "$COCCI" ] ; then
> + for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
> + coccinelle $f
> + done
> else
> coccinelle $COCCI
> fi
> --
> 2.9.5
>
>

2019-10-24 22:19:32

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH v2] coccicheck: support $COCCI being defined as a directory

I find that the commit message should still be considerably improved.
How do you think about to use the subject “[PATCH] coccicheck:
Support search for SmPL scripts within selected directory hierarchy”?


> Put a modification in scripts/coccicheck which supports users in
> configuring COCCI parameter as a directory to traverse files in
> directory whose next level directory contains rule files with Suffix of cocci.

* Please avoid a typo in this change description.

* Would you like to integrate a wording approach like the following?

A search can be performed for SmPL scripts within a directory hierarchy.
Start a corresponding file determination if the environment variable “COCCI”
contains an acceptable path.


Regards,
Markus

2019-10-24 22:32:21

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH v2] coccicheck: support $COCCI being defined as a directory

> Second the commit log could be more concise as:

I like your desire for choosing a more appropriate commit message.


> Allow defining COCCI as a directory that contains .cocci files.

I would prefer to concentrate the patch subject on other information.


> In general, at least in simple cases, it is not necessary to mention the
> name of the file you are modifying in the comit log, because one can see
> that just below from looking at the diffstat and the patch.

This view can be reasonable. - How does it fit to the usual requirement
for the specification of a “subsystem” (or “prefix”) according to the
canonical patch format?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=13b86bc4cd648eae69fdcf3d04b2750c76350053#n656

Regards,
Markus

2019-10-24 22:59:19

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH v2] coccicheck: support $COCCI being defined as a directory



On Thu, 24 Oct 2019, Markus Elfring wrote:

> > Second the commit log could be more concise as:
>
> I like your desire for choosing a more appropriate commit message.
>
>
> > Allow defining COCCI as a directory that contains .cocci files.
>
> I would prefer to concentrate the patch subject on other information.
>
>
> > In general, at least in simple cases, it is not necessary to mention the
> > name of the file you are modifying in the comit log, because one can see
> > that just below from looking at the diffstat and the patch.
>
> This view can be reasonable. - How does it fit to the usual requirement
> for the specification of a “subsystem” (or “prefix”) according to the
> canonical patch format?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=13b86bc4cd648eae69fdcf3d04b2750c76350053#n656

Huh? I was talking about the log message, not the subject line. Likewise
"Allow defining..." was not proposed as a subject line, but as the log
message. With that degree of orientation, I think one can look at the
code and figure out what the intent is. At least if one knows the meaning
of -d.

julia

2019-10-25 02:50:05

by Markus Elfring

[permalink] [raw]
Subject: Re: [v2] coccicheck: support $COCCI being defined as a directory

>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=13b86bc4cd648eae69fdcf3d04b2750c76350053#n656
>
> Huh? I was talking about the log message, not the subject line.

Thanks for this clarification.


> With that degree of orientation, I think one can look at the code
> and figure out what the intent is.

The intention should become clear by reading the commit message
(combination of a subject and change description) alone already,
shouldn't it?

Regards,
Markus