diff mbox series

[ovs-dev,v4] Add editorconfig file.

Message ID 20230619153705.953974-1-rjarry@redhat.com
State Accepted
Commit 07f6d6a0cb519840b1a1401dc1c4dd741b5150cd
Headers show
Series [ovs-dev,v4] Add editorconfig file. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Robin Jarry June 19, 2023, 3:37 p.m. UTC
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 <rjarry@redhat.com>
Cc: Mike Pattrick <mkp@redhat.com>
Cc: Eelco Chaudron <echaudro@redhat.com>
Cc: Ilya Maximets <i.maximets@ovn.org>
---

Notes:
    v4:
    
    * Listed files that use tabs more restrictively.
    * I assumed that every header under include/linux uses tabs since this
      is the coding style of the kernel.
    * Also, any header named include/sparse/rte_*.h most likely comes from
      DPDK which also uses tabs for indentation.

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

Comments

Ilya Maximets June 20, 2023, 3:26 p.m. UTC | #1
On 6/19/23 17:37, 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 <rjarry@redhat.com>
> Cc: Mike Pattrick <mkp@redhat.com>
> Cc: Eelco Chaudron <echaudro@redhat.com>
> Cc: Ilya Maximets <i.maximets@ovn.org>
> ---
> 
> Notes:
>     v4:
>     
>     * Listed files that use tabs more restrictively.
>     * I assumed that every header under include/linux uses tabs since this
>       is the coding style of the kernel.
>     * Also, any header named include/sparse/rte_*.h most likely comes from
>       DPDK which also uses tabs for indentation.
> 
>  .editorconfig | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  Makefile.am   |  1 +
>  2 files changed, 49 insertions(+)
>  create mode 100644 .editorconfig

Applied.  Thanks!

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000000..685c7275005f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,48 @@ 
+# 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/getopt.h]
+indent_style = tab
+indent_size = tab
+tab_width = 8
+
+[include/windows/netinet/{icmp6,ip6}.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 \