-
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.
- Loading branch information
Showing
5 changed files
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
fail_fast: false | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: black-check | ||
name: Check python files with black | ||
entry: black | ||
args: [--check] | ||
language: system | ||
types: [python] | ||
- repo: local | ||
hooks: | ||
- id: black-fix | ||
name: Format python files with black | ||
entry: black | ||
language: system | ||
verbose: true | ||
stages: [manual] | ||
types: [python] | ||
- repo: local | ||
hooks: | ||
- id: pylint | ||
name: Check python files with pylint | ||
entry: pylint | ||
language: system | ||
types: [python] |
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,8 @@ | ||
FROM petzi/pre-commit:1.15.2-9 | ||
RUN apk add --no-cache \ | ||
gcc \ | ||
musl-dev \ | ||
python3-dev | ||
COPY requirements.txt / | ||
RUN pip3 install --no-cache-dir -r requirements.txt | ||
COPY .pre-commit-config.yaml / |
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,28 @@ | ||
# Makefile for petzi/docker-pre-commit | ||
# Make targets to help in the development of this docker image | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
# Docker configuration | ||
DOCKER=docker | ||
# Docker build configuration | ||
DOCKER_TAG=petzi/pre-commit-python | ||
|
||
# Docker run configuration for the main image | ||
DOCKER_VOL=-v "${PWD}:/src" | ||
DOCKER_WD=-w "/src" | ||
DOCKER_RUN_TEST=$(DOCKER) run --rm $(DOCKER_VOL) $(DOCKER_WD) | ||
|
||
# The help command is inspired by this post: | ||
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: build | ||
build: ## Build the images on development | ||
$(DOCKER) build -t $(DOCKER_TAG) . | ||
|
||
.PHONY: test | ||
test: ## Run each image once to test the build result | ||
$(DOCKER_RUN_TEST) $(DOCKER_TAG) --all-files |
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,2 @@ | ||
black==19.3b0 | ||
pylint==2.3.1 |
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,3 @@ | ||
# pylint: disable=missing-docstring | ||
def hello(): | ||
print("Hello world") |