git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jun 26, 2025, 08:27 UTC
Message-ID
<CAOLa=ZRu-fBsNpoSzb8z2xUfM7WUUcdR1XRd8zr1U+P61QRccA@mail.gmail.com>
In-Reply-To
<xmqqo6ubu0ic.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Karthik Nayak <karthik.188@gmail.com> 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.
>

Yup, this would be nice, but neither '.editorconfig' or '.clang-format' support a rule like this.

Show 8 quoted lines
> 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.
>

So my intent was to instead was to allow the user to be in charge of line-wrapping, but for no reason should that go beyond 120 columns.

I'm happy to change that to 80 columns, this does mean that supported editors will start wrapping at 80 columns. Users will have to override as necessary.

Show 13 quoted lines
>> 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.
>

Indeed. That would be a really nice feature and in line with what we would want.

Show 17 quoted lines
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>>  .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
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 36 in “clang-format: modify rules to reduce false-positives”
  1. 0/4 clang-format: modify rules to reduce false-positivesKarthik Nayak, Jun 25, 2025
  2. 1/4 editorconfig: set maximum line length to 120 charactersKarthik Nayak, Jun 25, 2025
  3. Junio C HamanoJun 25, 2025
  4. Karthik NayakJun 26, 2025
  5. Junio C HamanoJun 26, 2025
  6. Karthik NayakJun 27, 2025
  7. Justin ToblerJun 26, 2025
  8. Karthik NayakJun 27, 2025
  9. Justin ToblerJun 27, 2025
  10. Karthik NayakJun 30, 2025
  11. 2/4 clang-format: set 'ColumnLimit' to 0Karthik Nayak, Jun 25, 2025
  12. 3/4 clang-format: add 'RemoveBracesLLVM' to the main configKarthik Nayak, Jun 25, 2025
  13. 4/4 meson: add rule to run 'git clang-format'Karthik Nayak, Jun 25, 2025
  14. Justin ToblerJun 26, 2025
  15. Karthik NayakJun 27, 2025
  16. Junio C HamanoJun 27, 2025
  17. Karthik NayakJun 30, 2025
  18. Junio C HamanoJun 30, 2025
  19. 0/3 clang-format: modify rules to reduce false-positivesKarthik Nayak, Jun 30, 2025
  20. 1/3 clang-format: set 'ColumnLimit' to 0Karthik Nayak, Jun 30, 2025
  21. 2/3 clang-format: add 'RemoveBracesLLVM' to the main configKarthik Nayak, Jun 30, 2025
  22. 3/3 meson: add rule to run 'git clang-format'Karthik Nayak, Jun 30, 2025
  23. Patrick SteinhardtJul 1, 2025
  24. Karthik NayakJul 1, 2025
  25. Junio C HamanoJul 1, 2025
  26. Toon ClaesJul 1, 2025
  27. Karthik NayakJul 1, 2025
  28. Patrick SteinhardtJul 2, 2025
  29. Junio C HamanoJun 30, 2025
  30. Toon ClaesJul 1, 2025
  31. Karthik NayakJul 1, 2025
  32. Junio C HamanoJul 1, 2025
  33. 0/3 clang-format: modify rules to reduce false-positivesKarthik Nayak, Jul 2, 2025
  34. 1/3 clang-format: set 'ColumnLimit' to 0Karthik Nayak, Jul 2, 2025
  35. 2/3 clang-format: add 'RemoveBracesLLVM' to the main configKarthik Nayak, Jul 2, 2025
  36. 3/3 meson: add rule to run 'git clang-format'Karthik Nayak, Jul 2, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.