Skip to content

Commit

Permalink
build: use ruff for linting
Browse files Browse the repository at this point in the history
Use [Ruff][1] for linting. This replaces both isort and flake8.

[1]: https://beta.ruff.rs/docs/
  • Loading branch information
jpvanhal committed Aug 7, 2023
1 parent b89bb4e commit c59dfb3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
15 changes: 12 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os
import os
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
from sqlalchemy_searchable import __version__
from sqlalchemy_searchable import __version__ # noqa: E402

# -- General configuration -----------------------------------------------------

Expand All @@ -26,7 +27,15 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ exclude = [
"/docs/_build",
]

[tool.isort]
known_first_party = ["sqlalchemy_searchable", "tests"]
line_length = 79
multi_line_output = 3
order_by_type = false
[tool.ruff]
select = ["E", "F", "I"]

[tool.ruff.isort]
known-first-party = ["sqlalchemy_searchable", "tests"]
order-by-type = false
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
remove_listeners,
search_manager,
SearchQueryMixin,
vectorizer
vectorizer,
)

DB_USER = os.environ.get('SQLALCHEMY_SEARCHABLE_TEST_USER', 'postgres')
Expand Down
7 changes: 2 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ deps=
psycopg2cffi>=2.6.1; platform_python_implementation == 'PyPy'
psycopg2>=2.4.6; platform_python_implementation == 'CPython'
sqla1.4: SQLAlchemy>=1.4,<1.5
lint: flake8
lint: isort>=5.0,<6.0
passenv =
SQLALCHEMY_SEARCHABLE_TEST_USER
SQLALCHEMY_SEARCHABLE_TEST_PASSWORD
SQLALCHEMY_SEARCHABLE_TEST_DB
commands=py.test {posargs}

[testenv:lint]
commands =
isort --check-only --diff sqlalchemy_searchable tests
flake8 sqlalchemy_searchable tests
deps = ruff
commands = ruff check .

0 comments on commit c59dfb3

Please sign in to comment.