From c6ab52eebb3428f0f0bf7ed05d84d65eb7259859 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Mon, 3 Oct 2022 11:14:00 -0400 Subject: [PATCH] [skip ci] Add an .editorconfig for .cpp/.h/.md for whitespace settings (#1901) Make it less likely to accidentally introduce tabs, trailing whitespace, carriage returns, non-utf8 in files, or files without trailing newlines. https://editorconfig.org/ has plugins for various editors/IDEs and is enabled by default in some IDEs. --- .editorconfig | 12 ++++++++++++ .gitattributes | 1 + 2 files changed, 13 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..d75a448dd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# https://editorconfig.org/ +root = true +# Conservatively avoid changing defaults for other file types, e.g. raw json files for test cases, +# Makefiles, etc. +[*.{cpp,h,md}] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +tab_width = 2 +trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes index 5286feedd..aef3e3848 100644 --- a/.gitattributes +++ b/.gitattributes @@ -78,6 +78,7 @@ .gitattributes export-ignore .gitignore export-ignore +.editorconfig export-ignore # Sources *.c text eol=lf diff=c