Skip to content

Commit

Permalink
Merge pull request #517 from NitorCreations/ruff
Browse files Browse the repository at this point in the history
remove black and isort, use ruff only
  • Loading branch information
Esgrove authored Sep 24, 2024
2 parents 503e22c + 35776e8 commit 092cd9c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 477 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/black.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- master
- main
paths:
- "**.go"
- "go/go.mod"
Expand All @@ -13,7 +12,11 @@ on:
pull_request:
branches:
- master
- main
paths:
- "**.go"
- "go/go.mod"
- "go/go.sum"
- ".github/workflows/go.yml"

# Cancel previous runs for PRs but not pushes to main
concurrency:
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/isort.yml

This file was deleted.

19 changes: 12 additions & 7 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Python ruff
name: Python

# Run either when pushing directly to main/master or in a PR targeting main/master
on:
push:
branches:
- master
- main
paths:
- ".github/workflows/ruff.yml"
- "**.py"
Expand All @@ -30,9 +29,15 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: ruff
uses: chartboost/ruff-action@v1
with:
src: "./python"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Ruff lint
run: ruff check --output-format=github ./python

- name: Ruff format
run: ruff format --check --verbose ./python
17 changes: 4 additions & 13 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,20 @@ pip-compile setup.py

## Code formatting and linting

Code formatting with [Black](https://github.com/psf/black).
Import sorting with [isort](https://github.com/PyCQA/isort).
Linting with [ruff](https://github.com/charliermarsh/ruff).
Code formatting and linting with [ruff](https://github.com/charliermarsh/ruff).

These are configured with a custom line length limit of 120.
The configs can be found in [pyproject.toml](./pyproject.toml).

Usage:

```shell
black .
isort .
ruff --fix .
ruff format
ruff check --fix
```

These can also be integrated to IDEs / editors or run as a pre-commit hook.
See the documentation for Black [here](https://black.readthedocs.io/en/stable/integrations/editors.html).
Visual Studio Code has built-in support for
[Black](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter)
and
[isort](https://marketplace.visualstudio.com/items?itemName=ms-python.isort)
through official plugins.
There is also a [Ruff extension](https://github.com/charliermarsh/ruff-vscode) for VS Code.
See the documentation for the [Ruff extension](https://github.com/astral-sh/ruff-vscode) for VS Code.

Using with [pre-commit](https://pre-commit.com/) (run from repo root):

Expand Down
1 change: 1 addition & 0 deletions python/n_vault/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Vault module for securely storing secrets in s3 with local encryption with data keys from AWS KMS
"""

import sys
from os import environ

Expand Down
Loading

0 comments on commit 092cd9c

Please sign in to comment.