From 9d0ae15210da5e17553b17281adf94e5499f6ec0 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Tue, 25 Feb 2020 15:01:11 +0000
Subject: [PATCH] Centralise linting commands in the makefile

- Add missing PHONY definition for `help`
- Add `lint` command to run both isort and flake8
- Add `style` command to run flake8
- Rename `fix` to `sort-fix` to fix the isort errors
- Remove exit code from `sort` as it hid errors and emits error codes anyway
---
 Makefile | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index c20c39c8b..24588df27 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,23 @@
-.PHONY:
+.PHONY: help
 help:
 	@echo "Usage:"
 	@echo "    make help             prints this help."
-	@echo "    make fix              fix import sort order."
-	@echo "    make sort             run the linter."
+	@echo "    make lint             run all python linting."
+	@echo "    make sort             run the isort import linter."
+	@echo "    make sort-fix         fix import sort order."
+	@echo "    make style            run the python code style linter."
 
-.PHONY: fix
-fix:
-	isort -y
+.PHONY: lint
+lint: sort style
 
 .PHONY: sort
 sort:
-	@echo "Running Isort" && isort --check-only --diff || exit 1
+	@echo "Checking imports with isort" && isort --check-only --diff
+
+.PHONY: sort-fix
+sort-fix:
+	@echo "Fixing imports with isort" && isort --apply
+
+.PHONY: style
+style:
+	@echo "Checking code style with flake8" && flake8
-- 
GitLab