Skip to content

Commit

Permalink
Lint our GitHub Actions workflows with zizmor
Browse files Browse the repository at this point in the history
We just need to set persist-credentials: false in all of our workflows.

Introduce the standard `make lint` target that runs all of our linters.

Refs <freedomofpress/securedrop-tooling#18>.
  • Loading branch information
legoktm committed Jan 3, 2025
1 parent ccd75d7 commit 9355994
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
container: debian:bookworm
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies
run: |
apt-get update && apt-get install --yes --no-install-recommends make openssl python3 python3-poetry
Expand All @@ -21,10 +23,12 @@ jobs:
container: debian:bookworm
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies
run: |
apt-get update && apt-get install --yes --no-install-recommends make python3 python3-poetry
poetry install --no-ansi
- name: Check code formatting via black
- name: Run all linters
run: |
make check-black
make lint
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ image := fpf.local/securedrop-https-everywhere-ruleset:$(shell cat latest-rulese

DEFAULT_GOAL: help

.PHONY: lint
lint: check-black zizmor ## Run all linters

.PHONY: check-black
check-black: ## Check Python source code formatting with black
@poetry run black --check --diff ./
Expand All @@ -10,6 +13,10 @@ check-black: ## Check Python source code formatting with black
black: ## Format Python source code with black
@poetry run black ./

.PHONY: zizmor
zizmor: ## Lint GitHub Actions workflows
@poetry run zizmor .

.PHONY: test-key
test-key: ## Generates a test key for development/testing purposes locally.
openssl genrsa -out key.pem 4096
Expand Down
27 changes: 25 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pgpy = ">=0.6.0"
[tool.poetry.group.dev.dependencies]
black = "*"
pytest = "^8.3.4"
zizmor = "^1.0.0"

[tool.black]
line-length = 100

0 comments on commit 9355994

Please sign in to comment.