mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-22 06:13:54 -07:00
Use pre-commit on this repo
Changes: * .pre-commit-config.yaml: uses pre-commit on this repo * .travis.yml: run pre-commit in Travis CI pipeline
This commit is contained in:
parent
5517305827
commit
2be30235da
2 changed files with 34 additions and 0 deletions
13
.pre-commit-config.yaml
Normal file
13
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit
|
||||
rev: v2.1.1
|
||||
hooks:
|
||||
- id: validate_manifest
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
name: shellcheck
|
||||
language: docker_image
|
||||
entry: koalaman/shellcheck:stable
|
||||
types: [shell]
|
21
.travis.yml
21
.travis.yml
|
@ -57,6 +57,27 @@ jobs:
|
|||
- source ./.multi_arch_docker
|
||||
- set -ex; multi_arch_docker::main; set +x
|
||||
|
||||
# Run pre-commit checks with the shellcheck docker package that was just
|
||||
# deployed.
|
||||
- stage: Pre-commit checks
|
||||
language: python
|
||||
python: 3.7
|
||||
cache:
|
||||
- pip
|
||||
- directories: $HOME/.cache/pre-commit
|
||||
install: pip install pre-commit
|
||||
script: |
|
||||
# Run pre-commit. It also uses shellcheck on itself from the just built
|
||||
# and deployed docker image.
|
||||
# Use the first build tag, or if there isn't any use 'latest'.
|
||||
set -e
|
||||
tag="$(echo "${TAGS/ */}")"
|
||||
tag="${tag:-latest}"
|
||||
echo "tag: $tag"
|
||||
sed -i.bak -e "s/\(shellcheck\):.*/\1:$tag/" .pre-commit-config.yaml
|
||||
pre-commit run --all-files --show-diff-on-failure --color=always
|
||||
mv .pre-commit-config.yaml.bak .pre-commit-config.yaml
|
||||
|
||||
# This is in global context and runs for every stage that doesn't override it.
|
||||
before_install: |
|
||||
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue