Skip to content

Commit 843429d

Browse files
authored
Setup pre commit (#8)
Setup pre-commit
1 parent 5e24a14 commit 843429d

File tree

7 files changed

+52
-26
lines changed

7 files changed

+52
-26
lines changed

.checkignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
tests/*
2-
django_fsm/tests/*
2+
django_fsm/tests/*

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
default_language_version:
2+
python: python3.8
3+
python_venv: python3.8 # Optional
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.4.0
8+
hooks:
9+
- id: check-added-large-files
10+
args: ["--maxkb=700"]
11+
- id: check-case-conflict
12+
- id: check-json
13+
- id: check-merge-conflict
14+
- id: check-symlinks
15+
- id: check-toml
16+
- id: check-yaml
17+
- id: debug-statements
18+
- id: end-of-file-fixer
19+
- id: trailing-whitespace
20+
21+
- repo: https://github.com/asottile/pyupgrade
22+
rev: v3.15.0
23+
hooks:
24+
- id: pyupgrade
25+
args:
26+
- "--py38-plus"
27+
28+
- repo: https://github.com/adamchainz/django-upgrade
29+
rev: 1.15.0
30+
hooks:
31+
- id: django-upgrade
32+
args: [--target-version, "3.2"]
33+
34+
# - repo: https://github.com/astral-sh/ruff-pre-commit
35+
# rev: v0.0.291
36+
# hooks:
37+
# - id: ruff-format
38+
# - id: ruff

.pylintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
persistent=yes
33

44
[MESSAGES CONTROL]
5-
# C0111 = Missing docstring
5+
# C0111 = Missing docstring
66
# I0011 = # Warning locally suppressed using disable-msg
77
# I0012 = # Warning locally suppressed using disable-msg
88
disable=I0011,I0012
@@ -60,4 +60,3 @@ max-parents=7
6060
max-attributes=7
6161
min-public-methods=0
6262
max-public-methods=20
63-

LICENSE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
copyright (c) 2010 Mikhail Podgurskiy
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2010 Mikhail Podgurskiy
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy
46
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ on a model instance with a protected FSMField will cause an exception.
153153

154154
``source`` parameter accepts a list of states, or an individual state or ``django_fsm.State`` implementation.
155155

156-
You can use ``*`` for ``source`` to allow switching to ``target`` from any state.
156+
You can use ``*`` for ``source`` to allow switching to ``target`` from any state.
157157

158158
You can use ``+`` for ``source`` to allow switching to ``target`` from any state excluding ``target`` state.
159159

@@ -163,7 +163,7 @@ You can use ``+`` for ``source`` to allow switching to ``target`` from any state
163163
``target`` state parameter could point to a specific state or ``django_fsm.State`` implementation
164164

165165
.. code:: python
166-
166+
167167
from django_fsm import FSMField, transition, RETURN_VALUE, GET_STATE
168168
@transition(field=state,
169169
source='*',

django_fsm/management/commands/graph_transitions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.core.management.base import BaseCommand
66
try:
7-
from django.utils.encoding import force_text
7+
from django.utils.encoding import force_str
88
_requires_system_checks = True
99
except ImportError: # Django >= 4.0
1010
from django.utils.encoding import force_str as force_text
@@ -41,7 +41,7 @@ def node_name(field, state):
4141

4242
def node_label(field, state):
4343
if type(state) == int or (type(state) == bool and hasattr(field, "choices")):
44-
return force_text(dict(field.choices).get(state))
44+
return force_str(dict(field.choices).get(state))
4545
else:
4646
return state
4747

tests/settings.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import django
2-
31
PROJECT_APPS = (
42
"django_fsm",
53
"testapp",
@@ -25,22 +23,11 @@
2523
}
2624
}
2725

28-
if django.VERSION < (1, 9):
29-
30-
class DisableMigrations:
31-
def __contains__(self, item):
32-
return True
33-
34-
def __getitem__(self, item):
35-
return "notmigrations"
36-
37-
MIGRATION_MODULES = DisableMigrations()
38-
else:
39-
MIGRATION_MODULES = {
40-
"auth": None,
41-
"contenttypes": None,
42-
"guardian": None,
43-
}
26+
MIGRATION_MODULES = {
27+
"auth": None,
28+
"contenttypes": None,
29+
"guardian": None,
30+
}
4431

4532

4633
ANONYMOUS_USER_ID = 0

0 commit comments

Comments
 (0)