-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
145 lines (124 loc) · 4.09 KB
/
Makefile
File metadata and controls
145 lines (124 loc) · 4.09 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Sentinel Security Header Analyzer - Development Makefile
# Because automation is the difference between tactical and tedious.
.PHONY: help install install-dev test test-verbose test-coverage lint format type-check clean run docs build all quality
# Default target - show available commands
help:
@echo "Sentinel Security Analyzer - Development Commands"
@echo ""
@echo "Setup:"
@echo " make install Install production dependencies"
@echo " make install-dev Install development dependencies"
@echo ""
@echo "Development:"
@echo " make run URL=<url> Run analyzer on specified URL"
@echo " make run-verbose Run with verbose output"
@echo ""
@echo "Testing:"
@echo " make test Run test suite"
@echo " make test-verbose Run tests with verbose output"
@echo " make test-coverage Run tests with coverage report"
@echo " make test-watch Run tests in watch mode"
@echo ""
@echo "Code Quality:"
@echo " make format Format code with black"
@echo " make lint Run ruff linter"
@echo " make type-check Run mypy type checker"
@echo " make quality Run all quality checks"
@echo " make all Format, lint, type-check, and test"
@echo ""
@echo "Utilities:"
@echo " make clean Remove generated files"
@echo " make docs Build documentation"
@echo " make build Build distribution packages"
@echo ""
# Installation targets
install:
pip install -e .
install-dev:
pip install -e ".[dev]"
# Development targets
run:
@if [ -z "$(URL)" ]; then \
echo "Error: URL not specified. Usage: make run URL=example.com"; \
exit 1; \
fi
python cli.py analyze $(URL)
run-verbose:
@if [ -z "$(URL)" ]; then \
echo "Error: URL not specified. Usage: make run-verbose URL=example.com"; \
exit 1; \
fi
python cli.py analyze $(URL) --verbose
# Testing targets
test:
pytest
test-verbose:
pytest -v
test-coverage:
pytest --cov --cov-report=term-missing --cov-report=html
test-watch:
pytest-watch
# Code quality targets
format:
@echo "Formatting code with black..."
black .
@echo "✓ Code formatted"
lint:
@echo "Running ruff linter..."
ruff check .
@echo "✓ Linting complete"
type-check:
@echo "Running mypy type checker..."
mypy .
@echo "✓ Type checking complete"
# Combined quality check
quality: format lint type-check
@echo ""
@echo "========================================="
@echo "All quality checks passed! ✓"
@echo "========================================="
# Run everything
all: quality test
@echo ""
@echo "========================================="
@echo "All checks passed! Ready for deployment."
@echo "========================================="
# Cleanup targets
clean:
@echo "Cleaning generated files..."
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.coverage" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "htmlcov" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "dist" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "build" -exec rm -rf {} + 2>/dev/null || true
@echo "✓ Cleanup complete"
# Documentation
docs:
@echo "Building documentation..."
mkdocs build
@echo "✓ Documentation built in site/"
# Build distribution
build: clean
@echo "Building distribution packages..."
python -m build
@echo "✓ Distribution packages created in dist/"
# Development workflow shortcuts
check: quality test
@echo "Pre-commit checks passed ✓"
# Quick security test on common sites
test-real:
@echo "Testing real sites (this takes ~30 seconds)..."
@python cli.py analyze github.com
@echo ""
@python cli.py analyze google.com
@echo ""
@python cli.py analyze cloudflare.com
# CI/CD helper
ci: install-dev quality test
@echo "CI checks complete ✓"