forked from freifunk-berlin/falter-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (31 loc) · 1.07 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
LUAPATH = $(HOME)/.luarocks/bin
PIPPATH = $(HOME)/.local/bin
help:
@echo
@echo 'Available commands:'
@echo ' make deps - Install the prerequisite code analysis tools.'
@echo ' make fmt - Apply automatic code formatting. (shell)'
@echo ' make lint - Check for frequent issues in code. (shell, lua)'
@echo
.PHONY: help
deps:
luarocks --local install luacheck
@echo
@echo 'Done. Please also install manually with apt or dnf: shellcheck shfmt gitleaks'
@echo
.PHONY: deps
fmt: shfmt # TODO: black isort
.PHONY: fmt
lint: shellcheck luacheck # TODO: gitleaks flake8 pylint
.PHONY: lint
shfmt:
shfmt -ln=mksh -l ./luci/ ./packages/ | xargs shfmt -w -l -ln=mksh -i 4 -ci -bn
.PHONY: shfmt
shellcheck:
# The excluded cases are supported by Busybox but not POSIX.
# TODO update to shellcheck 0.10 for busybox sh support
grep -rIzl '^#![[:blank:]]*/bin/sh' ./packages ./luci | xargs shellcheck -S warning -e SC3003,SC3014,SC3018,SC3020,SC3030,SC3039,SC3043,SC3054,SC3060
.PHONY: shellcheck
luacheck:
$(LUAPATH)/luacheck ./packages ./luci -q -o 'nowarningsplease'
.PHONY: luacheck