Annotation of freem/scripts/fmd-lint, revision 1.3

1.1       snw         1: #!/usr/bin/env bash
                      2: 
                      3: #
1.3     ! snw         4: #   $Id: fmd-lint,v 1.2 2025/04/09 19:52:02 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.3     ! snw        28: #   Revision 1.2  2025/04/09 19:52:02  snw
        !            29: #   Eliminate as many warnings as possible while building with -Wall
        !            30: #
1.2       snw        31: #   Revision 1.1  2025/04/09 15:47:36  snw
                     32: #   Add fmd lint command
                     33: #
1.1       snw        34: #
                     35: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
                     36: # SPDX-License-Identifier: AGPL-3.0-or-later
                     37: #
                     38: 
                     39: PGM=$(basename $0)
                     40: SCRIPT_DIR=$(dirname "$0")
                     41: 
                     42: source "${SCRIPT_DIR}/_fmd_common.bash"
                     43: 
                     44: function usage() {
                     45:     echo
                     46:     echo "Runs static code analysis on FreeM code"
                     47:     echo    
                     48:     echo "usage:  "
                     49:     echo
                     50:     echo "  fmd lint"
                     51:     echo
                     52:     exit 0
                     53: }
                     54: 
                     55: if [[ $1 == "help" ]]
                     56: then
                     57:     usage
                     58: fi
                     59: 
                     60: if [[ $# == 0 ]]
                     61: then
                     62:     echo "lint:  must be run from 'fmd lint'"
                     63:     exit 1
                     64: fi
                     65: 
                     66: FMD=$1
                     67: REPORTFILE="freem_lint_${_fmd_freem_version}.log"
                     68: 
1.2       snw        69: echo -n "${PGM}:  linting src/*.[ch] to ${REPORTFILE} (this may take awhile)... "
1.3     ! snw        70: cppcheck --quiet --check-level=exhaustive --enable=all --inconclusive src/*.[ch] &> "${REPORTFILE}"
1.2       snw        71: if [[ $? == 0 ]]
                     72: then
                     73:     echo "[OK]"
                     74: else
                     75:     echo "[FAIL]"
                     76: fi
1.1       snw        77: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>