Skip to content

Commit

Permalink
Switch linting to Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmior committed Apr 20, 2023
1 parent 37f20cf commit eff86cd
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 65 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ jobs:
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- run: pipenv install --dev
- run: pipenv run isort --check pylinks
- run: pipenv run black --check pylinks
- run: pipenv run ruff check pylinks
- run: pipenv run python manage.py collectstatic --noinput
- run: psql -c 'CREATE DATABASE ci_test;' -h 127.0.0.1 -U postgres
- run: pipenv run python manage.py test
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select = ["E", "F", "I"]
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ sqlparse = "*"
whoosh = "*"

[dev-packages]
isort = {extras = ["pipfile_deprecated_finder"], version = "5.12.0"}
black = "*"
ruff = "*"

[requires]
python_version = "3.8"
110 changes: 61 additions & 49 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pylinks/links/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class Migration(migrations.Migration):
upload_to=b"uploads/",
max_length=500,
blank=True,
help_text=b"A file to be uploaded and linked to instead of the URL.",
help_text=b"A file to be uploaded and " \
b"linked to instead of the URL.",
null=True,
),
),
Expand Down
2 changes: 1 addition & 1 deletion pylinks/links/migrations/0002_auto_20170703_1843.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from django.db import migrations, models
from django.db import migrations

if not os.environ.get("UPLOADCARE_DISABLED", False):
from pylinks.links.utils import LinkFileField
Expand Down
2 changes: 2 additions & 0 deletions pylinks/main/templatetags/analytics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: E501

from django import template
from django.conf import settings
from django.utils.html import escape, mark_safe
Expand Down
2 changes: 0 additions & 2 deletions pylinks/search/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import haystack
from django.core.management import call_command
from django.test import TestCase
from django.urls import reverse

from pylinks.links import search_indexes
from pylinks.links.models import Link


Expand Down
3 changes: 2 additions & 1 deletion pylinks/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def build_page(self):
or self.request.GET.get("page")
or 1
)

paginator = Paginator(self.results, self.results_per_page)
try:
page_number = int(page)
except ValueError:
Expand All @@ -31,7 +33,6 @@ def build_page(self):
_("Page is not 'last', nor can it be converted to an int.")
)

paginator = Paginator(self.results, self.results_per_page)
try:
page = paginator.page(page_number)
except InvalidPage:
Expand Down
3 changes: 2 additions & 1 deletion pylinks/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
"NAME": "django.contrib.auth.password_validation." \
"UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
Expand Down
5 changes: 0 additions & 5 deletions pylinks/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from django.contrib import admin
from django.contrib.auth.models import Group, User
from django.contrib.sites.models import Site
from django.urls import include, re_path

admin.autodiscover()
# admin.site.unregister(User)
# admin.site.unregister(Group)
# admin.site.unregister(Site)

urlpatterns = (
re_path(r"^feed/", include("pylinks.feeds.urls")),
Expand Down
4 changes: 2 additions & 2 deletions pylinks/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"""
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pylinks.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

# Apply WSGI middleware here.
Expand Down

0 comments on commit eff86cd

Please sign in to comment.