All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs-progs: Add basic .editorconfig
@ 2020-07-28  1:57 Daniel Xu
  2020-07-28  1:58 ` Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Daniel Xu @ 2020-07-28  1:57 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Daniel Xu, kernel-team

Not all contributors work on projects that use linux kernel coding
style. This commit adds a basic editorconfig [0] to assist contributors
with managing configuration.

[0]: https://editorconfig.org/

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
Changes from V1:
* use tabs instead of spaces

 .editorconfig | 10 ++++++++++
 .gitignore    |  1 +
 2 files changed, 11 insertions(+)
 create mode 100644 .editorconfig

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..7e15c503
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+charset = utf-8
+indent_style = tab
+indent_size = 8
+
+[*.py]
+indent_size = 4
diff --git a/.gitignore b/.gitignore
index aadf9ae7..1c70ec94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,6 +65,7 @@
 /cscope.in.out
 /cscope.po.out
 .*
+!.editorconfig

 /Documentation/Makefile
 /Documentation/*.html
--
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28  1:57 [PATCH v2] btrfs-progs: Add basic .editorconfig Daniel Xu
@ 2020-07-28  1:58 ` Qu Wenruo
  2020-07-28  2:23 ` Neal Gompa
  2020-07-28 11:38 ` David Sterba
  2 siblings, 0 replies; 12+ messages in thread
From: Qu Wenruo @ 2020-07-28  1:58 UTC (permalink / raw)
  To: Daniel Xu, linux-btrfs; +Cc: kernel-team


