-
Notifications
You must be signed in to change notification settings - Fork 421
/
lint.sh
executable file
·42 lines (35 loc) · 1 KB
/
lint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -e
set -x
set -o pipefail
# Default source directories
SRC=${1:-"src/zenml tests examples"}
SRC_NO_TESTS=${1:-"src/zenml tests/harness"}
TESTS_EXAMPLES=${1:-"tests examples"}
export ZENML_DEBUG=1
export ZENML_ANALYTICS_OPT_IN=false
ruff check $SRC_NO_TESTS
# TODO: Fix docstrings in tests and examples and remove the `--extend-ignore D` flag
ruff check $TESTS_EXAMPLES --extend-ignore D
# Flag check for skipping yamlfix
if [ "$OS" = "windows-latest" ]; then
SKIP_YAMLFIX=true
else
SKIP_YAMLFIX=false
for arg in "$@"
do
if [ "$arg" = "--no-yamlfix" ]; then
SKIP_YAMLFIX=true
break
fi
done
fi
# checks for yaml formatting errors
if [ "$SKIP_YAMLFIX" = false ]; then
yamlfix --check .github tests --exclude "dependabot.yml"
fi
# autoflake replacement: checks for unused imports and variables
ruff check $SRC --select F401,F841 --exclude "__init__.py" --isolated
ruff format $SRC --check
# check type annotations
mypy $SRC_NO_TESTS