Debian Codegraph @

scripts/poe-tasks/check-code

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 # ensure consistent behaviour
4 src_dir="$(dirname "$(realpath "$0")")"
5 source $src_dir/utils/_env.sh
6
7 # stop failing early, because we wouldn't do anything else than fail
8 set +e
9
10 # dirs to check
11 dirs="python/knot_resolver/ tests/manager scripts/poe-tasks/utils/create_setup.py"
12
13 # check imports
14 echo -e "${yellow}Checking Python imports using Ruff...${reset}"
15 ruff check --select I $dirs
16 check_rv $?
17 echo
18
19 # check format
20 echo -e "${yellow}Checking code format using Ruff formatter...${reset}"
21 ruff format --diff $dirs
22 check_rv $?
23 echo
24
25 # run static code analysis
26 echo -e "${yellow}Running static code analysis using Ruff linter...${reset}"
27 ruff check python/knot_resolver/ tests/pytests
28 check_rv $?
29 echo
30
31 # check typings
32 echo -e "${yellow}Checking typings using Mypy...${reset}"
33 mypy python/knot_resolver/
34 check_rv $?
35 echo
36
37 # fancy messages at the end :)
38 fancy_message
39
40 # exit with the aggregate return value
41 exit $aggregated_rv