[-- Attachment #1.1: Type: text/plain, Size: 1304 bytes --]



On 2020/7/28 上午9:57, Daniel Xu wrote:
> Not all contributors work on projects that use linux kernel coding
> style. This commit adds a basic editorconfig [0] to assist contributors
> with managing configuration.
> 
> [0]: https://editorconfig.org/
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
> Changes from V1:
> * use tabs instead of spaces

That's fast! Just seconds before I exposed the indent_style problem.

Now it's properly reviewed.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> 
>  .editorconfig | 10 ++++++++++
>  .gitignore    |  1 +
>  2 files changed, 11 insertions(+)
>  create mode 100644 .editorconfig
> 
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index 00000000..7e15c503
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,10 @@
> +[*]
> +end_of_line = lf
> +insert_final_newline = true
> +trim_trailing_whitespace = true
> +charset = utf-8
> +indent_style = tab
> +indent_size = 8
> +
> +[*.py]
> +indent_size = 4
> diff --git a/.gitignore b/.gitignore
> index aadf9ae7..1c70ec94 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -65,6 +65,7 @@
>  /cscope.in.out
>  /cscope.po.out
>  .*
> +!.editorconfig
> 
>  /Documentation/Makefile
>  /Documentation/*.html
> --
> 2.27.0
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28  1:57 [PATCH v2] btrfs-progs: Add basic .editorconfig Daniel Xu
  2020-07-28  1:58 ` Qu Wenruo
@ 2020-07-28  2:23 ` Neal Gompa
  2020-07-28 11:38 ` David Sterba
  2 siblings, 0 replies; 12+ messages in thread
From: Neal Gompa @ 2020-07-28  2:23 UTC (permalink / raw)
  To: Daniel Xu; +Cc: Btrfs BTRFS, kernel-team

On Mon, Jul 27, 2020 at 9:58 PM Daniel Xu <dxu@dxuuu.xyz> wrote:
>
> Not all contributors work on projects that use linux kernel coding
> style. This commit adds a basic editorconfig [0] to assist contributors
> with managing configuration.
>
> [0]: https://editorconfig.org/
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
> Changes from V1:
> * use tabs instead of spaces
>
>  .editorconfig | 10 ++++++++++
>  .gitignore    |  1 +
>  2 files changed, 11 insertions(+)
>  create mode 100644 .editorconfig
>
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index 00000000..7e15c503
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,10 @@
> +[*]
> +end_of_line = lf
> +insert_final_newline = true
> +trim_trailing_whitespace = true
> +charset = utf-8
> +indent_style = tab
> +indent_size = 8
> +
> +[*.py]
> +indent_size = 4
> diff --git a/.gitignore b/.gitignore
> index aadf9ae7..1c70ec94 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -65,6 +65,7 @@
>  /cscope.in.out
>  /cscope.po.out
>  .*
> +!.editorconfig
>
>  /Documentation/Makefile
>  /Documentation/*.html
> --
> 2.27.0
>

LGTM.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>


-- 
真実はいつも一つ!/ Always, there's only one truth!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28  1:57 [PATCH v2] btrfs-progs: Add basic .editorconfig Daniel Xu
  2020-07-28  1:58 ` Qu Wenruo
  2020-07-28  2:23 ` Neal Gompa
@ 2020-07-28 11:38 ` David Sterba
  2020-07-28 12:03   ` Qu Wenruo
  2 siblings, 1 reply; 12+ messages in thread
From: David Sterba @ 2020-07-28 11:38 UTC (permalink / raw)
  To: Daniel Xu; +Cc: linux-btrfs, kernel-team

On Mon, Jul 27, 2020 at 06:57:15PM -0700, Daniel Xu wrote:
> Not all contributors work on projects that use linux kernel coding
> style. This commit adds a basic editorconfig [0] to assist contributors
> with managing configuration.
> 
> [0]: https://editorconfig.org/
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
> Changes from V1:
> * use tabs instead of spaces
> 
>  .editorconfig | 10 ++++++++++
>  .gitignore    |  1 +
>  2 files changed, 11 insertions(+)
>  create mode 100644 .editorconfig
> 
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index 00000000..7e15c503
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,10 @@
> +[*]
> +end_of_line = lf
> +insert_final_newline = true
> +trim_trailing_whitespace = true

Does this setting apply on lines that get changed or does it affect the
whole file? If it's just for the lines, then it's what we want.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 11:38 ` David Sterba
@ 2020-07-28 12:03   ` Qu Wenruo
  2020-07-28 12:12     ` Qu Wenruo
  0 siblings, 1 reply; 12+ messages in thread
From: Qu Wenruo @ 2020-07-28 12:03 UTC (permalink / raw)
  To: dsterba, Daniel Xu, linux-btrfs, kernel-team


[-- Attachment #1.1: Type: text/plain, Size: 1261 bytes --]



On 2020/7/28 下午7:38, David Sterba wrote:
> On Mon, Jul 27, 2020 at 06:57:15PM -0700, Daniel Xu wrote:
>> Not all contributors work on projects that use linux kernel coding
>> style. This commit adds a basic editorconfig [0] to assist contributors
>> with managing configuration.
>>
>> [0]: https://editorconfig.org/
>>
>> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
>> ---
>> Changes from V1:
>> * use tabs instead of spaces
>>
>>  .editorconfig | 10 ++++++++++
>>  .gitignore    |  1 +
>>  2 files changed, 11 insertions(+)
>>  create mode 100644 .editorconfig
>>
>> diff --git a/.editorconfig b/.editorconfig
>> new file mode 100644
>> index 00000000..7e15c503
>> --- /dev/null
>> +++ b/.editorconfig
>> @@ -0,0 +1,10 @@
>> +[*]
>> +end_of_line = lf
>> +insert_final_newline = true
>> +trim_trailing_whitespace = true
> 
> Does this setting apply on lines that get changed or does it affect the
> whole file? If it's just for the lines, then it's what we want.
> 
At least from the vim plugin code, it's just for the new lines:

https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494

It just call the replace on the current line.

Thanks,
Qu


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 12:03   ` Qu Wenruo
@ 2020-07-28 12:12     ` Qu Wenruo
  2020-07-28 12:57       ` David Sterba
  0 siblings, 1 reply; 12+ messages in thread
From: Qu Wenruo @ 2020-07-28 12:12 UTC (permalink / raw)
  To: dsterba, Daniel Xu, linux-btrfs, kernel-team


[-- Attachment #1.1: Type: text/plain, Size: 1414 bytes --]



On 2020/7/28 下午8:03, Qu Wenruo wrote:
> 
> 
> On 2020/7/28 下午7:38, David Sterba wrote:
>> On Mon, Jul 27, 2020 at 06:57:15PM -0700, Daniel Xu wrote:
>>> Not all contributors work on projects that use linux kernel coding
>>> style. This commit adds a basic editorconfig [0] to assist contributors
>>> with managing configuration.
>>>
>>> [0]: https://editorconfig.org/
>>>
>>> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
>>> ---
>>> Changes from V1:
>>> * use tabs instead of spaces
>>>
>>>  .editorconfig | 10 ++++++++++
>>>  .gitignore    |  1 +
>>>  2 files changed, 11 insertions(+)
>>>  create mode 100644 .editorconfig
>>>
>>> diff --git a/.editorconfig b/.editorconfig
>>> new file mode 100644
>>> index 00000000..7e15c503
>>> --- /dev/null
>>> +++ b/.editorconfig
>>> @@ -0,0 +1,10 @@
>>> +[*]
>>> +end_of_line = lf
>>> +insert_final_newline = true
>>> +trim_trailing_whitespace = true
>>
>> Does this setting apply on lines that get changed or does it affect the
>> whole file? If it's just for the lines, then it's what we want.
>>
> At least from the vim plugin code, it's just for the new lines:
> 
> https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
> 
> It just call the replace on the current line.

My bad, %s, it replaces all existing lines...

> 
> Thanks,
> Qu
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 12:12     ` Qu Wenruo
@ 2020-07-28 12:57       ` David Sterba
  2020-07-28 13:00         ` Qu Wenruo
  2020-07-28 17:24         ` Daniel Xu
  0 siblings, 2 replies; 12+ messages in thread
From: David Sterba @ 2020-07-28 12:57 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: dsterba, Daniel Xu, linux-btrfs, kernel-team

On Tue, Jul 28, 2020 at 08:12:40PM +0800, Qu Wenruo wrote:
> >>> +trim_trailing_whitespace = true
> >>
> >> Does this setting apply on lines that get changed or does it affect the
> >> whole file? If it's just for the lines, then it's what we want.
> >>
> > At least from the vim plugin code, it's just for the new lines:
> > 
> > https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
> > 
> > It just call the replace on the current line.
> 
> My bad, %s, it replaces all existing lines...

So this would introduce unrelated changes, but it seems that we don't
have much trailing whitespaces in progs codebase:

  $ git grep '\s\+$'
  btrfs-fragments.c:
  btrfs-fragments.c:                              black = gdImageColorAllocate(im, 0, 0, 0);  
  crypto/crc32c.c:/* 
  crypto/crc32c.c: * 
  crypto/crc32c.c: * Software Foundation; either version 2 of the License, or (at your option) 
  crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
  crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
  kernel-lib/radix-tree.h: * 
  kernel-lib/radix-tree.h: * 
  kernel-lib/rbtree.c:            node = node->rb_right; 
  kernel-lib/rbtree.c:            node = node->rb_left; 
  kernel-lib/rbtree.h:  

filtering only the sources. So let's keep it in the config.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 12:57       ` David Sterba
@ 2020-07-28 13:00         ` Qu Wenruo
  2020-07-28 17:26           ` Daniel Xu
  2020-07-28 17:24         ` Daniel Xu
  1 sibling, 1 reply; 12+ messages in thread
From: Qu Wenruo @ 2020-07-28 13:00 UTC (permalink / raw)
  To: dsterba, Daniel Xu, linux-btrfs, kernel-team


[-- Attachment #1.1: Type: text/plain, Size: 1760 bytes --]



On 2020/7/28 下午8:57, David Sterba wrote:
> On Tue, Jul 28, 2020 at 08:12:40PM +0800, Qu Wenruo wrote:
>>>>> +trim_trailing_whitespace = true
>>>>
>>>> Does this setting apply on lines that get changed or does it affect the
>>>> whole file? If it's just for the lines, then it's what we want.
>>>>
>>> At least from the vim plugin code, it's just for the new lines:
>>>
>>> https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
>>>
>>> It just call the replace on the current line.
>>
>> My bad, %s, it replaces all existing lines...
> 
> So this would introduce unrelated changes, but it seems that we don't
> have much trailing whitespaces in progs codebase:
> 
>   $ git grep '\s\+$'
>   btrfs-fragments.c:
>   btrfs-fragments.c:                              black = gdImageColorAllocate(im, 0, 0, 0);  
>   crypto/crc32c.c:/* 
>   crypto/crc32c.c: * 
>   crypto/crc32c.c: * Software Foundation; either version 2 of the License, or (at your option) 
>   crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
>   crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
>   kernel-lib/radix-tree.h: * 
>   kernel-lib/radix-tree.h: * 
>   kernel-lib/rbtree.c:            node = node->rb_right; 
>   kernel-lib/rbtree.c:            node = node->rb_left; 
>   kernel-lib/rbtree.h:  
> 
> filtering only the sources. So let's keep it in the config.
> 
Great.

BTW, it would be better to mention we use editorconfig as the unified
formatting config.

As most of us are using vim, which doesn't support editorconfig by
default, thus we need to install that plugin manually.

Thanks,
Qu


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 12:57       ` David Sterba
  2020-07-28 13:00         ` Qu Wenruo
@ 2020-07-28 17:24         ` Daniel Xu
  2020-07-29  9:58           ` David Sterba
  1 sibling, 1 reply; 12+ messages in thread
From: Daniel Xu @ 2020-07-28 17:24 UTC (permalink / raw)
  To: dsterba, Qu Wenruo; +Cc: Daniel Xu, linux-btrfs, kernel-team

On Tue Jul 28, 2020 at 5:57 AM PDT, David Sterba wrote:
> On Tue, Jul 28, 2020 at 08:12:40PM +0800, Qu Wenruo wrote:
> > >>> +trim_trailing_whitespace = true
> > >>
> > >> Does this setting apply on lines that get changed or does it affect the
> > >> whole file? If it's just for the lines, then it's what we want.
> > >>
> > > At least from the vim plugin code, it's just for the new lines:
> > > 
> > > https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
> > > 
> > > It just call the replace on the current line.
> > 
> > My bad, %s, it replaces all existing lines...
>
> So this would introduce unrelated changes, but it seems that we don't
> have much trailing whitespaces in progs codebase:
>
> $ git grep '\s\+$'
> btrfs-fragments.c:
> btrfs-fragments.c: black = gdImageColorAllocate(im, 0, 0, 0);
> crypto/crc32c.c:/*
> crypto/crc32c.c: *
> crypto/crc32c.c: * Software Foundation; either version 2 of the License,
> or (at your option)
> crypto/crc32c.c: * Steps through buffer one byte at at time, calculates
> reflected
> crypto/crc32c.c: * Steps through buffer one byte at at time, calculates
> reflected
> kernel-lib/radix-tree.h: *
> kernel-lib/radix-tree.h: *
> kernel-lib/rbtree.c: node = node->rb_right;
> kernel-lib/rbtree.c: node = node->rb_left;
> kernel-lib/rbtree.h:
>
> filtering only the sources. So let's keep it in the config.

Sounds good. Should I send a followup patch to delete the existing
trailing lines?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 13:00         ` Qu Wenruo
@ 2020-07-28 17:26           ` Daniel Xu
  2020-07-29  9:59             ` David Sterba
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Xu @ 2020-07-28 17:26 UTC (permalink / raw)
  To: Qu Wenruo, dsterba, linux-btrfs, kernel-team

On Tue Jul 28, 2020 at 6:00 AM PDT, Qu Wenruo wrote:
>
>
> On 2020/7/28 下午8:57, David Sterba wrote:
> > On Tue, Jul 28, 2020 at 08:12:40PM +0800, Qu Wenruo wrote:
> >>>>> +trim_trailing_whitespace = true
> >>>>
> >>>> Does this setting apply on lines that get changed or does it affect the
> >>>> whole file? If it's just for the lines, then it's what we want.
> >>>>
> >>> At least from the vim plugin code, it's just for the new lines:
> >>>
> >>> https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
> >>>
> >>> It just call the replace on the current line.
> >>
> >> My bad, %s, it replaces all existing lines...
> > 
> > So this would introduce unrelated changes, but it seems that we don't
> > have much trailing whitespaces in progs codebase:
> > 
> >   $ git grep '\s\+$'
> >   btrfs-fragments.c:
> >   btrfs-fragments.c:                              black = gdImageColorAllocate(im, 0, 0, 0);  
> >   crypto/crc32c.c:/* 
> >   crypto/crc32c.c: * 
> >   crypto/crc32c.c: * Software Foundation; either version 2 of the License, or (at your option) 
> >   crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
> >   crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
> >   kernel-lib/radix-tree.h: * 
> >   kernel-lib/radix-tree.h: * 
> >   kernel-lib/rbtree.c:            node = node->rb_right; 
> >   kernel-lib/rbtree.c:            node = node->rb_left; 
> >   kernel-lib/rbtree.h:  
> > 
> > filtering only the sources. So let's keep it in the config.
> > 
> Great.
>
> BTW, it would be better to mention we use editorconfig as the unified
> formatting config.
>
> As most of us are using vim, which doesn't support editorconfig by
> default, thus we need to install that plugin manually.

Sure, should a hint about editorconfig go into the `Development` section
of the README.md?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 17:24         ` Daniel Xu
@ 2020-07-29  9:58           ` David Sterba
  0 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2020-07-29  9:58 UTC (permalink / raw)
  To: Daniel Xu; +Cc: dsterba, Qu Wenruo, linux-btrfs, kernel-team

On Tue, Jul 28, 2020 at 10:24:31AM -0700, Daniel Xu wrote:
> On Tue Jul 28, 2020 at 5:57 AM PDT, David Sterba wrote:
> > On Tue, Jul 28, 2020 at 08:12:40PM +0800, Qu Wenruo wrote:
> > > >>> +trim_trailing_whitespace = true
> > > >>
> > > >> Does this setting apply on lines that get changed or does it affect the
> > > >> whole file? If it's just for the lines, then it's what we want.
> > > >>
> > > > At least from the vim plugin code, it's just for the new lines:
> > > > 
> > > > https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
> > > > 
> > > > It just call the replace on the current line.
> > > 
> > > My bad, %s, it replaces all existing lines...
> >
> > So this would introduce unrelated changes, but it seems that we don't
> > have much trailing whitespaces in progs codebase:
> >
> > $ git grep '\s\+$'
> > btrfs-fragments.c:
> > btrfs-fragments.c: black = gdImageColorAllocate(im, 0, 0, 0);
> > crypto/crc32c.c:/*
> > crypto/crc32c.c: *
> > crypto/crc32c.c: * Software Foundation; either version 2 of the License,
> > or (at your option)
> > crypto/crc32c.c: * Steps through buffer one byte at at time, calculates
> > reflected
> > crypto/crc32c.c: * Steps through buffer one byte at at time, calculates
> > reflected
> > kernel-lib/radix-tree.h: *
> > kernel-lib/radix-tree.h: *
> > kernel-lib/rbtree.c: node = node->rb_right;
> > kernel-lib/rbtree.c: node = node->rb_left;
> > kernel-lib/rbtree.h:
> >
> > filtering only the sources. So let's keep it in the config.
> 
> Sounds good. Should I send a followup patch to delete the existing
> trailing lines?

That's all in files that are synced from kernel and we won't need to
edit them anyway.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] btrfs-progs: Add basic .editorconfig
  2020-07-28 17:26           ` Daniel Xu
@ 2020-07-29  9:59             ` David Sterba
  0 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2020-07-29  9:59 UTC (permalink / raw)
  To: Daniel Xu; +Cc: Qu Wenruo, dsterba, linux-btrfs, kernel-team

On Tue, Jul 28, 2020 at 10:26:58AM -0700, Daniel Xu wrote:
> On Tue Jul 28, 2020 at 6:00 AM PDT, Qu Wenruo wrote:
> >
> >
> > On 2020/7/28 下午8:57, David Sterba wrote:
> > > On Tue, Jul 28, 2020 at 08:12:40PM +0800, Qu Wenruo wrote:
> > >>>>> +trim_trailing_whitespace = true
> > >>>>
> > >>>> Does this setting apply on lines that get changed or does it affect the
> > >>>> whole file? If it's just for the lines, then it's what we want.
> > >>>>
> > >>> At least from the vim plugin code, it's just for the new lines:
> > >>>
> > >>> https://github.com/editorconfig/editorconfig-vim/blob/0a3c1d8082e38a5ebadcba7bb3a608d88a9ff044/plugin/editorconfig.vim#L494
> > >>>
> > >>> It just call the replace on the current line.
> > >>
> > >> My bad, %s, it replaces all existing lines...
> > > 
> > > So this would introduce unrelated changes, but it seems that we don't
> > > have much trailing whitespaces in progs codebase:
> > > 
> > >   $ git grep '\s\+$'
> > >   btrfs-fragments.c:
> > >   btrfs-fragments.c:                              black = gdImageColorAllocate(im, 0, 0, 0);  
> > >   crypto/crc32c.c:/* 
> > >   crypto/crc32c.c: * 
> > >   crypto/crc32c.c: * Software Foundation; either version 2 of the License, or (at your option) 
> > >   crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
> > >   crypto/crc32c.c: * Steps through buffer one byte at at time, calculates reflected 
> > >   kernel-lib/radix-tree.h: * 
> > >   kernel-lib/radix-tree.h: * 
> > >   kernel-lib/rbtree.c:            node = node->rb_right; 
> > >   kernel-lib/rbtree.c:            node = node->rb_left; 
> > >   kernel-lib/rbtree.h:  
> > > 
> > > filtering only the sources. So let's keep it in the config.
> > > 
> > Great.
> >
> > BTW, it would be better to mention we use editorconfig as the unified
> > formatting config.
> >
> > As most of us are using vim, which doesn't support editorconfig by
> > default, thus we need to install that plugin manually.
> 
> Sure, should a hint about editorconfig go into the `Development` section
> of the README.md?

Yeah that would be useful, thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-07-29  9:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28  1:57 [PATCH v2] btrfs-progs: Add basic .editorconfig Daniel Xu
2020-07-28  1:58 ` Qu Wenruo
2020-07-28  2:23 ` Neal Gompa
2020-07-28 11:38 ` David Sterba
2020-07-28 12:03   ` Qu Wenruo
2020-07-28 12:12     ` Qu Wenruo
2020-07-28 12:57       ` David Sterba
2020-07-28 13:00         ` Qu Wenruo
2020-07-28 17:26           ` Daniel Xu
2020-07-29  9:59             ` David Sterba
2020-07-28 17:24         ` Daniel Xu
2020-07-29  9:58           ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.