From 3a0da07a690a0468e796c888c83414e8c0624e18 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 14:34:32 +0300 Subject: [PATCH 1/3] Enforce some coding standards for the contributers --- .pre-commit-config.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..51e4318d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +--- +# fail_fast: true +minimum_pre_commit_version: 1.18.1 +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + - id: mixed-line-ending + - id: check-added-large-files + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 1.11.0 + hooks: + - id: git-check # Configure in .gitattributes + - id: shellcheck + - id: shfmt + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.7 + hooks: + # - id: forbid-crlf + - id: remove-crlf From a7a37b8e89e59ffa0647dd5c8d202da87a044c51 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 15:05:52 +0300 Subject: [PATCH 2/3] Add a note on how to use the pre-commit yaml. --- DEVELOPMENT.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ba9efe60..bb03ab49 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -43,3 +43,11 @@ For `aliases`, `plugins` and `completions`, the following rules are applied that Having the order based on a numeric priority in a common directory allows for more flexibility. While in general, aliases are loaded first (since their default priority is 150), it's possible to load some aliases after the plugins, or some plugins after completions by setting the items' load priority. This is more flexible than a fixed type-based order or a strict alphabetical order based on name. These items are subject to change. When making changes to the internal functionality, this page needs to be updated as well. + +## Using the pre-commit hook + +Note the file .pre-commit-config.yaml at the top of the repo. +This file configures the behavior of the a pre-commit hook based on [the Pre-Commit framework](https://pre-commit.com/). Please see the site about +installing it (with pip, brew or other tools) then run `pre-commit install` in the repo's root to activate the hook. +For the full use of the tool, you may need to install also other third-party tools, such as +[shellcheck](https://github.com/koalaman/shellcheck/) and [shfmt](https://github.com/mvdan/sh). From 6571eb4dd8fd82cd21a297d006105b6be250c9ea Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 10 Mar 2020 10:37:07 +0200 Subject: [PATCH 3/3] In case we ARE committing to tabs now... --- .editorconfig | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 87e50155..4d52b509 100755 --- a/.editorconfig +++ b/.editorconfig @@ -1,12 +1,32 @@ # EditorConfig is awesome: http://EditorConfig.org [*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 +indent_style = tab +indent_size = 1 + +shell_variant = bash +binary_next_line = true # like -bn +switch_case_indent = true # like -ci +space_redirects = true # like -sr +keep_padding = true # like -kp +end_of_line = lf +charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false + +[*.*sh] +indent_style = tab +indent_size = 1 + +shell_variant = bash +binary_next_line = true # like -bn +switch_case_indent = true # like -ci +space_redirects = true # like -sr +keep_padding = true # like -kp +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true