haskell / haskell/cabal

Cabal returns successfully when haddock failed to parse a module.

Open
#8,920 1 comment 0 reactions 0 assignees View on GitHub
Cabal: cmd/haddock re: error-message type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
When `haddock` fails to parse a module, `cabal` returns 0 status. This means that CI jobs which try to build documentation silently pass, here's an [example](https://github.com/input-output-hk/io-sim/actions/runs/4785344595/jobs/8507937764#step:13:67).

**To Reproduce**
Run `cabal v2-build -w ghc-8.10` to build something which `haddock` will fail to parse, e.g. the example below requires `ghc-8.10`:

```haskell
module X
( -- $doc
someFunc
) where

-- $doc
-- Hello World!

import Prelude

someFunc :: IO ()
someFunc = undefined
```

Although cabal warns the user, that the documentation wasn't built, there are situations when one would like to get an error (e.g. CI):
```
Warning: Failed to build documentation for io-classes-1.0.0.1 (which is
required by test:test from io-sim-1.0.0.1, test:test from strict-mvar-1.0.0.1
and others).
```

**Expected behavior**

I only tracked that `cabal-3.10.0.0`, `cabal-3.9.0.0` & `3.8.1.0` share this behaviour, I haven't checked earlier versions.

**System information**
- Operating system: `fedora`
- `cabal-3.10.0.0`, `cabal-3.9.0.0`, `3.8.1.0`; `ghc-8.10` versions

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.