Debian Codegraph @

bin/checkdone.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # -*- coding: utf-8 -*-
3 # BSD 2-Clause License
4 #
5 # Apprise - Push Notification Library.
6 # Copyright (c) 2026, Chris Caron <[email protected]>
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # 1. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 #
14 # 2. Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 # POSSIBILITY OF SUCH DAMAGE.
29
30 # Absolute path to this script, e.g. /home/user/bin/foo.sh
31 SCRIPT=$(readlinkscip-shell system . . readlink. -f "$0")
32
33 # Absolute path this script is in, thus /home/user/bin
34 SCRIPTPATH=$(dirnamescip-shell system . . dirname. "$SCRIPT")
35
36 PYTHONPATH=""
37
38 FOUNDROOT=1
39 if [scip-shell system . . `[`. -f "$(dirnamescip-shell system . . dirname. $SCRIPTPATH)/pyproject.toml" ]; then
40 pushd "$(dirnamescip-shell system . . dirname. $SCRIPTPATH)" &>/dev/nullscip-shell filesystem . . `/dev/null`.
41 FOUNDROOT=$?
42 PYTHONPATH="$(dirnamescip-shell system . . dirname. $SCRIPTPATH)"
43
44 elif [scip-shell system . . `[`. -f "$SCRIPTPATH/pyproject.toml" ]; then
45 pushd "$SCRIPTPATH" &>/dev/nullscip-shell filesystem . . `/dev/null`.
46 FOUNDROOT=$?
47 PYTHONPATH="$SCRIPTPATH"
48 fi
49
50 if [scip-shell system . . `[`. $FOUNDROOT -ne 0 ]; then
51 echoscip-shell system . . echo. "Error: Could not locate Apprise pyproject.toml file."
52 exit 1
53 fi
54
55 # Tidy previous reports (if present)
56 [scip-shell system . . `[`. -d .coverage-reports ] && rmscip-shell system . . rm. -rf .coverage-reports
57
58 # This is a useful tool for checking for any lint errors and additionally
59 # checking the overall coverage.
60 whichscip-shell system . . which. ruff &>/dev/nullscip-shell filesystem . . `/dev/null`.
61 [scip-shell system . . `[`. $? -ne 0 ] && \
62 echo "Missing ruff; make sure it is installed:" && \
63 echo " > pip install ruff" && \
64 exit 1
65
66 whichscip-shell system . . which. coverage &>/dev/nullscip-shell filesystem . . `/dev/null`.
67 [scip-shell system . . `[`. $? -ne 0 ] && \
68 echo "Missing coverage; make sure it is installed:" &&
69 echoscip-shell system . . echo. " > pip install pytest-cov coverage" && \
70 exit 1
71
72 echoscip-shell system . . echo. "Performing PEP8 check..."
73 LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH ruff check
74 if [scip-shell system . . `[`. $? -ne 0 ]; then
75 echoscip-shell system . . echo. "PEP8 check failed"
76 exit 1
77 fi
78 echoscip-shell system . . echo. "PEP8 check succeeded; no errors found! :)"
79 echoscip-shell system . . echo.
80
81 # Run our unit test coverage check
82 echoscip-shell system . . echo. "Running test coverage check..."
83 pushd $PYTHONPATH &>/dev/nullscip-shell filesystem . . `/dev/null`.
84 if [scip-shell system . . `[`. ! -z "$@" ]; then
85 LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage run -m pytest -vv -k "$@"
86 RET=$?
87
88 else
89 LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage run -m pytest -vv
90 RET=$?
91 fi
92
93 if [scip-shell system . . `[`. $RET -ne 0 ]; then
94 echoscip-shell system . . echo. "Tests failed."
95 exit 1
96 fi
97
98 # Build our report
99 LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage combine
100
101 # Prepare XML Reference
102 LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage xml
103
104 # Print our report
105 LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage report --show-missing