[dpdk-dev] [PATCH RFC] devtools: increase default line length to 100

Jerin Jacob jerinjacobk at gmail.com
Wed Jun 10 07:22:39 CEST 2020


On Tue, Jun 9, 2020 at 7:27 PM Bruce Richardson
<bruce.richardson at intel.com> wrote:
>
> On Tue, Jun 09, 2020 at 04:40:28PM +0300, Andrew Rybchenko wrote:
> > On 6/9/20 1:00 PM, Ananyev, Konstantin wrote:
> > >
> > >>
> > >> On Mon, Jun 08, 2020 at 12:17:23PM -0700, Stephen Hemminger wrote:
> > >>> On Mon,  8 Jun 2020 17:46:40 +0100 Bruce Richardson
> > >>> <bruce.richardson at intel.com> wrote:
> > >>>
> > >>>> Rather than continuing to recommend an 80-char line limit, let's
> > >>>> take a hint from the Linux kernel[1] and aim for an 100-char
> > >>>> recommended limit instead.
> > >>>>
> > >>>> [1]
> > >>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdc48fa11e46f867ea4d75fa59ee87a7f48be144
> > >>>>
> > >>>> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com> ---
> > >>>> devtools/checkpatches.sh                 | 2 +-
> > >>>> doc/guides/contributing/coding_style.rst | 2 +- 2 files changed, 2
> > >>>> insertions(+), 2 deletions(-)
> > >>>>
> > >>>> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> > >>>> index 158087f1c..4970ed830 100755 --- a/devtools/checkpatches.sh +++
> > >>>> b/devtools/checkpatches.sh @@ -15,7 +15,7 @@
> > >>>> VALIDATE_NEW_API=$(dirname $(readlink -f $0))/check-symbol-change.sh
> > >>>> # Codespell can also be enabled by setting DPDK_CHECKPATCH_CODESPELL
> > >>>> to a valid path # to a dictionary.txt file if dictionary.txt is not
> > >>>> in the default location.
> > >>>> codespell=${DPDK_CHECKPATCH_CODESPELL:-enable}
> > >>>> -length=${DPDK_CHECKPATCH_LINE_LENGTH:-80}
> > >>>> +length=${DPDK_CHECKPATCH_LINE_LENGTH:-100}
> > >>>>
> > >>>>  # override default Linux options options="--no-tree" diff --git
> > >>>>  a/doc/guides/contributing/coding_style.rst
> > >>>>  b/doc/guides/contributing/coding_style.rst index
> > >>>>  4efde93f6..1db3a7bbe 100644 ---
> > >>>>  a/doc/guides/contributing/coding_style.rst +++
> > >>>>  b/doc/guides/contributing/coding_style.rst @@ -21,7 +21,7 @@ The
> > >>>>  rules and guidelines given in this document cannot cover every
> > >>>>  situation, so * In the case of creating new files, the style should
> > >>>>  be consistent within each file in a given directory or module.  *
> > >>>>  The primary reason for coding standards is to increase code
> > >>>>  readability and comprehensibility, therefore always use whatever
> > >>>>  option
> > >> will make the code easiest to read.
> > >>>>
> > >>>> -Line length is recommended to be not more than 80 characters,
> > >>>> including comments.  +Line length is recommended to be not more than
> > >>>> 100 characters, including comments.  [Tab stop size should be
> > >>>> assumed to be 8-characters wide].
> > >>>>
> > >>>>  .. note::
> > >>>
> > >>> I would even support going to 120 characters.
> > >>>
> > >>> Acked-by: Stephen Hemminger <stephen at networkplumber.org>
> > >>
> > >> I think 100 is enough.
> > >>
> > >> In my case, I have a 1080p 24" monitor, and with two terminals
> > >> side-by-side 100 characters just fits inside each vim window. Going to
> > >> 120 would be fine for single terminal at a time, but I would find
> > >> awkward for e.g.  side-by-side diff comparison in meld etc.
> > >
> > > My preference would be to keep things as it is - 80 chars per line.
> > > Having multiple different formatting styles in one source file looks
> > > really awkward and make it hard to follow.
> >
> > +1
> >
> I wouldn't personally consider increasing the max line length as a style
> change, but even if you consider it such I'd worry about rejecting style
> changes on the basis that it may be different to what is there before. That
> logic means that we can never, ever change any element of DPDK coding style.
>
> I can see the issue with changes that require us to rework the style of
> code in order to comply with the new style, but changing the max length
> from 80 to 100 does not make 80-char lines incorrect and needing changes.

Another point is: Other projects derived from the Linux kernel coding
standard also
getting migrated to the new coding standard. This change would be useful for:
a) People works on multiple Linux coding standard derived projects
b) Some of the code such as 'base' and 'common' code for HW drivers
are shared between multiple projects.
Such code needs adjustment/change when pulling to the DPDK code base
it it still follows 80 chars per line.


>
> Regards,
> /Bruce


More information about the dev mailing list