-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (36 loc) · 1.21 KB
/
Copy pathMakefile
File metadata and controls
53 lines (36 loc) · 1.21 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
CODE = src
REQUIREMENTS = requirements.txt
SECRETS_BASELINE = .secrets.baseline
# Format code with Black.
format:
@poetry run black $(CODE)
# Export the requirements with no environment markers.
$(REQUIREMENTS):
@poetry export --without-hashes -f $(REQUIREMENTS) --output $(REQUIREMENTS)
@sed -i '' 's/;.*//' $(REQUIREMENTS)
# Run pre-commit hooks.
pre-commit:
@poetry run pre-commit run --all-files
## Secrets
# Create a baseline of secrets for the project.
$(SECRETS_BASELINE):
@poetry run detect-secrets scan > $(SECRETS_BASELINE)
# Check for secrets against the baseline.
secrets:
@poetry run detect-secrets scan --baseline $(SECRETS_BASELINE)
## Lint
# Scan code for security issues, ignoring virtual environments.
bandit:
@poetry run bandit -r $(CODE) -x "**/.venv/**,**/.venv.bak/**"
# Check code for formatting issues.
black:
@poetry run black $(CODE) --check
# Lint code with pylint and perflint, for performance.
pylint:
@poetry run pylint $(CODE) --load-plugins perflint
# Lint code with ruff to check for unused imports, etc.
ruff:
@poetry run ruff check $(CODE)
# Lint code with all linters.
lint: black pylint ruff bandit secrets
.PHONY: format pylint lint ruff black bandit secrets pre-commit