git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org,
	"brian m . carlson" <sandals@crustytoothpaste.net>,
	rsbecker@nexbridge.com
Subject: Re: [RFC PATCH 3/4] .clang-format: do not enforce a ColumnLimit
Date: Tue, 12 Jul 2022 09:03:03 +0200	[thread overview]
Message-ID: <220712.868roy6c0s.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqedyrmiu8.fsf@gitster.g>


On Mon, Jul 11 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> As with the preceding change what this leaves us with an unresolved
>> question though, should we have some stricter version of "make
>> style-all" that incorporates "ColumnLimit: 80", or perhaps apply it
>> only on "make style", but then what if someone modifies code that
>> happens to e.g. search/replace a line running afoul of the limit?
>
> A more important thing to think about is that there is no single
> good cut-off point.  When we say "wrap your lines at around 80
> columns", we mean that when there is a good place to fold at around
> column 65 and the next good place is at column 82, then it is OK to
> go slightly over 80 and wrap at 82, which may be better than
> wrapping at 65.  If the last good place to wrap is at column 72 and
> the long function call at the end of the line makes you go past the
> 82nd column, wrapping at column 72 might be better. 

There's the story of the sufficiently smart compiler, and now the
sufficiently smart formatter :)

The proposed solution here is to punt on it, which I think makes sense
if we're trying to push forward clang-format.

(Which I'm really not, this RFC is something I thought I'd send in
response to brian's proposal, as I'd poked at this locally a while ago,
after wondering if I could make use of it myself, and whether our
.clang-format was misconfigured[1]).

> I wonder if
> there is an automated formatter that understands this kind of shades
> of gray and lets us express that.

I don't think so, and setting the configuration to "0" is only a
stop-gap, after all we'd still like it to wrap e.g. lines of a length of
150 or whatever, if it finds them somewhere.

1. I think after I found that some odd styling from one of Han-Wen's
   patches was the result of running clang-format, cf.:
   https://lore.kernel.org/git/CAFQ2z_PAqW+RS2Znaf2wwOJfdNfkjP1VV84=xaPu_1EAuX+u5w@mail.gmail.com/

  reply	other threads:[~2022-07-12  7:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 21:50 Automatic code formatting brian m. carlson
2022-07-10 22:08 ` Junio C Hamano
2022-07-10 22:13 ` rsbecker
2022-07-11  0:58   ` brian m. carlson
2022-07-11  1:28     ` rsbecker
2022-07-11 16:53       ` Elijah Newren
2022-07-11 20:15         ` Ævar Arnfjörð Bjarmason
2022-07-11 21:19           ` Elijah Newren
2022-07-11 11:37 ` [RFC PATCH 0/4] make headway towards a clean "clang-format" Ævar Arnfjörð Bjarmason
2022-07-11 11:37   ` [RFC PATCH 1/4] Makefile: add a style-all targets for .clang-format testing Ævar Arnfjörð Bjarmason
2022-07-11 11:37   ` [RFC PATCH 2/4] .clang-format: Add a BitFieldColonSpacing=None rule Ævar Arnfjörð Bjarmason
2022-07-11 22:42     ` brian m. carlson
2022-07-11 22:52       ` Junio C Hamano
2022-07-12  6:56       ` Ævar Arnfjörð Bjarmason
2022-07-11 11:37   ` [RFC PATCH 3/4] .clang-format: do not enforce a ColumnLimit Ævar Arnfjörð Bjarmason
2022-07-11 21:37     ` Junio C Hamano
2022-07-12  7:03       ` Ævar Arnfjörð Bjarmason [this message]
2022-07-11 22:39     ` brian m. carlson
2022-07-11 22:46       ` Junio C Hamano
2022-07-11 23:05         ` Eric Sunshine
2022-07-11 23:30           ` Junio C Hamano
2022-07-11 11:37   ` [RFC PATCH 4/4] .clang-format: don't indent "goto" labels Ævar Arnfjörð Bjarmason
2022-07-11 21:04     ` Junio C Hamano
2022-07-12  6:55       ` Ævar Arnfjörð Bjarmason
2022-07-11 13:17 ` Automatic code formatting Phillip Wood
2022-07-11 13:21   ` Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220712.868roy6c0s.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rsbecker@nexbridge.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).