From 8c8930f5c57859abdee6c154efe206a0c02a2500 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Thu, 21 Nov 2024 08:45:34 +0100 Subject: [PATCH] Makefile targets for linting --- lab2/Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lab2/Makefile b/lab2/Makefile index 48c8fe4..0b87009 100644 --- a/lab2/Makefile +++ b/lab2/Makefile @@ -3,6 +3,7 @@ CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast #CXXFLAGS += -Werror SRC = $(wildcard *.cc) +HDR = $(wildcard *.h) OBJ = $(SRC:.cc=.o) all: spell edit $(OBJ) @@ -19,7 +20,18 @@ spell: spell.o word.o dictionary.o @echo "Building $@" @$(CXX) -c $(CXXFLAGS) $< -o $@ +lint: clang-tidy cppcheck clang-format + +clang-tidy: + clang-tidy $(SRC) -- $(CXXFLAGS) + +cppcheck: + cppcheck --enable=all --language=c++ --std=c++17 --suppress=missingIncludeSystem -I/usr/include $(SRC) $(HDR) + +clang-format: + clang-format -i $(SRC) $(HDR) + clean: rm -f *.o spell edit -.PHONY: clean +.PHONY: clean all lint clang-tidy cppcheck clang-format