Skip to content

Commit

Permalink
🔧 Setup ruff format (initially excluding all files) (#12136)
Browse files Browse the repository at this point in the history
Co-authored-by: danieleades <33452915+danieleades@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 19, 2024
1 parent b0f096f commit d8cf71c
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Lint with Ruff
run: ruff check . --output-format github

- name: Format with Ruff
run: ruff format . --diff

flake8:
runs-on: ubuntu-latest

Expand Down
68 changes: 67 additions & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ select = [
# mccabe ('C90')
# "C901", # `{name}` is too complex ({complexity} > {max_complexity})
# flake8-commas ('COM')
"COM812", # Trailing comma missing
"COM818", # Trailing comma on bare tuple prohibited
"COM819", # Trailing comma prohibited
# flake8-copyright ('CPY')
Expand Down Expand Up @@ -422,3 +421,70 @@ inline-quotes = "single"
forced-separate = [
"tests",
]

[format]
quote-style = "single"
exclude = [
"doc/**/*",
"sphinx/__init__.py",
"sphinx/addnodes.py",
"sphinx/application.py",
"sphinx/builders/**/*",
"sphinx/cmd/**/*",
"sphinx/config.py",
"sphinx/deprecation.py",
"sphinx/directives/**/*",
"sphinx/domains/**/*",
"sphinx/environment/**/*",
"sphinx/errors.py",
"sphinx/events.py",
"sphinx/ext/**/*",
"sphinx/extension.py",
"sphinx/highlighting.py",
"sphinx/io.py",
"sphinx/jinja2glue.py",
"sphinx/locale/__init__.py",
"sphinx/parsers.py",
"sphinx/project.py",
"sphinx/pycode/**/*",
"sphinx/pygments_styles.py",
"sphinx/registry.py",
"sphinx/roles.py",
"sphinx/search/**/*",
"sphinx/templates/**/*",
"sphinx/testing/**/*",
"sphinx/theming.py",
"sphinx/transforms/**/*",
"sphinx/util/**/*",
"sphinx/versioning.py",
"sphinx/writers/**/*",
"tests/certs/**/*",
"tests/conftest.py",
"tests/roots/**/*",
"tests/test_addnodes.py",
"tests/test_application.py",
"tests/test_builders/**/*",
"tests/test_config/**/*",
"tests/test_directives/**/*",
"tests/test_domains/**/*",
"tests/test_environment/**/*",
"tests/test_errors.py",
"tests/test_events.py",
"tests/test_extensions/**/*",
"tests/test_highlighting.py",
"tests/test_intl/**/*",
"tests/test_markup/**/*",
"tests/test_project.py",
"tests/test_pycode/**/*",
"tests/test_quickstart.py",
"tests/test_roles.py",
"tests/test_search.py",
"tests/test_theming/**/*",
"tests/test_toctree.py",
"tests/test_transforms/**/*",
"tests/test_util/**/*",
"tests/test_versioning.py",
"tests/test_writers/**/*",
"tests/utils.py",
"utils/**/*",
]
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PYTHON ?= python3

.PHONY: all
all: style-check type-check test
all: format style-check type-check doclinter test

.PHONY: check
check: style-check type-check doclinter
Expand Down Expand Up @@ -48,6 +48,10 @@ style-check:
@flake8 .
@ruff check .

.PHONY: format
format:
@ruff format .

.PHONY: type-check
type-check:
@mypy
Expand Down

0 comments on commit d8cf71c

Please sign in to comment.