Skip to content

Commit c8562f0

Browse files
authored
port-feat: pre-commit config added from the v3 workstream (#117)
Changes partially taken from this change: a56091c Requires additional work when the django-cms 4.0 workstream is official, the version bump code has been ignored because it would generate official releases only: #116
1 parent 59c22af commit c8562f0

File tree

5 files changed

+42
-8
lines changed

5 files changed

+42
-8
lines changed

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
# Need to drop python 3.5 and 3.6 before we include python upgrade
3+
# - repo: https://github.com/asottile/pyupgrade
4+
# rev: v2.31.0
5+
# hooks:
6+
# - id: pyupgrade
7+
# args: ["--py37-plus"]
8+
#
9+
# FIXME: Should be enabled for codebases that are minimum django 2.2+
10+
# - repo: https://github.com/adamchainz/django-upgrade
11+
# rev: '1.4.0'
12+
# hooks:
13+
# - id: django-upgrade
14+
# args: [--target-version, "2.2"]
15+
16+
- repo: https://github.com/PyCQA/flake8
17+
rev: 4.0.1
18+
hooks:
19+
- id: flake8
20+
21+
- repo: https://github.com/asottile/yesqa
22+
rev: v1.3.0
23+
hooks:
24+
- id: yesqa
25+
26+
- repo: https://github.com/pre-commit/pre-commit-hooks
27+
rev: v4.1.0
28+
hooks:
29+
- id: check-merge-conflict
30+
- id: mixed-line-ending
31+
32+
- repo: https://github.com/pycqa/isort
33+
rev: 5.10.1
34+
hooks:
35+
- id: isort

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog
44

55
Unreleased
66
==========
7+
* port-feat: pre-commit config added from the v3 workstream
78
* fix: Added test coverage to admin preview view
89

910
4.0.0.dev4 (2022-02-03)

djangocms_snippet/admin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ def preview_view(self, request, snippet_id=None, form_url='', extra_context=None
142142
def get_urls(self):
143143
info = self.model._meta.app_label, self.model._meta.model_name
144144
return [
145-
url(
145+
url(
146146
r"^(?P<snippet_id>\d+)/preview/$",
147147
self.admin_site.admin_view(self.preview_view),
148148
name="{}_{}_preview".format(*info),
149-
),
150-
] + super().get_urls()
149+
),
150+
] + super().get_urls()
151151

152152
def has_delete_permission(self, request, obj=None):
153153
"""

tests/test_plugins.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from cms.test_utils.testcases import CMSTestCase
66
from cms.toolbar.utils import get_object_edit_url, get_object_structure_url
77

8-
from djangocms_snippet.models import Snippet, SnippetGrouper
98
from djangocms_versioning.models import Version
109

10+
from djangocms_snippet.models import Snippet, SnippetGrouper
11+
1112
from .utils.factories import SnippetWithVersionFactory
1213

1314

tests/utils/factories.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
from cms.models import Placeholder
77

88
import factory
9-
from factory.fuzzy import (
10-
FuzzyInteger,
11-
FuzzyText,
12-
)
139
from djangocms_versioning.models import Version
10+
from factory.fuzzy import FuzzyInteger, FuzzyText
1411

1512
from djangocms_snippet.models import Snippet, SnippetGrouper, SnippetPtr
1613

0 commit comments

Comments
 (0)