-
Notifications
You must be signed in to change notification settings - Fork 1
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
41 changed files
with
2,426 additions
and
1,429 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,4 @@ | ||
# First black run on all code | ||
7cd00161dece9ce2a1d9387bd48e569f59f851bf | ||
# Second black run | ||
d3c260e9fb64fab2c4b9cb7d58e05f7d8ca0424e |
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,33 @@ | ||
# Minimal Makefile for automating recurring tasks during development | ||
# | ||
# Copyright (c) 2023, Till Biskup | ||
# 2023-12-06 | ||
|
||
.PHONY: docs tests help | ||
.DEFAULT_GOAL := help | ||
|
||
help: | ||
@echo "This makefile automates different recurring tasks" | ||
@echo "" | ||
@echo "The following targets are available:" | ||
@echo "" | ||
@echo "docs - create documentation using Sphinx" | ||
@echo "tests - run unittests" | ||
@echo "check - check code using prospector" | ||
@echo "black - format code using Black" | ||
|
||
docs: | ||
@echo "Create documentation using Sphinx" | ||
$(MAKE) -C docs html | ||
|
||
tests: | ||
@echo "Run unittests" | ||
cd tests/ && python -m unittest discover -s . -t . | ||
|
||
check: | ||
@echo "Check code using prospector... this may take a while" | ||
prospector | ||
|
||
black: | ||
@echo "Automatically format code using Black" | ||
black -l 78 . --extend-exclude templates |
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.5.0 | ||
0.5.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,43 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Autoformat Python files currently in git staging area. | ||
# | ||
# Intended for using in pre-commit hook | ||
# | ||
# Formatter, formatter options and exclude pattern can be set. | ||
# | ||
# Note that due to calling the formatter explicitly for files, exclude patterns | ||
# via formatter options are likely to not work. Hence the list of files to be | ||
# reformatted needs to be filtered beforehand. | ||
# | ||
# Existence of the formatter is checked, and if it is not present, | ||
# the script silently exits. | ||
# | ||
# Only Python files in the staging area are reformatted and afterwards | ||
# re-added to the staging area. | ||
# | ||
# Copyright (c) 2023, Till Biskup | ||
# 2023-12-06 | ||
|
||
FORMATTER="black" | ||
FORMATTER_OPTIONS="-l 78" | ||
EXCLUDE_PATTERN="templates" | ||
|
||
if ! command -v $FORMATTER &> /dev/null | ||
then | ||
exit | ||
fi | ||
|
||
if \[ -n "$EXCLUDE_PATTERN" \]; | ||
then | ||
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.py' | grep -v $EXCLUDE_PATTERN) | ||
else | ||
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.py') | ||
fi | ||
|
||
for file in $CHANGED_FILES | ||
do | ||
echo "Reformat '$file' using '$FORMATTER $FORMATTER_OPTIONS'" | ||
$FORMATTER $FORMATTER_OPTIONS "$file" | ||
git add "$file" | ||
done |
Oops, something went wrong.