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

Re: [PATCH v3 1/3] clang-format: re-adjust line break penalties

From
Toon Claes <toon@iotcl.com>
Date
Oct 14, 2024, 09:08 UTC
Message-ID
<871q0jrr02.fsf@iotcl.com>
In-Reply-To
<74bbd2f9db1ddfd5210be8fde2db84f67acff27d.1728697428.git.karthik.188@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
[snip]
Show 19 quoted lines
> This avoids weird formatting like:
>
>    static const struct strbuf *
>           a_really_really_large_function_name(struct strbuf resolved,
>           const char *path, int flags)
>
> or
>
>    static const struct strbuf *a_really_really_large_function_name(
>    	    struct strbuf resolved, const char *path, int flags)
>
> to instead have something more readable like:
>
>    static const struct strbuf *a_really_really_large_function_name(struct strbuf resolved,
>           const char *path, int flags)
>
> This is done by bumping the values of 'PenaltyReturnTypeOnItsOwnLine'
> and 'PenaltyBreakOpenParenthesis' to 300. This is so that we can allow a
> few characters above the 80 column limit to make code more readable.

I'm really liking the idea of penalties, but I feel we're relying too much on guestimation of these values. What do you think about adding example files to our codebase? Having concrete examples at hand will allow us to tweak the values in the future, while preserving behavior for existing cases. Or when we decide to change them, we understand what and when.

Now, I'm not sure where to put such files. I think I would suggest something like t/style-lint or t/clang-format. Anyway, for our tooling it doesn't seem to matter, because both `make style` and `ci/run-style-check.sh` pick up all .c and .h files anywhere in the source tree. Adding a README to that directory will help people understand why the files are there.

-- Toon

Previous: Karthik NayakNext: Taylor Blau
Message 11 of 34 in “clang-format: fix rules to make the CI job cleaner”
  1. 0/3 clang-format: fix rules to make the CI job cleanerKarthik Nayak, Oct 9, 2024
  2. 1/3 clang-format: don't enforce the column limitKarthik Nayak, Oct 9, 2024
  3. Justin ToblerOct 9, 2024
  4. Junio C HamanoOct 9, 2024
  5. karthik nayakOct 10, 2024
  6. 2/3 clang-format: don't align expressions after linebreaksKarthik Nayak, Oct 9, 2024
  7. 3/3 clang-format: align consecutive macro definitionsKarthik Nayak, Oct 9, 2024
  8. Toon ClaesOct 10, 2024
  9. 0/3 clang-format: fix rules to make the CI job cleanerKarthik Nayak, Oct 12, 2024
  10. 1/3 clang-format: re-adjust line break penaltiesKarthik Nayak, Oct 12, 2024
  11. Toon ClaesOct 14, 2024
  12. Taylor BlauOct 14, 2024
  13. karthik nayakOct 15, 2024
  14. karthik nayakOct 15, 2024
  15. Kyle LippincottOct 14, 2024
  16. karthik nayakOct 15, 2024
  17. Kyle LippincottOct 16, 2024
  18. karthik nayakOct 16, 2024
  19. 2/3 clang-format: align consecutive macro definitionsKarthik Nayak, Oct 12, 2024
  20. Kyle LippincottOct 14, 2024
  21. karthik nayakOct 15, 2024
  22. 3/3 clang-format: don't align expressions after linebreaksKarthik Nayak, Oct 12, 2024
  23. Kyle LippincottOct 14, 2024
  24. karthik nayakOct 15, 2024
  25. 0/2 Subject: clang-format: fix rules to make the CI job cleanerKarthik Nayak, Oct 18, 2024
  26. 1/2 clang-format: re-adjust line break penaltiesKarthik Nayak, Oct 18, 2024
  27. Justin ToblerOct 25, 2024
  28. karthik nayakOct 25, 2024
  29. 2/2 clang-format: align consecutive macro definitionsKarthik Nayak, Oct 18, 2024
  30. Taylor BlauOct 18, 2024
  31. karthik nayakOct 20, 2024
  32. Taylor BlauOct 21, 2024
  33. karthik nayakOct 22, 2024
  34. Taylor BlauOct 22, 2024

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.