Skip to content

Commit

Permalink
Apply Ruff formatting and linting and add pre-commit (#161)
Browse files Browse the repository at this point in the history
* config: Add Ruff configuration

(cherry picked from commit 3d165e3)

* chore: Apply formatting and linting fixes

(cherry picked from commit 26d5278)

* fix: Apply linting fixes and add pre-commit config

(cherry picked from commit 0af702a)
  • Loading branch information
blarghmatey authored Jul 30, 2024
1 parent a37319e commit 82aa382
Show file tree
Hide file tree
Showing 250 changed files with 1,872 additions and 1,365 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.lockfile binary
*.lockfile binary
3 changes: 2 additions & 1 deletion .gitguardian.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
matches-ignore:
- TESTAPP_SECRET
- TESTAPP_SECRET
46 changes: 20 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: CI
on: [push]

Expand All @@ -6,7 +7,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
python-version:
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -27,39 +28,39 @@ jobs:
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
- 5432:5432

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history

- name: Apt update
run: sudo apt-get update
- name: Apt update
run: sudo apt-get update

- name: Apt install
run: sudo apt-get install -y libxmlsec1-dev
- name: Apt install
run: sudo apt-get install -y libxmlsec1-dev

- uses: eifinger/setup-rye@v4
id: setup-rye
- uses: eifinger/setup-rye@v4
id: setup-rye

- name: Pin python-version ${{ matrix.python-version }}
run: rye pin ${{ matrix.python-version }}
- name: Pin python-version ${{ matrix.python-version }}
run: rye pin ${{ matrix.python-version }}

- name: Install dependencies
run: rye sync
- name: Install dependencies
run: rye sync

# - name: Lints
# run: 'pants lint ::'

# - name: Typecheck
# run: 'pants typecheck ::'

- name: Tests
run: rye test
- name: Tests
run: rye test

- name: Changelog
run: rye run build changelog check
- name: Changelog
run: rye run build changelog check

# - name: Upload coverage to CodeCov
# uses: codecov/codecov-action@v1
Expand All @@ -76,13 +77,6 @@ jobs:

- uses: eifinger/setup-rye@v4
id: setup-rye
with:
enable-cache: true
cache-prefix: ${{ matrix.python-version }}

- name: Pin python-version ${{ matrix.python-version }}
if: steps.setup-rye.outputs.cache-hit != 'true'
run: rye pin ${{ matrix.python-version }}

# extract the app name out of the tag's ref value
- id: get-app-name
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/scripts/prune_pants_cache.sh

This file was deleted.

71 changes: 71 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args:
- --mapping
- '2'
- --sequence
- '2'
- --offset
- '0'
- --width
- '80'
- --preserve-quotes
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [--format, parsable, -d, relaxed]
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args:
- --baseline
- .secrets.baseline
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.5.3'
hooks:
- id: ruff-format
- id: ruff
args: [--extend-ignore=D1, --fix]
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.10.1
# hooks:
# - id: mypy
# args:
# - --explicit-package-bases
# - --namespace-packages
# - --config-file=pyproject.toml
# - --warn-unused-configs
# additional_dependencies:
# - mypy-extensions
# - django-stubs[compatible-mypy]
# - types-PyYAML
# - types-requests
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint
name: actionlint
description: Runs actionlint to lint GitHub Actions workflow files
Loading

0 comments on commit 82aa382

Please sign in to comment.