-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from EURODEO/ci-cd-2
Add linters for Docker, Go, Python, and Shell
- Loading branch information
Showing
36 changed files
with
883 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
# go-fmt ~ Enforces Go standard formatting (whitespace, indentation, et cetera) | ||
- id: go-fmt | ||
name: go-fmt | ||
description: "Enforces Go standard formatting (whitespace, indentation, et cetera)." | ||
entry: ./ci/go/go-fmt.sh | ||
language: script | ||
pass_filenames: false | ||
# # go-vet ~ Finds subtle issues in Go where your code may not work as intended | ||
# - id: go-vet | ||
# name: go-vet | ||
# description: "Finds subtle issues in Go where your code may not work as intended." | ||
# entry: ./ci/go/go-vet.sh | ||
# language: script | ||
# pass_filenames: false | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
# Formatting | ||
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline. | ||
- id: pretty-format-json | ||
args: ["--autofix", "--indent=4", "--no-ensure-ascii", "--no-sort-keys"] # Formats and sorts your JSON files. | ||
- id: trailing-whitespace # Trims trailing whitespace. | ||
# Checks | ||
- id: check-json # Attempts to load all json files to verify syntax. | ||
- id: check-merge-conflict # Check for files that contain merge conflict strings. | ||
- id: check-shebang-scripts-are-executable # Checks that scripts with shebangs are executable. | ||
- id: check-yaml | ||
# only checks syntax not load the yaml: | ||
# https://stackoverflow.com/questions/59413979/how-exclude-ref-tag-from-check-yaml-git-hook | ||
args: ["--unsafe"] # Parse the yaml files for syntax. | ||
|
||
# reorder-python-imports ~ sort python imports | ||
- repo: https://github.com/asottile/reorder_python_imports | ||
rev: v3.12.0 | ||
hooks: | ||
- id: reorder-python-imports | ||
|
||
# black ~ Formats Python code | ||
- repo: https://github.com/psf/black | ||
rev: 23.10.0 | ||
hooks: | ||
- id: black | ||
args: ["--line-length=120"] | ||
|
||
# flake8 ~ Enforces the Python PEP8 style guide | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
args: | ||
[ | ||
"--ignore=W503", | ||
"--max-line-length=120", | ||
] | ||
|
||
# hadolint ~ Docker linter | ||
- repo: https://github.com/hadolint/hadolint | ||
rev: v2.12.0 | ||
hooks: | ||
- id: hadolint-docker | ||
args: [ | ||
"--ignore=DL3008", # Pin versions in apt get install. | ||
] | ||
|
||
# ShellCheck ~ Gives warnings and suggestions for bash/sh shell scripts | ||
- repo: https://github.com/koalaman/shellcheck-precommit | ||
rev: v0.9.0 | ||
hooks: | ||
- id: shellcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# e-soh-datastore-poc | ||
E-SOH datastore PoCs | ||
|
||
|
||
## Pre-commit | ||
### Setup | ||
1. Go to the root of the repository. | ||
2. Install the python pre-commit package with `pip install pre-commit`. | ||
3. Reinitialize there repository with `git init`. | ||
4. Install the hooks defined in `.pre-commit-config.yaml` with `pre-commit install`. | ||
|
||
### Useful Commands | ||
- To update the pre-commit hooks in `.pre-commit-config.yaml` run: `pre-commit autoupdate`. | ||
- To run the pre-commit for every file in the repository run `pre-commit run --config './.pre-commit-config.yaml' --all-files`. | ||
- To commit without the pre-commit hook `git commit -m "Some message" --no-verify` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.