ROLES=base proxy toxcore
SHELLCHECK_OPTS=SC2003,SC2006,SC2010,SC2039,SC2181,SC2046,SC2086,SC2048,SC2162,SC2034,SC2030,SC2166,SC2242,SC2223,SC2319,SC3009,SC3011,SC3030,SC3043,SC3054,SC2009,SC1090,SC2164,SC3044


devuan::
	sudo sh ansible_local.bash --diff -i ${PWD}/hosts.yml -l devuan -c local --verbose $(ROLES)  > .check-`cat /etc/hostname` 2>&1

pentoo::
	sudo sh ansible_local.bash --diff -i ${PWD}/hosts.yml -l $@ -c local --verbose $(ROLES)  > .check-`cat /etc/hostname` 2>&1

check::
	. /usr/local/bin/usr_local_tput.bash
	grep -n 'shell: *$$' roles/*/tasks/*.yml && { ERROR "shell: in .yml" ; false ; }
	grep -n '^[a-z ]*: {{' roles/*/tasks/*.yml && { WARN "{{ in .yml" ; false ; } || true
	bash .pylint.sh ; cat .pylint.err
	shellcheck -s bash -W 0 -x -a -e ${SHELLCHECK_OPTS} bin/*sh

lint::
	sudo xmllint -noout etc/libvirt/qemu/gentoo.xml 
	yamllint -c .yamllint.yml -f standard *.yml roles/*/*s/*yml 2>&1| \
		grep -v 'truthy\|indentation' | \
		sed -e '/^$$/d' | tee .yamllint.out | \
		grep -B 2 error | tee .yamllint.err || true
	grep Error .yamllint.out || true

test::
	bash .pyanal.sh
	sudo sh ansible_local.bash --diff --check -i ${PWD}/hosts.yml -l `cat /etc/hostname   -c local --verbose $(ROLES)  > .check-`cat /etc/hostname  2>&1

clean::
	find . -name \*~ -delete