-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (79 loc) · 2.5 KB
/
Copy pathMakefile
File metadata and controls
107 lines (79 loc) · 2.5 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
.DEFAULT_GOAL := help
# The spacing and comments in this Makefile are intentionally formatted to
# allow the `make` command to display a nicely formatted list of available
# targets and their descriptions.
# Single hash symbols (#) are used for comments that are not displayed in
# the `make` output, while double hash symbols (##) are used for comments
# that are displayed when running `make` without any arguments or with the
# `make help` command.
# To add breaks between sections in the `make` output, simply add a comment line with
# double hash symbols and some spacing, as shown below.
##
## -----------------------------------------------
## Makefile for GitHub Policy Audit.
## -----------------------------------------------
##
.PHONY: help
help: ## This help message.
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST)
##
.PHONY: clean
clean: ## Clean the temporary files.
rm -rf megalinter-reports
rm -rf site
rm -rf dist
rm -rf build
rm -rf .ruff_cache
rm -rf .mypy_cache
rm -rf .pytest_cache
rm -rf .coverage
find . -type d -name '__pycache__' -exec rm -rf {} +
##
.PHONY: install-dev
install-dev: ## Install the development dependencies.
poetry install --with dev
##
# MkDocs
.PHONY: docs-install
docs-install: ## Install the dependencies for MkDocs.
poetry install --only docs
.PHONY: docs-serve
docs-serve: docs-install ## Serve the documentation locally.
poetry run mkdocs serve
.PHONY: docs-build
docs-build: docs-install ## Build the documentation.
poetry run mkdocs build --site-dir site
.PHONY: docs-lint
docs-lint: ## Install and run the documentation linter (Markdownlint).
npm install -g markdownlint-cli
markdownlint .
.PHONY: docs-fix
docs-fix: ## Install and run the documentation linter with auto-fix (Markdownlint).
npm install -g markdownlint-cli
markdownlint . --fix
##
# Linting
# Primary Linting
.PHONY: lint
lint: ## Run all linters.
poetry run ruff check src tests
poetry run ruff format src tests --check
poetry run mypy src tests
.PHONY: fmt
fmt: ## Run all formatters.
poetry run ruff check src tests --fix
poetry run ruff format src tests
##
# Tests
.PHONY: test
test: ## Run all tests and check coverage.
poetry run pytest -n auto --cov=src --cov-report term-missing --cov-fail-under=80
##
# Megalinter
.PHONY: megalinter
megalinter: ## Run the Megalinter.
docker run --platform linux/amd64 --rm \
-v /var/run/docker.sock:/var/run/docker.sock:rw \
-v $(shell pwd):/tmp/lint:rw \
ghcr.io/oxsecurity/megalinter:v9
##