-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
89 lines (75 loc) · 2.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Set the shell to bash with printing of all commands (`-x`) and unofficial
# strict mode (`-euo pipefail`).
SHELL := bash -x -euo pipefail
# Default target, run on CI. Runs all checks.
.PHONY: ci
ci: \
lint-bash \
check-format-bash \
lint-awk \
check-isort \
check-black \
check-snakefmt \
flake8 \
# Alias lint to ci.
.PHONY: lint
lint: ci
# Run bash linting using spellcheck.
.PHONY: lint-bash
lint-bash:
shellcheck -s bash scripts/*.sh
# Run bash formatting checks using beautysh.
.PHONY: check-format-bash
check-format-bash:
for file in scripts/*.sh; do \
beautysh --check --indent-size 4 $$file --force-function-style paronly; \
done
# Run awk linting using gawk.
.PHONY: lint-awk
lint-awk:
for file in scripts/*.awk; do \
gawk -f $$file -Lfatal /dev/null >/dev/null; \
done
# Run Python import sort checking with isort.
.PHONY: check-isort
check-isort:
isort --profile=black --check-only scripts varfish_db_downloader
# Run Python format checking with black.
.PHONY: check-black
check-black:
black --check --line-length 100 scripts varfish_db_downloader
# Run Snakemake format checking with snakefmt.
.PHONY: check-snakefmt
check-snakefmt:
snakefmt --check --diff --line-length 100 Snakefile
snakefmt --check --diff --line-length 100 rules/*/*/*.smk rules/*/*/*.smk
# Run Python linting with flake8.
.PHONY: flake8
flake8:
flake8 --max-line-length 100 scripts varfish_db_downloader
# Run all automatic code formatting.
.PHONY: format
format: \
format-bash \
isort \
black \
run-snakefmt
# Run bash formatting using beautysh.
.PHONY: format-bash
format-bash:
for file in scripts/*.sh; do \
beautysh --indent-size 4 $$file --force-function-style paronly; \
done
# Run Python import sorting with isort.
.PHONY: isort
isort:
isort --profile=black scripts varfish_db_downloader
# Run Python formatting with black.
.PHONY: black
black:
black --line-length 100 scripts varfish_db_downloader
# Run Snakemake formatting with snakefmt.
.PHONY: run-snakefmt
run-snakefmt:
snakefmt --line-length 100 Snakefile
snakefmt --line-length 100 rules/*/*.smk rules/*/*/*.smk rules/*/*/*/*.smk