summaryrefslogtreecommitdiff
path: root/bin/find-unused-data.sh
blob: e6e0217f0375e27228a337f435644c4e532273f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash

SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
PATHS="$(find $SCRIPTPATH/.. \( -wholename '*/qa/*/testdocuments' -o -wholename '*/qa/*/testdocuments/*' -o -wholename '*/qa/*/data' -o -wholename '*/qa/*/data/*' \) -type d )"

for path in $PATHS
do
    # Ignore pass/fail/indeterminate folders, functions test in sc, workdir folder and xml in sd
    if [[ "$path" != */pass* ]] && [[ "$path" != */fail* ]] && [[ "$path" != */indeterminate* ]] \
            && [[ "$path" != */functions* ]] && [[ "$path" != */workdir* ]] && [[ "$path" != */xml* ]]; then
        for i in $path/*
        do
            if [ -f "$i" ]; then
                file=$(basename "$i")
                if ! git grep -q "$file"; then
                    echo "WARNING: $i is not used, write a testcase for it!"
                fi
            fi
        done
    fi
done

# vi:set shiftwidth=4 expandtab: