# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1533809416 -7200
#      Thu Aug 09 12:10:16 2018 +0200
# Node ID 7c7994ffc45eed1801480cc8fe2be18fd4b2e144
# Parent  839e06c99b04fe150ad29bd3995831a4049c6bc1
:pencil: run isort when running a project to detect problems before CI

diff --git a/docker_dev_start.py b/docker_dev_start.py
--- a/docker_dev_start.py
+++ b/docker_dev_start.py
@@ -68,6 +68,16 @@
         _logger.warning('No flake8 in PATH')
 
 
+def isort():
+    """Run isort if found
+    """
+    if which('isort'):
+        _logger.info('Running isort')
+        call(['isort', '-c'])
+    else:
+        _logger.warning('No isort in PATH')
+
+
 def main(argv=None):  # IGNORE:C0111
     """Parse arguments and launch conversion
     """
@@ -197,6 +207,12 @@
         dest='flake8',
     )
     parser.add_argument(
+        '--no-isort',
+        help="Do not run isort",
+        action='store_false',
+        dest='isort',
+    )
+    parser.add_argument(
         '--odoo-help',
         help="Pass --help to odoo binary [default: %(default)s]",
         action='store_true',
@@ -275,6 +291,7 @@
     use_host_network = nmspc.host_network
     start_postgresql = nmspc.start_postgresql
     run_flake8 = nmspc.flake8
+    run_isort = nmspc.isort
     odoo_help = nmspc.odoo_help
     dev = nmspc.dev
     restore_filename = nmspc.DUMP
@@ -598,6 +615,9 @@
     if run_flake8:
         flake8()
 
+    if run_isort:
+        isort()
+
     if dev:
         if odoo_type in ('odoo11', 'odoo10'):
             # ipdb should not be run if not interactive