| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # ensure consistent behaviour |
| 4 | src_dir="$(dirnamescip-shell system . . dirname. "$(realpathscip-shell system . . 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 | echoscip-shell system . . echo. -e "${yellow}Checking Python imports using Ruff...${reset}" |
| 15 | ruff check --select I $dirs |
| 16 | check_rv $? |
| 17 | echoscip-shell system . . echo. |
| 18 | |
| 19 | # check format |
| 20 | echoscip-shell system . . echo. -e "${yellow}Checking code format using Ruff formatter...${reset}" |
| 21 | ruff format --diff $dirs |
| 22 | check_rv $? |
| 23 | echoscip-shell system . . echo. |
| 24 | |
| 25 | # run static code analysis |
| 26 | echoscip-shell system . . echo. -e "${yellow}Running static code analysis using Ruff linter...${reset}" |
| 27 | ruff check python/knot_resolver/ tests/pytests |
| 28 | check_rv $? |
| 29 | echoscip-shell system . . echo. |
| 30 | |
| 31 | # check typings |
| 32 | echoscip-shell system . . echo. -e "${yellow}Checking typings using Mypy...${reset}" |
| 33 | mypy python/knot_resolver/ |
| 34 | check_rv $? |
| 35 | echoscip-shell system . . echo. |
| 36 | |
| 37 | # fancy messages at the end :) |
| 38 | fancy_message |
| 39 | |
| 40 | # exit with the aggregate return value |
| 41 | exit $aggregated_rv |