File:  [Coherent Logic Development] / freem / scripts / fmd-lint
Revision 1.4: download - view: text, annotated - select for diffs
Tue Apr 15 14:39:06 2025 UTC (3 months, 2 weeks ago) by snw
Branches: MAIN
CVS tags: HEAD
Further improvements to logging

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

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