Problem: we have two major use cases:
1. Using xrefcheck in CI, in this case it is annoying for devops to
always pass mostly always reasonable `--no-progress` option.
2. Using it locally, here we want progress bar to be enabled by default
so that user could run `xrefcheck` without any options most of the time.
Solution:
Detect whether are we running in CI and use the respective default for
whether progress bar should be displayed.
Detecting whether we are within CI is possible using `CI` env variable,
at least Github actions, Gitlab CI and Buildkite pass this env.
`--no-progress` option still can be passed if user wants to suppress
progress bar in local run. The opposite `--progress` seems to also make
sense, because in case if high timeouts are set, user probably wants to
track progress somehow to make sure that CI didn't hang. So we add the
latter, and these two options can be used to override the default
behaviour defined by `CI` env var.
Problem: LTS-14.16 that we currently using and a bit old.
And its GHC is old as well.
Solution: update the resolver, make some changes that were necessary.
They are pretty trivial. The only essential breaking change is the
removal of `parseUrl` from `req`.
Problem: base-noprelude is a non-standard dependency, unlike `base`.
Due to our use of `mixins` we don't need `base-noprelude` anymore,
we can just hide `Prelude`.
Solution: use `base` and hide `Prelude`.
Problem: `autoexporter` is used in one place to re-export one module.
Probably one day it will re-export more, but at this point it's really
overkill.
Moreover, it causes Hackage build to fail for the reasons mentioned
here:
https://github.com/haskell/hackage-server/issues/821
Solution: stop using it, re-export manually.
Problem: after we started using mixins feature, generated .cabal file
requires cabal 2.0. Attempt to upload our package to Hackage now reports
an error, saying that `autogen-modules` section have to mention `Path_*`
files.
Solution: add `Paths_xrefcheck` to `generated-other-modules` section of
`package.yaml`.
Problem: lootbox is not uploaded to hackage, so when we upload
xrefcheck, its build on hackage fails.
Solution: we can use `mixins` feature to set Universum as prelude
without any intermediate packages.
This seems to be supported even by quite old versions of stack, like
1.7.3, so that should not bring build problems in most cases.
Problem: I mistakenly imported `System.FilePath.Posix` everywhere,
it, as expected, is proper only on POSIX systems.
Solution: use just `System.FilePath`.
Problem: it's not good that `ignored` matches at file prefix, then if
someone marked `doc` folder as ignored, `doc-others` folder would be
ignored as well.
Solution: use exact matching. This requires user specifying
entries of `ignored` in specific format (e.g. `doc`, not `./doc`), but
let's don't bother about this for now.
Also, we already can ignore not only folders but also files, so we now
mention this in documentation.
Problem: I applied canonicalization to those files before attaching
repository root to them, this made relative filepaths expand as if they
counted from the current working directory. Since now we allow passing
custom root, this is invalid.
Solution: accept repository root, canonicalize only after it is
attached.
Problem: when launching our verifier with `-v`, visually separating
repository data section from found errors section is difficult.
Solution: make section headers more noticable.
Problem: it is often a case that in CI we copy xrefcheck repository into
the verified project, and we want to exclude folder with xrefcheck from
scan. Considering this in config is not too convenient, better add a CLI
option.
Solution: add this CLI option.
As in config, I call it `ignored`, because simpler `excluded` is too
general and it's not obvious what exactly it refers to - the set of
verified files or the set of supposedly non-existing files (in the
latter case references _to_ such files should also be prohibited).
Problem: we use many unusual unicode characters, on some locales this
may cause failures on attempt to print to stdout.
Solution: it is generally a good practice to set encoding of all
handlers to UTF-8, and this commit brings `with-utf8` package which does
that.
Problem: we are going to release this tool and from that point
it would be nice to maintain its changelog.
Solution: add a simple CHANGES.md and update PR template.
Problem: module names are prefixed with `Crv` which does not suit the
new project naming.
Solution: following the new `xrefcheck` name, rename modules so that
they start from `Xrefcheck`.