[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <26ee1009-259d-07a6-495f-87557be9ed8a@huawei.com>
Date: Wed, 9 Jun 2021 13:15:04 +0800
From: "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>
To: Joe Perches <joe@...ches.com>,
Andy Shevchenko <andy.shevchenko@...il.com>
CC: Andy Shevchenko <andy@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] lib: remove leading spaces before tabs
On 2021/6/9 0:03, Joe Perches wrote:
> On Tue, 2021-06-08 at 17:00 +0800, Leizhen (ThunderTown) wrote:
>> On 2021/6/8 16:44, Andy Shevchenko wrote:
>>> On Tue, Jun 8, 2021 at 10:14 AM Zhen Lei <thunder.leizhen@...wei.com> wrote:
>>>>
>>>> 1) Run the following command to find and remove the leading spaces before
>>>> tabs:
>>>> find lib/ -type f | xargs sed -r -i 's/^[ ]+\t/\t/'
>>>
>>> Hint for the future, try to use what Git provides, for example `git
>>> ls-files -- lib/`.
>>
>> Okay, thanks. I learned a new trick.
>
> Perhaps another 'trick'.
>
> checkpatch has SPACE_BEFORE_TAB which does this for any spaces before
> a tab, not just at the start of lines. But as you've no doubt seen,
> many maintainers do not care for this sort of whitespace only change
> so it's best to do this sparingly or only in drivers/staging/ paths.
I've always thought of kernel, mm, and lib as the core modules of Linux,
and they serve as showcases for successors. I'm not interested in making
coding style improvements unless it's a work-related driver that I
usually read.
>
> For instance:
>
> $ git diff --stat lib
> $ git ls-files lib/ | \
> xargs ./scripts/checkpatch.pl --types=SPACE_BEFORE_TAB --fix-inplace
Wow, It's so powerful. Thanks.
> <checkpatch output>
> $ git diff --stat lib
> lib/atomic64_test.c | 2 +-
> lib/bitmap.c | 4 +-
> lib/btree.c | 4 +-
> lib/decompress_bunzip2.c | 6 +-
> lib/fonts/font_mini_4x6.c | 512 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------
This file is horrible. It's hard not to correct it.
> lib/locking-selftest.c | 12 ++--
> lib/lockref.c | 2 +-
> lib/lru_cache.c | 2 +-
> lib/math/rational-test.c | 2 +-
> lib/nlattr.c | 4 +-
> lib/raid6/neon.c | 2 +-
> lib/raid6/sse2.c | 12 ++--
> lib/reed_solomon/reed_solomon.c | 4 +-
> lib/scatterlist.c | 4 +-
> lib/string.c | 4 +-
> lib/test_firmware.c | 2 +-
> lib/test_kmod.c | 2 +-
> lib/test_overflow.c | 2 +-
> lib/textsearch.c | 2 +-
> lib/ts_bm.c | 2 +-
> lib/zlib_deflate/deflate.c | 2 +-
> 21 files changed, 294 insertions(+), 294 deletions(-)
>
>
>
> .
>
Powered by blists - more mailing lists