Skip to content

Commit

Permalink
Toughen rough linting (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Feb 8, 2024
2 parents d525c19 + 8c6ea2f commit d45e76c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
19 changes: 19 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@

- _Add your latest changes from PRs here_

### Development

- Strengthen linting (#385)

- Add flake8-commas (COM)

- https://docs.astral.sh/ruff/rules/#flake8-commas-com
- https://pypi.org/project/flake8-commas/

- Add flake8-builtins (A)

- https://docs.astral.sh/ruff/rules/#flake8-builtins-a
- https://pypi.org/project/flake8-builtins/

- Add flake8-errmsg (EM)

- https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
- https://pypi.org/project/flake8-errmsg/

## django-slugify-processor 1.6.0 (2023-12-09)

_Maintenance only, no bug fixes or features_
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
master_doc = "index"

project = about["__title__"]
copyright = about["__copyright__"]
project_copyright = about["__copyright__"]

version = "%s" % (".".join(about["__version__"].split("."))[:2])
release = "%s" % (about["__version__"])
Expand Down Expand Up @@ -94,7 +94,7 @@
"sidebar/navigation.html",
"sidebar/projects.html",
"sidebar/scroll-end.html",
]
],
}

# linkify_issues
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ select = [
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"COM", # flake8-commas
"EM", # flake8-errmsg
"Q", # flake8-quotes
"PTH", # flake8-use-pathlib
"SIM", # flake8-simplify
Expand All @@ -146,6 +149,9 @@ select = [
"RUF", # Ruff-specific rules
"D", # pydocstyle
]
ignore = [
"COM812", # missing trailing comma, ruff format conflict
]

[tool.ruff.lint.isort]
known-first-party = [
Expand Down
3 changes: 2 additions & 1 deletion test_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ class MyModel(models.Model):

title = models.CharField(max_length=255)
django_extensions_slug = django_extensions.db.fields.AutoSlugField(
populate_from="title", slugify_function=slugify
populate_from="title",
slugify_function=slugify,
)
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SECRET_KEY: str = os.getenv("SECRET_KEY", "dummy")

DATABASES: t.Dict[str, t.Any] = {
"default": {"NAME": ":memory:", "ENGINE": "django.db.backends.sqlite3"}
"default": {"NAME": ":memory:", "ENGINE": "django.db.backends.sqlite3"},
}

INSTALLED_APPS: t.List[str] = ["test_app"]
Expand Down
9 changes: 6 additions & 3 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def test_slugify_via_builtin_override(settings: t.Any) -> None:
"BACKEND": "django.template.backends.django.DjangoTemplates",
"APP_DIRS": True,
"OPTIONS": {
"builtins": ["django_slugify_processor.templatetags.slugify_processor"]
"builtins": ["django_slugify_processor.templatetags.slugify_processor"],
},
}
},
]

template = Template("{{'c++'|slugify}}")
Expand All @@ -26,7 +26,10 @@ def test_slugify_via_load_templatetags(settings: t.Any) -> None:
settings.SLUGIFY_PROCESSORS = ["test_app.coding.slugify_programming"]
settings.INSTALLED_APPS = ["django_slugify_processor"]
settings.TEMPLATES = [
{"BACKEND": "django.template.backends.django.DjangoTemplates", "APP_DIRS": True}
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"APP_DIRS": True,
},
]

template = Template('{% load slugify_processor %}{{"c++"|slugify}}')
Expand Down

0 comments on commit d45e76c

Please sign in to comment.