David Wobrock
2ee7dac3b3
Add internal classes and add type hints + mypy.
2022-12-26 16:26:24 +01:00
Nikita Karamov
cb8492d8a7
Use a context manager to write to /dev/null
2022-11-14 09:01:21 +01:00
David Wobrock
e8f83708b0
Run black.
2022-11-03 22:00:00 +01:00
Sondre Lillebø Gundersen
bd4eb89b8c
chore: Upgrade Python syntax with pyupgrade
...
Run with the following pre-commit configuration:
```
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
hooks:
- id: pyupgrade
args: [ "--py3-plus", "--py36-plus", "--py37-plus" ]
```
The rationale for every change can be found at https://github.com/asottile/pyupgrade
2022-11-03 22:00:00 +01:00
David Wobrock
bef47906d1
Fix #209 - Raise when getting SQL statements fail.
2022-07-28 23:45:14 +02:00
David Wobrock
74a7ee9239
Remove remaining __future__ imports.
2022-07-23 11:59:50 +02:00
David Wobrock
f67f27354d
Fix #218 - Handle model 'objects' call with other parts in the name.
2022-07-09 15:37:57 +02:00
David Wobrock
c7d9129db9
Adapt 'warnings-as-errors' option to allow taking migration test codes as input
2022-03-13 17:26:40 +01:00
David Wobrock
76a55dbb12
Raise when unsupported db vendor, and add option to specify SQL analyser
2022-01-30 15:20:18 +01:00
David Wobrock
085048d22b
Drop Py2.7, 3.5 and Django 1.11, 2.0, 2.1, 3.0
2021-11-12 17:26:38 +01:00
Daniel Hahler
5a969b578e
build(deps): drop six from requirements
...
It is only used in a single place to check for Python 2, which can
easily be inlined.
2021-09-13 23:04:37 +02:00
David Wobrock
419f90e728
Fix #119 -- Handle verbosity=0 level correctly and suppress all prints/logs
2021-06-26 13:29:01 +02:00
David Wobrock
6e15f65467
Fix typo in warning variable
2021-06-19 18:15:40 +02:00
David Wobrock
70db245df3
Adapt migration linter to handled returned warnings
2021-06-19 18:15:40 +02:00
David Wobrock
6d595f1555
Add support for positional app_label and migration_name arguments
2021-05-26 18:53:19 +02:00
David-Wobrock
137089573c
Implement include migration name options
2021-01-31 17:44:58 +01:00
David-Wobrock
e51073ef46
Fixes #129 - use single logger
2020-11-30 21:53:38 +01:00
David-Wobrock
6ab1d58c47
Apply isort to the project
2020-11-30 21:46:40 +01:00
David-Wobrock
4b15e11faa
Rename data migration lint checks
2020-11-30 21:40:57 +01:00
David-Wobrock
1824410ac5
Fix linting errors
2020-11-26 19:02:57 +01:00
David-Wobrock
f5d0da4932
Run some checks on RunSQL migration operation
2020-11-26 19:02:57 +01:00
David-Wobrock
780630131f
Add warning if RunPython model variable name not the same as model class
2020-11-26 19:02:57 +01:00
David-Wobrock
601e02e024
Rename method name and add comments
2020-11-26 19:02:57 +01:00
David-Wobrock
a68ff7c306
Make data migration model import check a bit less strict
...
It now allows:
* get_model(...) calls with one parameter only
* allows the variable name to be not the same as the model name itself (this will become a warning)
2020-11-26 19:02:57 +01:00
David Wobrock
ef38433bb8
Unrelated: handle migration files gathered from git command that are not in the installed_apps
2020-07-02 19:15:30 +02:00
David Wobrock
8a7cff3c82
Add method to linter reset_counters
2020-07-02 19:15:30 +02:00
David Wobrock
31338714dd
Fix #112 -- make the behaviour of --include-migrations-from more obvious
...
* Misspelled filename => fail (instead of linting all migrations and ignoring the error)
* An empty file/a file with no valid migration paths => lint no migrations (instead oflinting all migrations)
* If the option is not specified, keep the behaviour of linting all migrations
2020-06-17 22:32:42 +02:00
Gerhard Kotze
50bbed4a1a
Keep line under 88 characters
2020-05-16 21:14:12 +02:00
Gerhard Kotze
56d5f8c26c
Handle get_model calls with linebreaks before and after arguments
...
For example code formatted with `black` could look something like this and is not picked up by the existing regex
FreakishlyLongerThanUsualModel = get_model(
'longerthanusualapp', 'FreakishlyLongerThanUsualModel'
)
2020-05-16 21:14:12 +02:00
David Wobrock
c048bdf745
Simplify print statements
2020-03-13 23:24:39 +01:00
Vladyslav Krylasov
e01f294d4f
Fix a linting error
2020-03-13 23:12:07 +01:00
Vladyslav Krylasov
7b14fd5292
Make an output of print_summary more readable
2020-03-13 23:12:07 +01:00
David Wobrock
cb6961539c
Handle for forward and backward data migration imports
2020-02-08 22:38:05 +01:00
David Wobrock
19023626e6
Introduce a first PY2/PY3 difference for inspect.get(full)argspec call
2020-02-07 23:29:15 +01:00
David Wobrock
a0e7ca099b
Simplify passing migration object directly into analysing data migration
2020-02-07 23:29:15 +01:00
David Wobrock
9f22116541
Black the code
2020-02-07 23:29:15 +01:00
David Wobrock
2e7eec42c2
Remove the 'warn' in front of warning messages
2020-02-07 23:29:15 +01:00
David Wobrock
a0d5e2940c
Import RunPython directly to avoid shadowing existing names
2020-02-07 23:29:15 +01:00
David Wobrock
1925343f4a
Move constants to specific file and remove unused import
2020-02-07 23:29:15 +01:00
David Wobrock
e49f6dea9c
Document, add to changelog the data migrations and rename to 'warnings-as-errors' (plural)
2020-02-07 23:29:15 +01:00
David Wobrock
71614bd377
Handle warning as error and exclude warning tests
2020-02-07 23:29:15 +01:00
David Wobrock
d01875b3be
add warnings and RunPython basic linting
2020-02-07 23:29:15 +01:00
David Wobrock
d410d2c7ba
Refactor some linting code to more intelligible conditions
2020-02-07 23:29:15 +01:00
David Wobrock
813c5c8690
Remove apache license headers in each file. The one full copy of the license at the root of the repo shall define the license for all source files.
2020-01-11 22:08:33 +01:00
David Wobrock
ceabb40a62
Change migration linting prints to use conditined methods
2019-10-21 22:25:52 +02:00
David Wobrock
3b8e86fdf7
Add 'quiet' to argparsing and pass it to the linter
2019-10-21 22:25:52 +02:00
David Wobrock
72f066e710
Add MessageType enum for differentiating messages
2019-10-21 22:25:52 +02:00
David Wobrock
e6e8cc7525
Update migrations list file behaviour
...
Instead of using the file path when the git commit is not
added, use the file and the migrations list no matter if we select
all migrations or just from a certain git commit.
And unit tests :)
2019-10-12 15:53:18 +02:00
yongming
dbebda65d9
Fix help in command line, fix read file
2019-10-10 22:50:17 +02:00
yongming
adf61dd669
Add command to only check migration files in a given file
2019-10-10 22:50:17 +02:00