Skip to content

Commit

Permalink
Enforce -Werror in CI (dhall-lang#286)
Browse files Browse the repository at this point in the history
This adds the `-Werror` flag to CI so that warnings don't sneak into the
build (and also fixes the current set of warnings)
  • Loading branch information
Gabriella439 authored Feb 19, 2018
1 parent 48ca8d1 commit 8e1acaf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
11 changes: 5 additions & 6 deletions dhall/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import qualified Data.Text.Lazy.IO
import qualified Data.Text.Prettyprint.Doc as Pretty
import qualified Data.Text.Prettyprint.Doc.Render.Terminal as Pretty.Terminal
import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty.Text
import qualified Dhall.Core
import qualified Dhall.TypeCheck
import qualified Options.Generic
import qualified System.Console.ANSI
Expand Down Expand Up @@ -94,12 +93,12 @@ main = do
Left err -> Control.Exception.throwIO err
Right x -> return x

let render handle e = do
supportsANSI <- System.Console.ANSI.hSupportsANSI handle
let render h e = do
supportsANSI <- System.Console.ANSI.hSupportsANSI h
let renderIO doc =
if supportsANSI
then Pretty.Terminal.renderIO handle (fmap annToAnsiStyle doc)
else Pretty.Text.renderIO handle (Pretty.unAnnotateS doc)
then Pretty.Terminal.renderIO h (fmap annToAnsiStyle doc)
else Pretty.Text.renderIO h (Pretty.unAnnotateS doc)

if pretty
then do
Expand All @@ -108,7 +107,7 @@ main = do
else do
let doc = prettyExpr e
renderIO (Pretty.layoutPretty unbounded doc)
Data.Text.Lazy.IO.hPutStrLn handle ""
Data.Text.Lazy.IO.hPutStrLn h ""


expr' <- load expr
Expand Down
14 changes: 11 additions & 3 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ let
haskellPackages = pkgs.haskellPackages.override {
overrides = haskellPackagesNew: haskellPackagesOld: {
dhall =
pkgs.haskell.lib.justStaticExecutables
(haskellPackagesNew.callPackage ./default.nix { })
;
# Remove this once it is available in Nixpkgs 18.03
let
failOnAllWarnings =
drv: pkgs.haskell.lib.appendConfigureFlag drv "--ghc-option=-Wall --ghc-option=-Werror";


in
failOnAllWarnings
(pkgs.haskell.lib.justStaticExecutables
(haskellPackagesNew.callPackage ./default.nix { })
);
};
};
};
Expand Down

0 comments on commit 8e1acaf

Please sign in to comment.