forked from jsbattig/code-indexer
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlint-strict.sh
More file actions
executable file
·78 lines (63 loc) · 2.11 KB
/
lint-strict.sh
File metadata and controls
executable file
·78 lines (63 loc) · 2.11 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# STRICT linting script with aggressive type checking that runs ruff, black, and mypy on all code including tests.
# Use this when you want zero tolerance for type annotation issues.
#
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to run a command and report results
run_command() {
local cmd="$1"
local description="$2"
echo -e "${BLUE}Running ${description}...${NC}"
if $cmd; then
echo -e "${GREEN}✅ ${description} passed${NC}"
return 0
else
echo -e "${RED}❌ ${description} failed${NC}"
return 1
fi
}
# Main function
main() {
echo -e "${BLUE}🔍 Running STRICT linting with aggressive type checking...${NC}"
# Define paths to lint
local src_path="src"
local tests_path="tests"
# Check if paths exist
if [[ ! -d "$src_path" ]]; then
echo -e "${RED}❌ Source path $src_path not found${NC}"
exit 1
fi
if [[ ! -d "$tests_path" ]]; then
echo -e "${RED}❌ Tests path $tests_path not found${NC}"
exit 1
fi
local all_passed=true
# Run ruff check
if ! run_command "ruff check $src_path $tests_path" "ruff check"; then
all_passed=false
fi
# Run black check
if ! run_command "black --check $src_path $tests_path" "black check"; then
all_passed=false
fi
# Run mypy with maximum strictness - zero tolerance for type issues
if ! run_command "mypy --explicit-package-bases --strict --check-untyped-defs --disallow-untyped-defs --disallow-incomplete-defs --disallow-untyped-decorators --warn-unused-ignores --warn-redundant-casts --warn-unreachable --warn-unused-configs --disallow-any-generics $src_path $tests_path" "mypy STRICT type check"; then
all_passed=false
fi
if $all_passed; then
echo -e "${GREEN}🎉 All linting checks passed!${NC}"
exit 0
else
echo -e "${RED}💥 Some linting checks failed${NC}"
exit 1
fi
}
# Run main function
main "$@"