summaryrefslogtreecommitdiff
path: root/tools/scripts/lint
blob: 0c0c3520bd1814c01aefe05e7a77ec9065209a8f (plain)
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
#!/usr/bin/env sh

SRCDIR="${SRCDIR:-src}"

echo "Running bear..."
if which bear >/dev/null ; then
	make clean
	bear -- make 2>&1>/dev/null
else
  echo -e "\e[31mnot found. Without compile_commands.json results might be bad or outright wrong.\e[0m"
fi

echo "Running cppcheck..."
if which cppcheck >/dev/null ; then
  echo ""
	if [ -e 'compile_commands.json' ] ; then
		cppcheck --language=c --std=c99 --enable=all \
			--suppress={missingIncludeSystem,unusedFunction} \
			--project=compile_commands.json \
				-q "${SRCDIR}"
	else
		cppcheck --language=c --std=c99 --enable=all \
			--suppress={missingIncludeSystem,unusedFunction} \
				-q "${SRCDIR}"
	fi
else
  echo -e "\e[31mnot found\e[0m"
fi