[PATCH i-g-t] CONTRIBUTING: Add coding style guidelines

Louis Chauvet louis.chauvet at bootlin.com
Wed Mar 20 09:42:03 UTC 2024


Le 18/03/24 - 16:04, Jani Nikula a écrit :
> On Mon, 18 Mar 2024, Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:
> > Hi Louis,
> > On 2024-03-15 at 17:08:37 +0100, Louis Chauvet wrote:
> >> As explained in [1], the submitted patches should follow the same style as
> >> the Linux kernel and must be checked against checkpatch.pl, so add this
> >> recommendation in the CONTRIBUTING.md file.
> >> 
> >> [1]: https://lore.kernel.org/all/20240314170643.77vzqqoie2otyu4w@kamilkon-desk.igk.intel.com/
> >> 
> >> Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
> >> 
> >> To: igt-dev at lists.freedesktop.org
> > -^^^^^^^^^^^^^^
> > Drop this.
> >
> >> Cc: miquel.raynal at bootlin.com
> >> Cc: thomas.petazzoni at bootlin.com
> >> Cc: jeremie.dautheribes at bootlin.com
> >> Cc: arthurgrillo at riseup.net
> >> Cc: seanpaul at google.com
> >> Cc: marcheu at google.com
> >> Cc: nicolejadeyee at google.com
> >> Cc: kamil.konieczny at linux.intel.com
> >
> > These should be before your s-o-b above.
> > I will add here few more maintainers:
> >
> > Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> > Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> > Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> > Cc: Petri Latvala <adrinael at adrinael.net>
> >
> >> ---
> >
> > Here you could add your notes which will be ignored by git
> > at merging but I do not see any?
> >
> >> To: igt-dev at lists.freedesktop.org
> >> Cc: miquel.raynal at bootlin.com
> >> Cc: thomas.petazzoni at bootlin.com
> >> Cc: jeremie.dautheribes at bootlin.com
> >> Cc: arthurgrillo at riseup.net
> >> Cc: seanpaul at google.com
> >> Cc: marcheu at google.com
> >> Cc: nicolejadeyee at google.com
> >> Cc: kamil.konieczny at linux.intel.com
> >> 
> >> Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
> 
> Looks like you didn't run checkpatch on this contribution! ;D

Probably, I will run it for the v2.
 
> >> ---
> >>  CONTRIBUTING.md | 2 ++
> >>  1 file changed, 2 insertions(+)
> >> 
> >> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> >> index 2ab8a48f6ae9..ec8debb4091e 100644
> >> --- a/CONTRIBUTING.md
> >> +++ b/CONTRIBUTING.md
> >> @@ -78,6 +78,8 @@ Sending Patches
> >>  - Changes to the testcases are automatically tested. Take the results into
> >>    account before merging.
> >>  
> >> +- The coding rules are the same as for the Linux kernel. To check for common
> > -------------------------^
> > insert 'almost' here: s/are the same/are almost the same/
> >
> >> +  style problems, you need to use the kernel's checkpatch.pl script.
> >
> > There are known variations like we do not have MAINTAINERS, or
> > we allow to use typdefs, allow to have (reasonable) longer lines
> > and few others differences.
> 
> You could define the checkpatch.pl options to use. Maybe even add a
> script wrapper to run, with the options set.
> 
> For example, we use these command-line options for i915:
> 
> scripts/checkpatch.pl -q --emacs --strict --show-types --max-line-length=100 --ignore=BIT_MACRO,SPLIT_STRING,LONG_LINE_STRING,BOOL_MEMBER

Is this line applicable for the whole repository?

> Alternatively, define a clang-format configuration file and use that
> instead of checkpatch. Linux repo root has .clang-format.

I tried to use the Linux' .clang-format, but there are some limitation, 
espicialy for alignment:
	#define REG_LONG_NAME	0x2
	#define REG_SHORT	0x3
is changed to
	#define REG_LONG_NAME 0x2
	#define REG_SHORT 0x3
(same for all structure members, multiple assignements...)

Kind regards,
Louis Chauvet

> 
> BR,
> Jani.
> 
> 
> >
> > Regards,
> > Kamil
> >
> >>  
> >>  Commit Rights
> >>  -------------
> >> 
> >> ---
> >> base-commit: ed47dd9fb6b5be6c88513c2816f0f7cfdd0e02f6
> >> change-id: 20240315-add_coding_style-b755454de958
> >> 
> >> Best regards,
> >> -- 
> >> Louis Chauvet <louis.chauvet at bootlin.com>
> >> 
> 
> -- 
> Jani Nikula, Intel

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the igt-dev mailing list