[ovs-dev] [PATCH v3] Add editorconfig file.

2023-06-13 Thread Robin Jarry
EditorConfig is a file format and collection of text editor plugins for
maintaining consistent coding styles between different editors and IDEs.

Initialize the file following the coding rules in
Documentation/internals/contributing/coding-style.rst and add exceptions
declared in build-aux/initial-tab-allowed-files. Only enforce rules for
*.c and *.h files. Other files should use the default indenting rules
from text editors.

In order for this file to be taken into account (unless they use an
editor with built-in EditorConfig support), developers will have to
install a plugin.

Notes:

* All matching rules are considered. The last matching rule's properties
  will override the previous ones.
* The max_line_length property is only supported by a limited number of
  EditorConfig plugins. It will be ignored if unsupported.

Link: https://editorconfig.org/
Link: https://github.com/editorconfig/editorconfig-emacs
Link: https://github.com/editorconfig/editorconfig-vim
Link: 
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length
Signed-off-by: Robin Jarry 
Acked-by: Mike Pattrick 
Acked-by: Eelco Chaudron 
Cc: Ilya Maximets 
---

Notes:
v3: added exceptions for some *.{c,h} files that are using tabs

 .editorconfig | 43 +++
 Makefile.am   |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 .editorconfig

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index ..6d1842ca0f35
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,43 @@
+# See https://editorconfig.org/ for syntax reference.
+
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+charset = utf-8
+
+[*.{c,h}]
+indent_style = space
+indent_size = 4
+max_line_length = 79
+
+[include/linux/**.h]
+indent_style = tab
+indent_size = tab
+tab_width = 8
+
+[include/sparse/rte_*.h]
+indent_style = tab
+tab_width = 8
+
+[include/windows/**.h]
+indent_style = tab
+indent_size = tab
+tab_width = 8
+
+[lib/getopt_long.c]
+indent_style = tab
+indent_size = tab
+tab_width = 8
+
+[lib/sflow*.{c,h}]
+indent_style = tab
+indent_size = tab
+tab_width = 8
+
+[lib/strsep.c]
+indent_style = tab
+indent_size = tab
+tab_width = 8
diff --git a/Makefile.am b/Makefile.am
index df9c33dfe631..db341504d37f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,6 +82,7 @@ EXTRA_DIST = \
.ci/osx-build.sh \
.ci/osx-prepare.sh \
.cirrus.yml \
+   .editorconfig \
.github/workflows/build-and-test.yml \
appveyor.yml \
boot.sh \
-- 
2.40.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v3] Add editorconfig file.

2023-06-14 Thread Ilya Maximets
On 6/13/23 14:25, Robin Jarry wrote:
> EditorConfig is a file format and collection of text editor plugins for
> maintaining consistent coding styles between different editors and IDEs.
> 
> Initialize the file following the coding rules in
> Documentation/internals/contributing/coding-style.rst and add exceptions
> declared in build-aux/initial-tab-allowed-files. Only enforce rules for
> *.c and *.h files. Other files should use the default indenting rules
> from text editors.
> 
> In order for this file to be taken into account (unless they use an
> editor with built-in EditorConfig support), developers will have to
> install a plugin.
> 
> Notes:
> 
> * All matching rules are considered. The last matching rule's properties
>   will override the previous ones.
> * The max_line_length property is only supported by a limited number of
>   EditorConfig plugins. It will be ignored if unsupported.
> 
> Link: https://editorconfig.org/
> Link: https://github.com/editorconfig/editorconfig-emacs
> Link: https://github.com/editorconfig/editorconfig-vim
> Link: 
> https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length
> Signed-off-by: Robin Jarry 
> Acked-by: Mike Pattrick 
> Acked-by: Eelco Chaudron 

The patch changed significantly, I don't think you can keep the tags.

> Cc: Ilya Maximets 
> ---
> 
> Notes:
> v3: added exceptions for some *.{c,h} files that are using tabs
> 
>  .editorconfig | 43 +++
>  Makefile.am   |  1 +
>  2 files changed, 44 insertions(+)
>  create mode 100644 .editorconfig
> 
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index ..6d1842ca0f35
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,43 @@
> +# See https://editorconfig.org/ for syntax reference.
> +
> +root = true
> +
> +[*]
> +end_of_line = lf
> +insert_final_newline = true
> +trim_trailing_whitespace = true
> +charset = utf-8
> +
> +[*.{c,h}]
> +indent_style = space
> +indent_size = 4
> +max_line_length = 79
> +
> +[include/linux/**.h]
> +indent_style = tab
> +indent_size = tab
> +tab_width = 8
> +
> +[include/sparse/rte_*.h]
> +indent_style = tab
> +tab_width = 8
> +
> +[include/windows/**.h]
> +indent_style = tab
> +indent_size = tab
> +tab_width = 8

While files are present in tabs-allowed it doesn't mean that
all of them actually use tabs.  I'm not sure about other
folders, but at least the windows include folder contains files
with different styles.

Is it possible to just exclude the folder instead of specifying
a format?

> +
> +[lib/getopt_long.c]
> +indent_style = tab
> +indent_size = tab
> +tab_width = 8
> +
> +[lib/sflow*.{c,h}]
> +indent_style = tab
> +indent_size = tab
> +tab_width = 8
> +
> +[lib/strsep.c]
> +indent_style = tab
> +indent_size = tab
> +tab_width = 8
> diff --git a/Makefile.am b/Makefile.am
> index df9c33dfe631..db341504d37f 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -82,6 +82,7 @@ EXTRA_DIST = \
>   .ci/osx-build.sh \
>   .ci/osx-prepare.sh \
>   .cirrus.yml \
> + .editorconfig \
>   .github/workflows/build-and-test.yml \
>   appveyor.yml \
>   boot.sh \

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v3] Add editorconfig file.

2023-06-14 Thread Robin Jarry
Ilya Maximets, Jun 14, 2023 at 13:21:
> While files are present in tabs-allowed it doesn't mean that
> all of them actually use tabs.  I'm not sure about other
> folders, but at least the windows include folder contains files
> with different styles.
>
> Is it possible to just exclude the folder instead of specifying
> a format?

No but I can list only the files which already contain tabs.

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v3] Add editorconfig file.

2023-06-16 Thread Ilya Maximets
On 6/14/23 14:56, Robin Jarry wrote:
> Ilya Maximets, Jun 14, 2023 at 13:21:
>> While files are present in tabs-allowed it doesn't mean that
>> all of them actually use tabs.  I'm not sure about other
>> folders, but at least the windows include folder contains files
>> with different styles.
>>
>> Is it possible to just exclude the folder instead of specifying
>> a format?
> 
> No but I can list only the files which already contain tabs.
> 

OK.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev