[Toybox] [PATCH] Whitespace: remove tabs from indentation.

Reverend Homer mk.43.ecko at gmail.com
Sat Jan 26 04:08:49 PST 2019


Well, I've already faced with the couple of issues I can't resolve using
clang-format config:

   1. It puts linebreaks to

	if (x) foo();
	else bar();

      statements even though I set AllowShortIfStatementsOnASingleLine to true
      and it leaves if statements *without* "else" alone

   2. I can't find a way to tell it not to put spaces to arithmetic operations,
      i.e. not to turn "x+5" to "x + 5". It seems to be hard-coded

Confused,
R.H.

On 25/01/2019 11:26, Reverend Homer wrote:
> Well, I could give clang-format a try and prepare the patchset with its config
> and fixes as an RFC, if Rob doesn't mind.
> 
> R.H.
> 
> On 24/01/2019 19:02, enh wrote:
>> that's what i meant about "you have to learn to give up control over
>> every last space or tab". many Google and Android projects use
>> clang-format, perhaps helped by the fact that no-one really loves
>> https://google.github.io/styleguide/cppguide.html but everyone has far
>> better things to do than waste more time arguing with their neighbor
>> about indentation.
>>
>> (the only exception is the odd table of data where there's an attempt
>> to make it more human-readable, but  that's just a few `clang-format
>> on/off` comments in hundreds of thousands of lines of code. i've
>> certainly not seen anyone do what that systemd bug talks about and
>> turn off formatting just so they can write an over-long line. that
>> wouldn't make it through code review anyway, unless everyone agrees in
>> a longer line length, in which case just fix your .clang-format file
>> so the tool knows what your max line length is.)
>>
>> On Thu, Jan 24, 2019 at 1:03 AM Reverend Homer <mk.43.ecko at gmail.com> wrote:
>>>
>>> Yeah, that's an option. But AFAICS according to my experience every project
>>> tried to use it had some issues. The latest example I have is systemd:
>>> https://github.com/systemd/systemd/pull/11308
>>>
>>> You can look through this PR and see how much trouble it creates.
>>>
>>> R.H.
>>>
>>> On 23/01/2019 21:07, enh wrote:
>>>> personally i'd like to have a .clang-format and a git hook to just
>>>> canonicalize. it takes a bit of getting used to, giving up the fine
>>>> control over every last space and linebreak, but it's remarkably
>>>> liberating once you've done it. in projects like that i just run
>>>> clang-format every time i save and literally pay no attention to the
>>>> layout of what i'm typing, allowing ctrl-S to think about it so i
>>>> don't have to.
>>>>
>>>> On Wed, Jan 23, 2019 at 12:46 AM Reverend Homer <mk.43.ecko at gmail.com> wrote:
>>>>>
>>>>> Maybe it's worth adding .editorconfig file? Pretty much all editors support it
>>>>> from the box or have the plugin.
>>>>>
>>>>> R.H.
>>>>>
>>>>> On 23/01/2019 05:23, enh via Toybox wrote:
>>>>>> I accidentally added a tab in xargs.c, so as penance I'll clean up all
>>>>>> the tabs.
>>>>>> ---
>>>>>>      toys/pending/dhcp.c     |  2 +-
>>>>>>      toys/pending/dhcp6.c    |  4 ++--
>>>>>>      toys/pending/ip.c       |  2 +-
>>>>>>      toys/pending/mdev.c     |  6 +++---
>>>>>>      toys/pending/modprobe.c | 15 +++++++--------
>>>>>>      toys/posix/xargs.c      |  2 +-
>>>>>>      6 files changed, 15 insertions(+), 16 deletions(-)
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Toybox mailing list
>>>>>> Toybox at lists.landley.net
>>>>>> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>>>>>>
>>>>> _______________________________________________
>>>>> Toybox mailing list
>>>>> Toybox at lists.landley.net
>>>>> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list