Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use ruff for linting #119

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 .