From 8ad6accaa61b19fa1f1898ec7c3fcdb9719700b3 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Wed, 21 Jan 2015 08:57:45 +0100 Subject: [PATCH] Add isort1 Do not do any travis checks, but append the commands, so that we can use isort to clean up the code --- .travis.yml | 1 + make/commands.py | 6 ++++++ requirements.txt | 5 +++-- setup.cfg | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 setup.cfg 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