Commit Graph
155 Commits
Author SHA1 Message Date
David Wobrock e45e031820 Bump to 1.0.0 and update setup.py to drop command line usage 2019-05-12 15:32:57 +02:00
David Wobrock 5390fd507f Update Tests:
* don't use the project fixtures anymore but the one Django project
* update and refactor cache tests to be less brittle
* explicitly test mysql, postgresql and sqlite3 databases
* remove 'multiple_call' tests since it is not possible anymore
(with the Django singleton)
* update Travis and tox (dropping Python 3.4)
2019-05-12 15:32:57 +02:00
David Wobrock f35c9177f4 Delete examples folder since it is not relevant anymore 2019-05-12 15:32:57 +02:00
David Wobrock 484a775fda Linter Core: change lots of behaviour
* Use the Django migration classes to manipulate these objects
this includes the discovery of migrations through the MigrationLoader
(instead of manually walking through the Django project and find the migrations through a regex)
and representing a Migration through the Django class.
* Get the SQL of a migration through a 'call_command' call of 'sqlmigrate'
That speeds up greatly the linter since we don't have to setup Django for each migration
* Add the database to the cache path
2019-05-12 15:32:57 +02:00
David Wobrock 0eb584889a Add Django management command to launch the linter 2019-05-12 15:32:57 +02:00
David Wobrock f05a986973 Update .gitignore: remove fixture and add some stuff 2019-05-12 15:32:57 +02:00
David Wobrock 26ed4ecf62 Tests: add test project
* manage.py file at the root of the project
* targetting the project located at tests/test_project/settings.py

That allows testing the linter through just calling it on the project itself.
Using the new method coming soon: `python manage.py lintmigrations`
2019-05-12 15:32:57 +02:00
David Wobrock fdd6b9b06a Tests: Delete all fixture Django projects
We won't need all these different django projects to test the linter.
That adds up to much complexity to the tests.
2019-05-12 15:32:57 +02:00
David Wobrock 64c54b72d4 Bump to version 0.1.5 2019-04-21 12:53:13 +02:00
Taras Vozniuk fb0d7f07bc quite migration name to avoid failures of migration with space in the name 2019-04-21 12:47:17 +02:00
David-Wobrock 1245e7939d Bump to version 0.1.4 2019-02-24 18:19:49 +01:00
David-Wobrock 36e7dfaa0e Do not create cache folder if no-cache option 2019-02-24 18:18:45 +01:00
David-Wobrock c3c1af113c Handle postgresql alter column type
ALTER TABLE table ALTER COLUMN column TYPE
2019-02-24 15:55:05 +01:00
David-Wobrock 999ee2fa5e unrelated: fix some warnings and redundant elements 2019-02-24 15:55:05 +01:00
David-Wobrock 5c7dab8db2 Update linter tests for multiple backends
Create a base test class and have 3 different backends for now:
* mysql
* sqlite3
* postgresql
2019-02-24 15:55:05 +01:00
David-Wobrock ba83526339 Fix caching tests issues on Windows 2019-02-24 15:55:05 +01:00
David-Wobrock f5a587c2be Fix split path function
So it also works on windows
and does not return empty stuff
and update tests
2019-02-24 15:55:05 +01:00
David-Wobrock c403754564 Add blog post to readme
The article written by Felix about the linter and handling backward
incompatible migrations in Django
2019-02-24 15:55:05 +01:00
David-Wobrock f8d9ab777a Do not manually retrieve python interpreter path
Instead of doing custom and wrong path detection, just
use sys.executable which does exactly that
2019-02-24 11:04:21 +01:00
David-Wobrock 3591a4422a Bump to version 0.1.3 2019-02-03 19:39:31 +01:00
David Wobrock d22401f101 Add tests for version option
From Python 3.4 on, version is printed on stdout instead
of stderr.
2019-02-03 19:38:38 +01:00
David Wobrock fea623630e Add --version option 2019-02-03 19:38:38 +01:00
Serj Zavadsky fbf0f44193 message string fix 2019-02-03 19:08:58 +01:00
Melvyn Sopacua 6cdc947918 Merge pull request #48 from fevral13/master
Fix for IgnoreMigration operation for Postgresql
2019-01-29 17:56:13 +01:00
Serj Zavadsky 0c66b1cdfa IgnoreMigration operation fix (postgres compatibility fix) 2019-01-29 17:08:42 +01:00
Serj Zavadsky 0ce615ff19 IgnoreMigration operation fix (postgres compatibility fix) 2019-01-29 16:52:08 +01:00
Serj Zavadsky a31c92754f merge from upstream 2019-01-29 16:46:09 +01:00
David Wobrock 4d68f7bac8 Bump version to 0.1.2 2019-01-21 22:08:57 +01:00
David Wobrock 4c5d12800e Add in the readme what is looked for by the linter 2019-01-21 22:03:17 +01:00
David Wobrock 1a9024e799 add test for git on non root location 2019-01-20 12:17:11 +01:00
David Wobrock 009153fbf4 handle linting a project in pwd
When calling "django-migration-linter ."
be able to handle it (especially with cache)
2019-01-20 12:17:11 +01:00
David Wobrock 75c969c6a9 Revert "don't assume git root is django_path"
This reverts commit c14f9aef37.
2019-01-20 11:46:30 +01:00
Dat Hoang dca50b3afb Make sure file paths from git diff are relative to django_path instead of git repos root path
Currently, the git diff command return file paths which are relative to git repos root path, which will cause invalid migration file path if git repos root path is different from django_path
2019-01-20 11:43:33 +01:00
Victor Seva c14f9aef37 don't assume git root is django_path
> DJANGO_SETTINGS_MODULE=xpbx.test django-migration-linter --no-cache $(pwd)/xpbx origin/2.4.1
> (customers, 0010_auto_20181026_1330)... Traceback (most recent call last):
>  File "/home/vseva/Env/xpbx/bin/django-migration-linter", line 11, in <module>
>    sys.exit(_main())
>  File "/home/vseva/Env/xpbx/lib/python3.6/site-packages/django_migration_linter/migration_linter.py", line 341, in _main
>    linter.lint_all_migrations(git_commit_id=args.commit_id)
>  File "/home/vseva/Env/xpbx/lib/python3.6/site-packages/django_migration_linter/migration_linter.py", line 145, in lint_all_migrations
>    self.lint_migration(m)
>  File "/home/vseva/Env/xpbx/lib/python3.6/site-packages/django_migration_linter/migration_linter.py", line 81, in lint_migration
>    md5hash = self.old_cache.md5(migration.abs_path)
>  File "/home/vseva/Env/xpbx/lib/python3.6/site-packages/django_migration_linter/cache.py", line 47, in md5
>    with open(path, "rb") as f:
> FileNotFoundError: [Errno 2] No such file or directory: '/home/vseva/Foehn/xpbx/xpbx/xpbx/customers/migrations/0010_auto_20181026_1330.py'

