David-Wobrock
36e7dfaa0e
Do not create cache folder if no-cache option
2019-02-24 18:18:45 +01:00
David-Wobrock
999ee2fa5e
unrelated: fix some warnings and redundant elements
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
fea623630e
Add --version option
2019-02-03 19:38:38 +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
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
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
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
952e596d92
Bump copyright version to 2019 in files
2019-01-03 22:05:00 +01:00
David-Wobrock
f05b199925
Black all files
2018-12-30 11:56:21 +01:00
Felix
1c28412ebd
Improve the cache
...
React to Comments and add a Test
2018-12-23 23:28:45 +01:00
Felix
d3805d5210
Integrate IGNORE into cache
2018-12-23 22:49:36 +01:00
Felix
4bcb67c9f2
Merge branch 'master' into cache
2018-12-23 22:40:29 +01:00
Felix
6fe51d2e08
Remove duplication
2018-12-23 17:46:57 +01:00
Felix
ff8e1b4363
Remove sqlparse
2018-12-23 17:46:57 +01:00
Felix
9e3dbf7778
Mark migrations as ignored
2018-12-23 17:46:57 +01:00
Felix
357f0aebf4
Adapt tests so that not relying on undefined
...
behaviour.
The app directories can appear in any order, we need to allow that
in tests.
2018-12-23 12:25:41 +01:00
David-Wobrock
395379178b
Fix linting through using a raw python string
2018-12-23 12:25:41 +01:00
Felix
f351b71d6a
Fix flake8
2018-12-20 14:53:25 +01:00
Felix
b68c0183bb
Finish up cache and fix tests.
...
Still TODO: Merge with ignore functionality.
2018-12-20 14:45:35 +01:00
David-Wobrock
d672f06635
Drop django 1.10 support (and fix some PEP8)
2018-07-19 22:14:13 +02:00
David-Wobrock
555d17adcd
Rename log object to logger (to follow the standard)
2018-07-19 22:03:37 +02:00
Serj Zavadsky
bfb32ba312
logging config fixed
2018-07-19 22:01:12 +02:00
Serj Zavadsky
10d36bbab2
logging config fixed (now logging is made not by root logger, but by 'django_migration_linter.sql_analyzer')
2018-07-19 22:01:12 +02:00
David-Wobrock
698e658faa
Fix test : do not consider deleted migrations
...
* Change way to detect deleted migrations (diff-filter of 'git diff' command)
2018-01-20 15:50:45 +01:00
David-Wobrock
fffdf5714e
Fix that linter actually ignores deleted files and add a specific test for this
2018-01-18 23:56:33 +01:00
Felix Bauer
5bef4e7a17
Only consider added migrations
2018-01-18 21:45:27 +01:00
David-Wobrock
306551234a
Fix import errors for python3 & print error message on stderr (through exception message)
2018-01-13 00:40:03 +01:00
David-Wobrock
61cd48dc8c
Merge branch 'dev' into small-improvements
2018-01-13 00:11:53 +01:00
David-Wobrock
317156bf2b
Remove django 1.9 support and fix PEP8
2018-01-12 23:23:11 +01:00
David-Wobrock
dcbcb0883c
Use python exe in current venv
2018-01-12 23:01:11 +01:00
Felix Bauer
d5c659db86
Improve error output
2018-01-11 16:06:50 +01:00
David-Wobrock
55e1e13ad5
Update copyright year to 2018
2018-01-07 12:15:23 +01:00
David Wobrock
15b2fbb9e1
Add tests from command line directly
...
* Test options
* Syntax error fix
* Ajust the commit id for a test (was wrongly set)
2017-11-30 17:44:12 +01:00
David-Wobrock
fc8f405801
Fix tests, flake8 and update README
2017-11-30 00:09:18 +01:00
David Wobrock
50ce4f4cad
Large code refactoring
...
* Add tests
* Remove git dependency (only needed when a git identifier is specified)
2017-11-29 23:57:23 +01:00
David-Wobrock
844fbc3c1a
Add pycodestyle and flake8 tests to Travis
...
Refactor style issues for pycodestyle tests to pass
2017-11-22 17:10:01 +01:00
David-Wobrock
174bb19319
Adapt code to python3.4 and add it to travis
...
Added to travis explicitly python 2.7, 3.4, 3.5, 3.6
2017-11-22 17:03:48 +01:00
David-Wobrock
c5fc3ae896
Add entry point for console script in setup.py
2017-10-31 17:24:14 +01:00
David-Wobrock
1cd36825c1
Start large refactoring of tests and project structure
...
* Put tests in tests/ diretory
* Write functional tests
* Create setup.py
* Put sources into django_migration_linter folder (for future PyPi publishing)
2017-10-30 23:31:13 +01:00