Subject: Re: [PATCH 1/4] editorconfig: set maximum line length to 120 characters

From: Junio C Hamano <[email-masked]>
Date: Wed, 25 Jun 2025 11:41:47 -0700

Karthik Nayak <[email-masked]> writes:

> As per 'Documentation/CodingGuidelines', we try to keep to at most 80
> characters per line. However, there are often certain cases where we
> extend this for the sake of readability.
>
> Add a maximum limit of 120 characters to the '.editorconfig'. This means
> that if an individual line exceeds 120 characters, the editor will wrap
> that line. This provides a lot wiggle room over the recommended 80
> character limit.

Ideally "when the line is overly long to be more than 120 columns,
please wrap it to 80 columns or less" is what we want.  If the
result of formatting a single 125 column line leaves us with two
lines, one with 100 columns and another with 25 columns, this would
not be very useful.  As this is meant to give suggestions without
enforcing hard rule, wouldn't it make more sense to set it to 80?

I dunno.

> Contrary to settings within '.clang-format' which are used for
> statically formatting source code, the '.editorconfig' rules are hints
> to the editor. These are not enforced by CI and are guidelines for
> editors to follow. As such, the 'max_line_length' used here is only
> supported in a set of editors [1].
>
> [1]: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length

Thanks.

The discussion around "rulers" https://github.com/editorconfig/editorconfig/issues/89
was also interesting.

> Signed-off-by: Karthik Nayak <[email-masked]>
> ---
>  .editorconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.editorconfig b/.editorconfig
> index 2d3929b591..d0f940fd23 100644
> --- a/.editorconfig
> +++ b/.editorconfig
> @@ -7,6 +7,7 @@ insert_final_newline = true
>  [{*.{c,h,sh,bash,perl,pl,pm,txt,adoc},config.mak.*,Makefile}]
>  indent_style = tab
>  tab_width = 8
> +max_line_length = 120
>  
>  [*.py]
>  indent_style = space