Commit Graph

24 Commits

Author SHA1 Message Date
Kirill Andreev
92c3de5587
Improve readability of imports
Problem:  In
          ```
          import qualified Foo.Bar as Bar
          import Foo.Bar (Bar)
          ```
          names of the imported modules are on different
          vertical lines, which disables autosorting,
          and makes it harder to read.

Solution: Use `ImportQualifiedPost`
2021-11-01 15:25:29 +04:00
Kirill Andreev
2f9a9d8599
Remove mixins
Problem:  Stack cannot build projects with mixins, and they only
          used to splice universum instead of base.

Solution: Use `NoImplicitPreduce` and import `Universum`
          everywhere explicitly.
2021-11-01 15:24:25 +04:00
Andrey Demidenko
5e266775bd
[Chore] Move commands related functionality to lib
Problem:
We have `exec` directory with `Main.hs` which (from semantic) supposed
to only run Xrefcheck.
Also, it's a common practice to keep `Main.hs` as simple as it possible.
But now it have some logic.

Solution:
Move commands related functionality to lib (separate module) and keep
`Main.hs` very simple, only as runner.
2021-10-08 13:29:19 +03:00
Andrey Demidenko
29d4f12c61
[#81] Add config option for localhost links
Problem:
Almost all the time we can't validate localhost links, so we just skip them.
But to run ftp links tests (#47) we need to refer to localhost.

Solution:
Add config option whether to ignore localhost links and provide bats
tests for this new feature.

Co-authored-by: Alexander Bantyev <alexander.bantyev@serokell.io>
2021-10-08 13:29:19 +03:00
martoon
045f4146cf
[#55] Generate config depending on the repo type
Problem: now when we include repository type into the config, it seems
to make sense to generate config differently depending on the repository
type. Especially taking into account that currently in some fields we
mix GitHub and GitLab -specific contents.

Solution:

Leave placeholders in the default config and later fill them from the
code depending on the required repository type.

Add a mandatory repository type parameter to `dump-config` CLI command.

Along with a test checking for config validity, add a golden test on the
produced config so that we could assess how sane it looks like.
2021-05-03 17:01:20 +03:00
martoon
aac3d5aec7
[#55] Account for Markdown flavor type
Problem: it turned out that GitHub and GitLab render anchors for headers
differently.

Solution: make it possible to specify flavor in config, adjust
headers conversion respectively. Added some fixes for GitHub as well.

Flavor field is mandatory, so this change is breaking, but I
think it's a worthy thing since otherwise other subtle bugs are
possible, it should be good if users specify the flavor as soon
as possible.
2021-05-03 16:57:28 +03:00
martoon
967da232d3
Disable progress bar in CI automatically
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.
2020-06-26 22:32:03 +03:00
martoon
3591341886
Make printed section headers more bold
Problem: when launching our verifier with `-v`, visually separating
repository data section from found errors section is difficult.

Solution: make section headers more noticable.
2020-04-28 19:25:24 +03:00
martoon
ca0beb5a28
[#19] Add not-scanned CLI option
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).
2020-04-28 19:25:13 +03:00
martoon
be9d750624
Use UTF-8 encoding for stdin/stdout
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.
2020-03-25 16:37:43 +03:00
martoon
0c1d453e87
Rename module names
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`.
2020-01-14 19:41:47 +03:00
Ivan Gromakovskii
8060c7187b
[INT-128] Make the repository REUSE compliant
Problem: nowadays we want all files to store licensing information in
machine-readable format and to use reuse tool to check that. But the
repo is not REUSE compliant.

Solution: add `LICENSES` folder and licensing information for each
file.
2019-12-19 16:19:27 +03:00
martoon
49444bc3a4
Improve work with config UX
Problem: after recent fix the user has to specify configuration file
even if it is present in the working directory of crossref-verify run.
That's not convenient.

Solutiion: if custom config path is not specified, first try to find
it under common filenames. When configuration file is not found anyway
we now print a warning before falling back to default config.
2019-12-05 14:15:20 +03:00
martoon
7cc2c723fb
Add CLI option for dumping config
Problem: we have moved config to `src-files`, now user needs a way to
get config.

Solution: add a CLI option.
2019-12-03 23:19:39 +03:00
martoon
0671986bcb
Make providing config optional
Problem: currently `crossref-verify` executable does not work without
configuration, and user was supposed to use one from the repository if
he does not have its own. This is very inconvenient.

Solution: make executable remember some config and use it by default.
2019-12-03 23:19:37 +03:00
martoon
0bfb25e792
Some UX improvements 2019-07-29 14:27:55 +03:00
martoon
5e31bec984
Allow disabling progress bar
In CI one most often does not want to see it because it usually
does not interpret caret return as expected.
2019-04-06 22:01:15 +03:00
martoon
3ecaf245f5
Make verbosity a CLI parameter, not config one 2019-03-13 13:30:39 +03:00
martoon
c869971f69
Make parts of verification optional
Now one can disable external refs or repo-local refs verification in CLI params.
2019-03-12 17:26:27 +03:00
martoon
444fa7349f
Add verification progress bar 2019-03-12 16:40:10 +03:00
martoon
dc14c19e45
[INT-31] Enable external references checker 2018-10-16 14:58:53 +03:00
martoon
56b4e38308
[INT-31] Add config and CLI options 2018-10-11 17:27:59 +03:00
martoon
d1ee907cfb
[INT-31] Prettify output 2018-10-11 15:40:39 +03:00
martoon
ea83f75643
[INT-31] Implement cross-references verifier 2018-10-11 02:51:28 +03:00