Skip to content

Commit

Permalink
Remove haddock-cov
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Sep 16, 2023
1 parent 03b01dc commit e56003f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 142 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
cmd: "nix run .#fourmolu -- --help"
- name: "hlint"
cmd: "nix run .#hlint -- --help"
- name: "haddock coverage"
cmd: "nix run .#haddock-cov -- --nh-help"
- name: "nixpkgs-fmt"
cmd: "nix run .#nixpkgs-fmt"
- name: "ormolu"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## [0.9] -- 2023-09-16
### Remove
* Removed `haddock-cov`
### Changed
* Updated tools:
* `cabal-fmt: 0.1.6 -> 0.1.7`
Expand Down
44 changes: 9 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
- [Haskell Linters](#haskell-linters)
- [HLint](#hlint)
- [Haskell Miscellaneous](#haskell-miscellaneous)
- [Haddock Coverage](#haddock-coverage)
- [HIE](#hie)
- [Nix Formatters](#nix-formatters)
- [Nixpkgs-Fmt](#nixpkgs-fmt)
Expand All @@ -41,7 +40,14 @@ Using nix, we provide a set of common tools for haskell development. In general,

For example, for `ormolu`, not only do we provide the executable itself, we also run it recursively on all files in a given directory. The default behavior is for `ormolu` to run on files individually, so we judge this to be an ergonomic improvement.

We cannot always satisfy the first requirement. For example, the `haddock` tool requires `cabal` and `ghc` to be on the `$PATH` because we cannot hope to provide both in such a way that will work for an arbitrary project. In this case, the extra logic (i.e. `2`) is what is useful, so we consider this acceptable.
## Alternatives

While `nix-hs-tools` is useful in a pinch, we sometimes want more granularity, e.g. pinning a project to a tool's specific version, or loading a general development shell. For these use-cases, see:

- Haskell flake utils: https://github.com/tbidne/nix-hs-utils
- Haskell development shells: https://github.com/tbidne/nix-hs-shells

It is often useful to specify a particular version of a tool to use with a specific project, in which case `nix-hs-tools` isn't terribly useful, as we generally only provide a fixed version per GHC

# Introduction

Expand All @@ -63,7 +69,7 @@ usage: nix run github:tbidne/nix-hs-tools#ormolu -- [--dir PATH] <args>
The version can also be fixed e.g.

```
nix run github:tbidne/nix-hs-tools/0.4.0.1#<tool> -- <args>
nix run github:tbidne/nix-hs-tools/0.9#<tool> -- <args>
```

# Tools
Expand Down Expand Up @@ -185,38 +191,6 @@ nix run github:tbidne/nix-hs-tools#hlint -- --refact --refactor-options=""

## Haskell Miscellaneous

### Haddock Coverage

**Source:** https://haskell-haddock.readthedocs.io/en/latest/

**Version:** 0.1.1

**Description:** Tool for checking haddock coverage. Unlike the other tools that provide all dependencies, this tool requires `cabal` and `ghc` to be on the `$PATH` and the project to build with `cabal haddock`. In particular, if nix is used to provide dependencies, this command should be run inside the same nix shell.

**Usage:**

```
haddock-cov [-t|--threshold PERCENTAGE] [-x|--exclude MODULE]
[-m|--module-threshold MODULE PERCENTAGE]
[-v|--version] <args>
```

**Examples:**

```
# checks that all modules in the default package have 100% haddock coverage
nix run github:tbidne/nix-hs-tools#haddock-cov
# checks that all modules in the default package have 70% haddock coverage
nix run github:tbidne/nix-hs-tools#haddock-cov -- --threshold 70
# checks haddock coverage in all packages, excluding Data.Foo and Bar modules.
nix run github:tbidne/nix-hs-tools#haddock-cov -- --exclude Data.Foo -x Bar --haddock-all
# drops coverage for Data.Foo and Bar to 70 and 65, respectively.
nix run github:tbidne/nix-hs-tools#haddock-cov -- --module-threshold Data.Foo 70 -m Bar 65
```

### HIE

**Source:** https://github.com/Avi-D-coder/implicit-hie
Expand Down
6 changes: 1 addition & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
desc = ''
Nix-hs-tools uses nix to provide tools for haskell development.
In general, we take some 3rd party tool (e.g. ormolu) and provide it with nix,
along with some extra functionality "on top" for convenience.\n
along with some extra functionality 'on top' for convenience.\n
To see a tool's individual usage, pass the '--nh-help' arg e.g.
\t$ nix run github:tbidne/nix-hs-tools#ormolu -- --nh-help
Expand All @@ -50,7 +50,6 @@
\tHaskell Linters:
\t - hlint: ${compiler.hlint.version}
\tHaskell Miscellaneous:
\t - haddock-cov: ${haddock-cov.version}
\t - hie: ${compiler.implicit-hie.version}
\tNix Formatters:
\t - nixpkgs-fmt: ${pkgs.nixpkgs-fmt.version}
Expand All @@ -60,8 +59,6 @@
See github.com/tbidne/nix-hs-tools#readme.
'';
version = "0.9";

haddock-cov = import ./tools/haddock-cov.nix { inherit nix-hs-utils pkgs; };
in
{
apps = {
Expand All @@ -82,7 +79,6 @@

hie = import ./tools/hie.nix compilerPkgs;
hlint = import ./tools/hlint.nix compilerPkgs;
haddock-cov = haddock-cov.app;
nixpkgs-fmt = import ./tools/nixpkgs-fmt.nix { inherit nix-hs-utils pkgs; };
ormolu = import ./tools/ormolu.nix compilerPkgs;
stylish = import ./tools/stylish.nix compilerPkgs;
Expand Down
2 changes: 1 addition & 1 deletion tools/cabal-fmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ nix-hs-utils.mkShellApp {
${compiler.cabal-fmt}/bin/cabal-fmt "''${args[@]}" $(${pkgs.fd}/bin/fd "$dir" -e cabal)
'';
runtimeInputs = [ compiler.cabal-fmt pkgs.fd ];
}
}
97 changes: 0 additions & 97 deletions tools/haddock-cov.nix

This file was deleted.

6 changes: 4 additions & 2 deletions tools/hlint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ nix-hs-utils.mkShellApp {
elif [[ $1 == "--refact" ]]; then
refact=1
else
args+=($1)
args+=("$1")
fi
shift
done
if [[ $refact == 0 ]]; then
${compiler.hlint}/bin/hlint --ignore-glob=dist-newstyle --ignore-glob=stack-work ''${args[@]} $(${pkgs.fd}/bin/fd "$dir" -e hs)
# shellcheck disable=SC2046
${compiler.hlint}/bin/hlint --ignore-glob=dist-newstyle --ignore-glob=stack-work "''${args[@]}" $(${pkgs.fd}/bin/fd "$dir" -e hs)
else
# refactor works on individual files only
# shellcheck disable=SC2145
${pkgs.fd}/bin/fd "$dir" -e hs | ${pkgs.findutils}/bin/xargs -I % sh -c "
${compiler.hlint}/bin/hlint \
--ignore-glob=dist-newstyle \
Expand Down

0 comments on commit e56003f

Please sign in to comment.