diff --git a/.travis.yml b/.travis.yml index 0c2255acc..86c9cbab0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ install: - "node_modules/.bin/gulp --production" script: - "flake8 --max-line-length=150 --statistics openslides tests" + - "isort --check-only --recursive openslides tests" - "DJANGO_SETTINGS_MODULE='tests.settings' coverage run ./manage.py test tests.unit" - "coverage report --show-missing --fail-under=35" diff --git a/make/commands.py b/make/commands.py index e21db86da..ec338213c 100644 --- a/make/commands.py +++ b/make/commands.py @@ -120,3 +120,9 @@ def po2json(args=None): lang = args.language call('node_modules/.bin/po2json openslides/locale/%s/javascript.po openslides/static/i18n/%s.json' % (lang, lang)) + + +@command('isort', + help='Sorts all imports in all python files.') +def isort(args=None): + return call('isort --recursive openslides tests') diff --git a/requirements.txt b/requirements.txt index bcbf2c270..a776e612a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,9 @@ -r requirements_production.txt # Requirements for development and tests in alphabetical order -coverage==3.7.1 -flake8==2.2.4 +coverage +flake8 +isort # Requirements for OpenSlides handbook/documentation in alphabetical order Sphinx==1.2.2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..686d1fbb9 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[isort] +multi_line_output=3 +include_trailing_comma=True +skip=main.py,signals.py,csv_import.py,global_settings.py,test_personal_info.py,tests.py,auth.py,search_indexes.py,test_list_of_speakers.py,chatbox.py,test_main_menu.py,test_config.py,runserver.py,rest_api.py,settings.py,test_pdf.py,__main__.py,test_serializers.py,autoupdate.py,pdf.py,widgets.py,models.py,test_csv_import.py,plugins.py,serializers.py,test_csv.py,test_overlays.py,backupdb.py,views.py,test_views.py,urls.py,forms.py,utils.py,test_auth.py