Fix long lines in Ganeti.HTools.Types and add Make check
authorIustin Pop <iustin@google.com>
Mon, 3 Dec 2012 20:20:00 +0000 (21:20 +0100)
committerIustin Pop <iustin@google.com>
Tue, 4 Dec 2012 11:44:43 +0000 (12:44 +0100)
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
htools/Ganeti/HTools/Types.hs

index ba073c9..a6a528a 100644 (file)
@@ -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)
index dbc0084..771407e 100644 (file)
@@ -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.