Message ID | 20200728015715.142747-1-dxu@dxuuu.xyz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] btrfs-progs: Add basic .editorconfig | expand |
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 >
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>
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.
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
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 >
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.
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
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?
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?
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.
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.
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
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 -- 2.27.0