diff options
author | Andy Doan <andy.doan@linaro.org> | 2017-01-26 22:53:01 -0600 |
---|---|---|
committer | Andy Doan <andy.doan@linaro.org> | 2017-01-26 22:53:01 -0600 |
commit | cac7d51a6127c87c6564ac8bdc540996812f3dd5 (patch) | |
tree | d8be9828e3487ed7daf4aeecc137f47903b632dd | |
parent | 17bbc9fbf2cd4d70eef46846748bb8cc7962ff74 (diff) |
flake8: fix some flake8 issues
The version of flake8 has changed and its given us 2 classes of
failures:
1) the issues shown in models.py which are trivial to address
2) the E402 which happen in our scripts like import_emails.py where we
have to call django_setup before we can do the other imports.
If we had infinite time and money, we could make all these "scripts"
become django management commands and clean it up that way as well
Change-Id: I421a2e0c46840aaabe73cb4a0a465beb1b91767a
-rw-r--r-- | linaro_metrics/models.py | 4 | ||||
-rwxr-xr-x | unit-test.sh | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/linaro_metrics/models.py b/linaro_metrics/models.py index 7155246..3434d48 100644 --- a/linaro_metrics/models.py +++ b/linaro_metrics/models.py @@ -17,7 +17,7 @@ def x_months_ago(x): # Get first day of this month. month = datetime.datetime.now().replace( day=1, hour=0, minute=0, second=0, microsecond=0) - for x in range(x-1): + for x in range(x - 1): month = month.replace(day=1) - datetime.timedelta(days=1) return month.replace(day=1) @@ -98,7 +98,7 @@ class TeamCredit(models.Model): accept = cls.patch_count_by_month(num_months, s, **filter_args) metrics = [] for x in reversed(range(num_months)): - metrics.append([x_months_ago(x+1), 0, 0]) + metrics.append([x_months_ago(x + 1), 0, 0]) for metric in metrics: # About: if str(metric[0]).startswith(str(x['month'])) # In order to keep unit testing simple we use sqlite. Production diff --git a/unit-test.sh b/unit-test.sh index 2f81b36..e6e5191 100755 --- a/unit-test.sh +++ b/unit-test.sh @@ -27,12 +27,12 @@ fi echo echo "== Running flake8 checks..." echo +FLAKE_EXCLUDE="linaro_metrics/migrations" if echo $VENV_DIR | grep $HERE ; then # make sure we don't run tests on the venv if its in our source tree - flake8 --show-source --exclude=$VENV_DIR,linaro_metrics/migrations ./ -else - flake8 --show-source --exclude=linaro_metrics/migrations ./ + FLAKE_EXCLUDE="$VENV_DIR,$FLAKE_EXCLUDE" fi +flake8 --ignore=E402 --show-source --exclude=$FLAKE_EXCLUDE ./ echo echo "== Running test suite..." |