From 9cda4d6afc8c3ae1176718b8ce0fe46dfb012f52 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 3 Dec 2012 21:20:00 +0100
Subject: [PATCH] Fix long lines in Ganeti.HTools.Types and add Make check

Since hlint doesn't check style issues but rather code only issues,
let's add a simple Makefile check for too-long lines, and fix the
single bad case we have currently.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 Makefile.am                   | 11 ++++++++---
 htools/Ganeti/HTools/Types.hs | 12 ++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ba073c924..a6a528a88 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1476,9 +1476,14 @@ check-local: check-dirs $(GENERATED_FILES)
 	  echo "File $(top_srcdir)/doc/design-$$expver.rst not found"; \
 	  exit 1; \
 	fi; \
-	if test $$(wc --max-line-length < $(top_srcdir)/configure.ac) -gt 80; then \
-	  echo 'Longest line in configure.ac is longer than 80 characters' >&2; \
-	fi
+	error= ; \
+	for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
+	  if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
+	    echo "Longest line in $$file is longer than 80 characters" >&2; \
+	    error=1; \
+	  fi; \
+	done; \
+	test -z "$$error"
 
 .PHONY: hs-check
 hs-check: htest/test htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
diff --git a/htools/Ganeti/HTools/Types.hs b/htools/Ganeti/HTools/Types.hs
index dbc0084a0..771407e68 100644
--- a/htools/Ganeti/HTools/Types.hs
+++ b/htools/Ganeti/HTools/Types.hs
@@ -146,12 +146,12 @@ type AllocStats = (AllocInfo, AllocInfo, AllocInfo)
 
 -- | Instance specification type.
 $(THH.buildObject "ISpec" "iSpec"
-  [ THH.renameField "MemorySize"   $ THH.simpleField C.ispecMemSize      [t| Int |]
-  , THH.renameField "CpuCount"     $ THH.simpleField C.ispecCpuCount     [t| Int |]
-  , THH.renameField "DiskSize"     $ THH.simpleField C.ispecDiskSize     [t| Int |]
-  , THH.renameField "DiskCount"    $ THH.simpleField C.ispecDiskCount    [t| Int |]
-  , THH.renameField "NicCount"     $ THH.simpleField C.ispecNicCount     [t| Int |]
-  , THH.renameField "SpindleUse"   $ THH.simpleField C.ispecSpindleUse   [t| Int |]
+  [ THH.renameField "MemorySize" $ THH.simpleField C.ispecMemSize    [t| Int |]
+  , THH.renameField "CpuCount"   $ THH.simpleField C.ispecCpuCount   [t| Int |]
+  , THH.renameField "DiskSize"   $ THH.simpleField C.ispecDiskSize   [t| Int |]
+  , THH.renameField "DiskCount"  $ THH.simpleField C.ispecDiskCount  [t| Int |]
+  , THH.renameField "NicCount"   $ THH.simpleField C.ispecNicCount   [t| Int |]
+  , THH.renameField "SpindleUse" $ THH.simpleField C.ispecSpindleUse [t| Int |]
   ])
 
 -- | The default minimum ispec.
-- 
GitLab