Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: ruff

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: read

jobs:
ruff:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v5
with:
sparse-checkout: |
pytm
pyproject.toml
.github/workflows/ruff.yml
# https://github.com/astral-sh/ruff-action
# https://docs.astral.sh/ruff/formatter/
- name: Check production code format
uses: astral-sh/ruff-action@v3
with:
src: pytm
version: "latest"
args: "format --check"
- name: Check production code
uses: astral-sh/ruff-action@v3
with:
src: pytm
version: "latest"
args: "check --output-format=github"
# https://docs.astral.sh/ruff/linter/
- name: Show helpful safe production code fixes
uses: astral-sh/ruff-action@v3
with:
src: pytm
version: "latest"
args: "check --fix --diff --output-format=github"
continue-on-error: true
- name: Show potentially helpful unsafe production code fixes
uses: astral-sh/ruff-action@v3
with:
src: pytm
version: "latest"
args: "check --fix --diff --unsafe-fixes --output-format=github"
continue-on-error: true
48 changes: 48 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,51 @@ pdoc3 = "^0.11.6"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

[tool.ruff]
target-version = "py310"

# https://docs.astral.sh/ruff/settings/#analyze
[tool.ruff.analyze]
detect-string-imports = false
direction = "dependencies"
exclude = []
include-dependencies = {}
preview = false
string-imports-min-dots = 2

# https://docs.astral.sh/ruff/settings/#format
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
exclude = []
indent-style = "space"
line-ending = "lf"
preview = false
quote-style = "double"
skip-magic-trailing-comma = false

# https://docs.astral.sh/ruff/settings/#lint
[tool.ruff.lint]
allowed-confusables = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
exclude = []
explicit-preview-rules = false
extend-fixable = []
extend-ignore = []
extend-per-file-ignores = {}
extend-safe-fixes = []
extend-select = []
extend-unsafe-fixes = []
external = []
fixable = ["ALL"]
future-annotations = false
ignore = []
logger-objects = []
per-file-ignores = {}
preview = false
select = ["E4", "E7", "E9", "F"]
task-tags = ["TODO", "FIXME", "XXX"]
typing-extensions = true
typing-modules = []
unfixable = []
Loading