Skip to content

Commit

Permalink
Add checks for zombie sourcecode problems
Browse files Browse the repository at this point in the history
This adds checks for zombie sourcecode problems, i.e. problems
we have tried to eliminate but which might be or have been
resurrected.

The example check is for the problematic

    #include "ac_cfg.h"

with double quotes instead of <> which were identified as a
problem in #1706
and then fixed.
  • Loading branch information
ndim committed Aug 24, 2024
1 parent 9e9825c commit 7f70f9c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/sourcecode-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Sourcecode Checks"

on:
push:
branches-ignore:
- 'onlinedocs'
pull_request:
branches-ignore:
- 'onlinedocs'

env:

jobs:

sourcecode-checks:
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4

- name: Install prerequisites
run: >-
- name: "Run sourcecode-checks script"
run: ./tools/sourcecode-checks
49 changes: 49 additions & 0 deletions tools/check-sourcecode
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# check-sourcecode -- check the avrdude source code for zombie mistakes
# Copyright (C) 2024 Hans Ulrich Niedermann <[email protected]>
# SPDX-License-Identifier: GPL-2.0-or-later


set -e

prog="$(basename "$0")"
cd "$(dirname "$0")"
cd ..
test -s README.md
test -s COPYING
test -s build.sh
test -d .git/refs/heads


declare -a checks=()
fail=0
succ=0


checks+=(check_ac_cfg)
check_ac_cfg() {
if git grep -E '#include\s+"ac_cfg\.h"'
then
echo "Error: Found #include \"ac_cfg.h\" with double quotes \"\". Should be <>."
echo " See https://github.com/avrdudes/avrdude/issues/1706 for details."
return 1
fi
}


for check in "${checks[@]}"
do
if "$check"; then
succ=$(( "$succ" + 1 ))
status="SUCC"
else
fail=$(( "$fail" + 1 ))
status="FAIL"
fi
echo "$status $check"
done
total=$(( "$succ" + "$fail" ))


echo "$prog: Summary: $fail checks failed, $succ checks succeeded. $total checks in total."
exit 0

0 comments on commit 7f70f9c

Please sign in to comment.