From 32fa20a130640409d089d922cf731999bebf4a31 Mon Sep 17 00:00:00 2001 From: Paul Beesley <830976+poll-busily@users.noreply.github.com> Date: Wed, 23 Dec 2020 13:30:21 +0000 Subject: [PATCH] Add editorconfig file for setting coding style Editorconfig is a standard, supported by many popular editing tools, that helps set required editor settings automatically to support the project's coding style. It's not a linter / auto-formatter, it just sets a few basic options. Supported editors will pick up these settings specifically for the cloudlog source directory, not interfering with project or user settings in other locations. This config specifies UTF-8 encoding and LF line-endings for all project files, tabbed indentation for source and data files and finally final newlines and whitespace trimming just for source files. These are based on what I saw in https://github.com/magicbug/Cloudlog/wiki/Development-Notes and from the dominant formatting options in the existing source files. All open to changes, of course. If an editor is set up to perform reformatting of code automatically (e.g. on save or on paste) then these rules will influence that behaviour, but they will not cause an editor to reformat existing code on their own. --- .editorconfig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..103ea92b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# Automatic editor configuration for the Cloudlog coding style. +# See https://editorconfig.org/#download to check for support in your editor of +# choice. + +# This is the root configuration file (there are no others in subdirectories). +root = true + +# These global rules affect all files under the repository root. +[*] +charset = utf-8 +end_of_line = lf + +# These rules affect the listed file types only. Global rules still apply and +# are overridden if the same key is assigned a different value here. +[*.{php,js,html,xml,css}] +indent_style = tab +indent_size = 4 + +# These rules are specifically for code +[*.{php,js}] +insert_final_newline = true +trim_trailing_whitespace = true \ No newline at end of file