Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WoosterInitiative committed Dec 4, 2023
1 parent 30df900 commit eb28480
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
hooks:
- id: prettier
args: ['--tab-width', '2', '--single-quote']
exclude: '{{cookiecutter.project_slug}}/templates/'
exclude: 'wooster_django/templates/'

- repo: https://github.com/adamchainz/django-upgrade
rev: '1.15.0'
Expand All @@ -42,7 +42,7 @@ repos:
args: [--py311-plus]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
rev: v0.1.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
9 changes: 8 additions & 1 deletion config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@

# STATIC
# ------------------------
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
}
# MEDIA
# ------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
# MEDIA
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
MEDIA_URL = 'http://media.testserver'
MEDIA_URL = "http://media.testserver"
# Your stuff...
# ------------------------------------------------------------------------------
30 changes: 12 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--ds=config.settings.test --reuse-db"
python_files = [
"tests.py",
"test_*.py",
]
python_files = ["tests.py", "test_*.py"]

# ==== Coverage ====
[tool.coverage.run]
include = ["wooster_django/**"]
omit = ["*/migrations/*", "*/tests/*"]
plugins = ["django_coverage_plugin"]

# ==== Ruff ====
[tool.ruff]
line-length = 119
select = ["E", "F", "B"]
unfixable = ["B"]
target-version = "py311"


# ==== black ====
[tool.black]
Expand All @@ -24,10 +28,7 @@ target-version = ['py311']
[tool.isort]
profile = "black"
line_length = 119
known_first_party = [
"wooster_django",
"config",
]
known_first_party = ["wooster_django", "config"]
skip = ["venv/"]
skip_glob = ["**/migrations/*.py"]

Expand All @@ -40,9 +41,7 @@ ignore_missing_imports = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
plugins = [
"mypy_django_plugin.main",
]
plugins = ["mypy_django_plugin.main"]

[[tool.mypy.overrides]]
# Django migrations should not produce any errors:
Expand All @@ -55,19 +54,14 @@ django_settings_module = "config.settings.test"

# ==== PyLint ====
[tool.pylint.MASTER]
load-plugins = [
"pylint_django",
]
load-plugins = ["pylint_django"]
django-settings-module = "config.settings.local"

[tool.pylint.FORMAT]
max-line-length = 119

[tool.pylint."MESSAGES CONTROL"]
disable = [
"missing-docstring",
"invalid-name",
]
disable = ["missing-docstring", "invalid-name"]

[tool.pylint.DESIGN]
max-parents = 13
Expand Down
1 change: 1 addition & 0 deletions wooster_django/users/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

if typing.TYPE_CHECKING:
from allauth.socialaccount.models import SocialLogin

from wooster_django.users.models import User


Expand Down
2 changes: 1 addition & 1 deletion wooster_django/users/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django.contrib.auth import get_user_model, decorators
from django.contrib.auth import decorators, get_user_model
from django.utils.translation import gettext_lazy as _

from wooster_django.users.forms import UserAdminChangeForm, UserAdminCreationForm
Expand Down
6 changes: 1 addition & 5 deletions wooster_django/users/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
from wooster_django.users.forms import UserAdminChangeForm
from wooster_django.users.models import User
from wooster_django.users.tests.factories import UserFactory
from wooster_django.users.views import (
UserRedirectView,
UserUpdateView,
user_detail_view,
)
from wooster_django.users.views import UserRedirectView, UserUpdateView, user_detail_view

pytestmark = pytest.mark.django_db

Expand Down
6 changes: 1 addition & 5 deletions wooster_django/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from django.urls import path

from wooster_django.users.views import (
user_detail_view,
user_redirect_view,
user_update_view,
)
from wooster_django.users.views import user_detail_view, user_redirect_view, user_update_view

app_name = "users"
urlpatterns = [
Expand Down

0 comments on commit eb28480

Please sign in to comment.