Skip to content

Commit

Permalink
Adopt Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 8, 2024
1 parent e2d4057 commit 285cfcc
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint source code

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
ruff:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "ruff==0.1.11"
- name: Lint with Ruff
run: |
ruff check . --output-format github
ruff format . --check
21 changes: 21 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
target-version = "py39" # Pin Ruff to Python 3.9
show-source = true

[lint]
preview = true
select = [
"B", # flake8-bugbear
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"W", # pycodestyle
]
ignore = [
# "E124",
# "E125",
# "E128",
"E261",
# "E301",
# "E302",
# "E303",
]
16 changes: 7 additions & 9 deletions alabaster/support.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# flake8: noqa

from pygments.style import Style
from pygments.token import (
Keyword,
Name,
Comment,
String,
Error,
Generic,
Keyword,
Literal,
Name,
Number,
Operator,
Generic,
Whitespace,
Punctuation,
Other,
Literal,
Punctuation,
String,
Whitespace,
)


Expand Down
3 changes: 1 addition & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
flake8==3.6.0
black==19.10b0
ruff==0.1.11

# Install ourselves direct, even when being used on eg RTD. Otherwise we can't
# dogfood our own changes until release to PyPI.
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import datetime


extensions = []
templates_path = ["_templates"]
source_suffix = ".rst"
Expand Down

0 comments on commit 285cfcc

Please sign in to comment.