From 7b003dbfe3c17e696b7995e3ae48e0f160271ae8 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Tue, 15 Jun 2021 10:40:58 -0400 Subject: [PATCH] [dev-image] Add support for pre-commit --- .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ dev/image/Dockerfile | 4 ++++ 2 files changed, 28 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 00000000000000..75fb04699866e8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.0 + hooks: + #- id: check-yaml + # args: [--allow-multiple-documents] + # - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-symlinks + - id: mixed-line-ending + +# keep fork in sync! +- repo: https://github.com/gitpod-io/pre-commit-hooks + rev: "2.1.5" + hooks: + - id: forbid-binary + exclude: | + (?x)^( + .*example-layer.tar.gz| + .*\.(png|svg|ico|gpg) + )$ + - id: script-must-have-extension + - id: shellcheck + args: [-e, "SC1090,SC1091"] diff --git a/dev/image/Dockerfile b/dev/image/Dockerfile index 1d0fa4a0de425a..b9f8c96c210777 100644 --- a/dev/image/Dockerfile +++ b/dev/image/Dockerfile @@ -190,3 +190,7 @@ ENV PATH=$PATH:$HOME/.aws-iam:$HOME/.terraform # https://about.codecov.io/blog/introducing-codecovs-new-uploader RUN sudo curl -fsSL https://uploader.codecov.io/latest/codecov-linux -o /usr/local/bin/codecov \ && sudo chmod +x /usr/local/bin/codecov + +# Install pre-commit https://pre-commit.com/#install +RUN sudo install-packages shellcheck \ + && sudo pip3 install pre-commit