Skip to content

Commit

Permalink
added clang for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jyothiraditya-n committed Aug 14, 2023
1 parent 7646924 commit 76b9954
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions clang_tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /bin/bash

# libClame: Command-line Arguments Made Easy
# Copyright (C) 2021-2023 Jyothiraditya Nellakra
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

# Produce a Latex output file, which quotes the input file in a minted code
# block. Then, add that output file to a listings file.

# Get information on oppsies in your code, pass the files you want to check via
# $@.

# Check that the configuration folder exists.
if [ ! -d ".config/" ]; then
echo "### missing configuration. you need to run 'make config'."
exit 1
fi

# Get some configuration data.
cflags="$(cat ".config/cflags_debug.conf")"
ccflags="$(cat ".config/ccflags_debug.conf")"

# We use clang for this even though I generally compile with gcc because that
# increases the change that nasty bugs will get caught by one set of warnings
# or another.

for i in "$@"; do
case "$i" in
*.c) (set -x; clang-tidy "$i" -- $cflags);;
*.cpp) (set -x; clang-tidy "$i" -- $cflags);;
esac
done

0 comments on commit 76b9954

Please sign in to comment.