-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs kiwitcms/Kiwi#1774 New linter: warn about missing backwards migr…
…ations
- Loading branch information
Showing
6 changed files
with
90 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
pylint_django/tests/input/migrations/0003_without_backwards.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# pylint: disable=missing-docstring, invalid-name | ||
from django.db import migrations | ||
|
||
|
||
# pylint: disable=unused-argument | ||
def forwards_test(apps, schema_editor): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
operations = [ | ||
migrations.RunPython(), # [missing-backwards-migration-callable] | ||
migrations.RunPython( # [missing-backwards-migration-callable] | ||
forwards_test), | ||
migrations.RunPython( # [missing-backwards-migration-callable] | ||
code=forwards_test), | ||
migrations.RunPython( # [missing-backwards-migration-callable] | ||
code=forwards_test, atomic=False) | ||
] |
4 changes: 4 additions & 0 deletions
4
pylint_django/tests/input/migrations/0003_without_backwards.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
missing-backwards-migration-callable:13:Migration:pylint_django.tests.input.migrations.0003_without_backwards Always include backwards migration callable | ||
missing-backwards-migration-callable:14:Migration:pylint_django.tests.input.migrations.0003_without_backwards Always include backwards migration callable | ||
missing-backwards-migration-callable:16:Migration:pylint_django.tests.input.migrations.0003_without_backwards Always include backwards migration callable | ||
missing-backwards-migration-callable:18:Migration:pylint_django.tests.input.migrations.0003_without_backwards Always include backwards migration callable |
21 changes: 21 additions & 0 deletions
21
pylint_django/tests/input/migrations/0004_noerror_with_backwards.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# pylint: disable=missing-docstring, invalid-name | ||
from django.db import migrations | ||
|
||
|
||
# pylint: disable=unused-argument | ||
def forwards_test(apps, schema_editor): | ||
pass | ||
|
||
|
||
# pylint: disable=unused-argument | ||
def backwards_test(apps, schema_editor): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
operations = [ | ||
migrations.RunPython(forwards_test, backwards_test), | ||
migrations.RunPython(forwards_test, reverse_code=backwards_test), | ||
migrations.RunPython(code=forwards_test, reverse_code=backwards_test) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters