From 1ce5855059e57918bb9f07b1ac20d2c5a63e0090 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 14:34:32 +0300 Subject: [PATCH 1/4] Enforce some coding standards for the contributers --- .pre-commit-config.yaml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 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..856cfca4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,39 @@ +# 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-docstring-first + - id: check-merge-conflict + - id: requirements-txt-fixer + - id: double-quote-string-fixer + - id: forbid-new-submodules + - id: mixed-line-ending + - id: check-added-large-files + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 1.11.0 + hooks: + - id: forbid-binary + - id: git-check # Configure in .gitattributes + - id: git-dirty # Configure in .gitignore + - id: markdownlint # Configure in .mdlrc + - id: shellcheck + - id: shfmt + - repo: git://github.com/detailyang/pre-commit-shell + rev: 1.0.5 + hooks: + - id: shell-lint + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.7 + hooks: + # - id: forbid-crlf + - id: remove-crlf + # - id: forbid-tabs + - id: remove-tabs + args: [--whitespaces-count, '2'] # defaults to: 4 From a7a2dba217ad7201335625a0b5f1ec5b0e1f7b73 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 15:05:52 +0300 Subject: [PATCH 2/4] 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 7c0fa9e04c2f5de7f6cf9261510cc27be80b3344 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 16:17:16 +0300 Subject: [PATCH 3/4] another round of refinements after PR #1434 --- .pre-commit-config.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 856cfca4..54947ed7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,20 +9,13 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: check-docstring-first - id: check-merge-conflict - - id: requirements-txt-fixer - - id: double-quote-string-fixer - - id: forbid-new-submodules - id: mixed-line-ending - id: check-added-large-files - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: 1.11.0 hooks: - - id: forbid-binary - id: git-check # Configure in .gitattributes - - id: git-dirty # Configure in .gitignore - - id: markdownlint # Configure in .mdlrc - id: shellcheck - id: shfmt - repo: git://github.com/detailyang/pre-commit-shell @@ -37,3 +30,4 @@ repos: # - id: forbid-tabs - id: remove-tabs args: [--whitespaces-count, '2'] # defaults to: 4 + exclude: .gitmodules From f09bbed260370c5bfbbc9299f4e8c990ff3977f3 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 10 Mar 2020 10:09:32 +0200 Subject: [PATCH 4/4] Don't touch tab indentations, they are there for a good reason --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54947ed7..e6302b9e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,3 @@ repos: hooks: # - id: forbid-crlf - id: remove-crlf - # - id: forbid-tabs - - id: remove-tabs - args: [--whitespaces-count, '2'] # defaults to: 4 - exclude: .gitmodules