diff mbox series

[v2,3/8] doc: Add rules and recommendations list

Message ID 20210714071158.15868-4-rpalethorpe@suse.com
State Changes Requested
Headers show
Series Sparse based checker and rule proposal | expand

Commit Message

Richard Palethorpe July 14, 2021, 7:11 a.m. UTC
Create a list of rules which are feasible to check automatically. The
file is a table of tab separated values. It's intended to be machine
readable.

For now there is just an ID column, with IDs that look similar to CWE
IDs or CVEs. For now these can just be used with 'git grep'. Also
there is a description column.

Clearly this is not an exhaustive list. It just contains a library
rule already stated in the guide and the issue Sparse checks for.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
 doc/rules.tsv                   | 3 +++
 doc/test-writing-guidelines.txt | 5 +++++
 2 files changed, 8 insertions(+)
 create mode 100644 doc/rules.tsv

Comments

Petr Vorel July 14, 2021, 10:49 a.m. UTC | #1
Hi Richie,

obviously correct.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

> +++ b/doc/test-writing-guidelines.txt
> @@ -10,6 +10,11 @@ NOTE: See also
>        https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
>        https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].

> +Rules and recommendations which are "machine checkable" should be
> +tagged with an ID like +LTP-XXX+. There will be a corresponding entry
> +in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
nit: I'd make 'doc/rules.tsv' as link (for lazy people like me):
https://github.com/linux-test-project/ltp/tree/master/doc/rules.tsv[doc/rules.tsv]

Kind regards,
Petr
Petr Vorel July 14, 2021, 10:54 a.m. UTC | #2
Hi Richie,

> +++ b/doc/test-writing-guidelines.txt
> @@ -10,6 +10,11 @@ NOTE: See also
>        https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
>        https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].

> +Rules and recommendations which are "machine checkable" should be
> +tagged with an ID like +LTP-XXX+. There will be a corresponding entry
> +in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
> +will display these IDs as a reference.
> +
Actually text is on the top. I suppose, you probably planned to put this into "2.1 C coding style".

Kind regards,
Petr

>  1. Guide to clean and understandable code
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Richard Palethorpe July 14, 2021, 1:15 p.m. UTC | #3
Hello Petr,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Richie,
>
> obviously correct.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
>> +++ b/doc/test-writing-guidelines.txt
>> @@ -10,6 +10,11 @@ NOTE: See also
>>        https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
>>        https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].
>
>> +Rules and recommendations which are "machine checkable" should be
>> +tagged with an ID like +LTP-XXX+. There will be a corresponding entry
>> +in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
> nit: I'd make 'doc/rules.tsv' as link (for lazy people like me):
> https://github.com/linux-test-project/ltp/tree/master/doc/rules.tsv[doc/rules.tsv]

+1

Although I was wondering if it could be formatted and displayed inline somehow?

>
> Kind regards,
> Petr
Richard Palethorpe July 14, 2021, 1:26 p.m. UTC | #4
Hello Petr,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Richie,
>
>> +++ b/doc/test-writing-guidelines.txt
>> @@ -10,6 +10,11 @@ NOTE: See also
>>        https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
>>        https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].
>
>> +Rules and recommendations which are "machine checkable" should be
>> +tagged with an ID like +LTP-XXX+. There will be a corresponding entry
>> +in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
>> +will display these IDs as a reference.
>> +
> Actually text is on the top. I suppose, you probably planned to put
> this into "2.1 C coding style".

I'm not sure where to put it. The coding style is mostly about syntax
and formatting. The rules file can state anything machine checkable, so
that can include shell, directory structure, what functions are used
etc.

>
> Kind regards,
> Petr
>
>>  1. Guide to clean and understandable code
>>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Petr Vorel July 14, 2021, 2:34 p.m. UTC | #5
Hi Richie,

> Hello Petr,

> Petr Vorel <pvorel@suse.cz> writes:

> > Hi Richie,

> >> +++ b/doc/test-writing-guidelines.txt
> >> @@ -10,6 +10,11 @@ NOTE: See also
> >>        https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
> >>        https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].

> >> +Rules and recommendations which are "machine checkable" should be
> >> +tagged with an ID like +LTP-XXX+. There will be a corresponding entry
> >> +in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
> >> +will display these IDs as a reference.
> >> +
> > Actually text is on the top. I suppose, you probably planned to put
> > this into "2.1 C coding style".

> I'm not sure where to put it. The coding style is mostly about syntax
> and formatting. The rules file can state anything machine checkable, so
> that can include shell, directory structure, what functions are used
> etc.

Not sure myself myself. But my note was that you put it below NOTE,
above "1. Guide to clean and understandable code" which looks strange to me.

But not a big deal with it, just a nit.

Kind regards,
Petr

> > Kind regards,
> > Petr

> >>  1. Guide to clean and understandable code
> >>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Petr Vorel July 21, 2021, 3:43 p.m. UTC | #6
Hi Richie,

> Hello Petr,

> Petr Vorel <pvorel@suse.cz> writes:

> > Hi Richie,

> > obviously correct.
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>

> >> +++ b/doc/test-writing-guidelines.txt
> >> @@ -10,6 +10,11 @@ NOTE: See also
> >>        https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
> >>        https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].

> >> +Rules and recommendations which are "machine checkable" should be
> >> +tagged with an ID like +LTP-XXX+. There will be a corresponding entry
> >> +in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
> > nit: I'd make 'doc/rules.tsv' as link (for lazy people like me):
> > https://github.com/linux-test-project/ltp/tree/master/doc/rules.tsv[doc/rules.tsv]

> +1

> Although I was wondering if it could be formatted and displayed inline somehow?

I'm not aware of it :(.

Kind regards,
Petr


> > Kind regards,
> > Petr
diff mbox series

Patch

diff --git a/doc/rules.tsv b/doc/rules.tsv
new file mode 100644
index 000000000..d4081ce0f
--- /dev/null
+++ b/doc/rules.tsv
@@ -0,0 +1,3 @@ 
+ID	DESCRIPTION
+LTP-001	Library source files have tst_ prefix
+LTP-002	TST_RET and TST_ERR are never modified by test library functions
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index d57e52655..74e8ad7ee 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -10,6 +10,11 @@  NOTE: See also
       https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API],
       https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].
 
+Rules and recommendations which are "machine checkable" should be
+tagged with an ID like +LTP-XXX+. There will be a corresponding entry
+in 'doc/rules.tsv'. When you run 'make check' or 'make check-test' it
+will display these IDs as a reference.
+
 1. Guide to clean and understandable code
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~