Annotation of freem/scripts/fmd-lint, revision 1.4
1.1 snw 1: #!/usr/bin/env bash
2:
3: #
1.4 ! snw 4: # $Id: fmd-lint,v 1.3 2025/04/10 01:24:38 snw Exp $
1.1 snw 5: # Run cppcheck on FreeM
6: #
7: #
8: # Author: Serena Willis <snw@coherent-logic.com>
9: # Copyright (C) 2025 Coherent Logic Development LLC
10: #
11: #
12: # This file is part of FreeM.
13: #
14: # FreeM is free software: you can redistribute it and/or modify
15: # it under the terms of the GNU Affero Public License as published by
16: # the Free Software Foundation, either version 3 of the License, or
17: # (at your option) any later version.
18: #
19: # FreeM is distributed in the hope that it will be useful,
20: # but WITHOUT ANY WARRANTY; without even the implied warranty of
21: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22: # GNU Affero Public License for more details.
23: #
24: # You should have received a copy of the GNU Affero Public License
25: # along with FreeM. If not, see <https://www.gnu.org/licenses/>.
26: #
1.2 snw 27: # $Log: fmd-lint,v $
1.4 ! snw 28: # Revision 1.3 2025/04/10 01:24:38 snw
! 29: # Remove C++ style comments
! 30: #
1.3 snw 31: # Revision 1.2 2025/04/09 19:52:02 snw
32: # Eliminate as many warnings as possible while building with -Wall
33: #
1.2 snw 34: # Revision 1.1 2025/04/09 15:47:36 snw
35: # Add fmd lint command
36: #
1.1 snw 37: #
38: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
39: # SPDX-License-Identifier: AGPL-3.0-or-later
40: #
41:
42: PGM=$(basename $0)
43: SCRIPT_DIR=$(dirname "$0")
44:
45: source "${SCRIPT_DIR}/_fmd_common.bash"
46:
47: function usage() {
48: echo
49: echo "Runs static code analysis on FreeM code"
50: echo
51: echo "usage: "
52: echo
53: echo " fmd lint"
54: echo
55: exit 0
56: }
57:
58: if [[ $1 == "help" ]]
59: then
60: usage
61: fi
62:
63: if [[ $# == 0 ]]
64: then
65: echo "lint: must be run from 'fmd lint'"
66: exit 1
67: fi
68:
69: FMD=$1
70: REPORTFILE="freem_lint_${_fmd_freem_version}.log"
71:
1.2 snw 72: echo -n "${PGM}: linting src/*.[ch] to ${REPORTFILE} (this may take awhile)... "
1.4 ! snw 73: cppcheck --language=c --std=c99 --template=gcc --suppress=missingIncludeSystem --enable=all --check-level=exhaustive --quiet --force --check-level=exhaustive --enable=all --inconclusive src/*.[ch] &> "${REPORTFILE}"
1.2 snw 74: if [[ $? == 0 ]]
75: then
76: echo "[OK]"
77: else
78: echo "[FAIL]"
79: fi
1.1 snw 80:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>