Fix: #37
2019-01-17 20:40:32 +01:00
David-Wobrock f52bb3d9b8 Bump version to 0.1.1 2019-01-07 19:37:51 +01:00
Felix Bauer 32dc95601b Merge pull request #33 from 3YOURMIND/do-not-check-git-folder
Do not check if .git folder exists
2019-01-07 13:50:09 +01:00
Felix ab5536c8e7 Remove is_git_project from import 2019-01-07 12:25:57 +01:00
Felix 3ae4840e34 Merge branch 'master' into do-not-check-git-folder 2019-01-07 12:19:25 +01:00
Felix 92a686f13b Make imports relative 2019-01-05 22:24:33 +01:00
Felix Bauer b1716b9d1d Merge pull request #35 from 3YOURMIND/fix-cache-in-folder 2019-01-05 20:46:53 +01:00
Felix a159e29677 Print a better git error to the console 2019-01-05 19:35:55 +01:00
David-Wobrock 7a34ac9010 Fix tests and git migration gathering 2019-01-05 17:39:09 +01:00
David-Wobrock c6df7e53a0 Add Migration class to hold the path, app name and migration name in one object + adapt existing logic 2019-01-05 16:59:36 +01:00
David-Wobrock f0021dc139 Add test migration in folder 2019-01-04 22:00:19 +01:00
David-Wobrock 574af4b7fe Do not check if .git folder exists
git commands will fail anyway if not present
2019-01-04 21:42:39 +01:00
David-Wobrock 99534e4eb9 Bump version to 0.1.0 and set to dev status Beta 2019-01-03 22:13:37 +01:00
David-Wobrock 952e596d92 Bump copyright version to 2019 in files 2019-01-03 22:05:00 +01:00
David-Wobrock 1e2068eed5 Add black to lint tests and increase line length for flake8 2018-12-30 11:56:21 +01:00
David-Wobrock f05b199925 Black all files 2018-12-30 11:56:21 +01:00
David-Wobrock 03bd7753e5 Change ubuntu dist to xenial 2018-12-30 11:56:03 +01:00