krank

Krank checks issue tracker link status in your source code

https://github.com/guibou/krank

LTS Haskell 21.25:0.3.0
Stackage Nightly 2023-06-21:0.3.0
Latest on Hackage:0.3.0

See all snapshots krank appears in

BSD-3-Clause licensed by Guillaume Bouchard
Maintained by [email protected]
This version can be pinned in stack with:krank-0.3.0@sha256:d2c3f5681b74403d4e748f09e3a99b910a06fd709d007041a1db12cbf4ae87b3,3331

Krank

Hackage

Krank checks your code source comments for link to issue trackers, such as gitlab or github.

Krank will then outputs a report of the status of theses issues, if they are closed or still open.

Why

You are blocked on upstream ticket, there you write a nice comment in your code such as:

# blocked on upstream ticket https//github.com/Foo/Bar/issues/1234
# This workaround should be removed once the upstream ticket is closed
if workaround:
  pass

And, this stays in your codebase for the next ten years, even if the upstream issue is closed.

Now you can run krank on your codebase, and it will tells you that issue #1234 in project Foo/Bar has been closed. Time to remove your workaround.

Usage

Just launch the krank command, optionally with a list of files as arguments. It works on any kind of source code file and prints a report of informations found in the comments:

$ krank

default.nix:20:20: info:
  still Open: https://github.com/NixOS/nix/issues/2733

foo.hs:67:11: error:
  now Closed: https://github.com/bazelbuild/bazel/issues/6313

krank will fail (i.e. non-zero exit code) in case of any error.

Here krank is telling us that our source code links to github issues which are now closed. Time to remove some workarounds now that upstream issues are fixed!

You can check krank --help for a list of options, such as configuring your API token for external services, such as github and gitlab.

Specific documentation

IssueTracker is listing Github and Gitlab issue linked in comment. Issues which are still Open will be listed as info and Closed issues are listed as error. Convenient to know when to remove workarounds.

Red herring

If you want to ignore all krank checkers on a given line of code, add krank:ignore-line on this same line. Krank will then skip this line and not report anything on it

Misc

Changes

Revision history for krank

0.2.3 – 2021-07-18

  • #88 krank tries to test files listed by git ls-files or find by default.
  • #89 support NO_COLOR. https://no-color.org/.
  • README is rebranded so it is obvious that krank checks for issue tracker / PR links.

0.2.2 – 2020-06-30

  • #84 fix build with unordered-containers 0.2.11.0
  • #81, new --version command line argument

0.2.1 – 2020-05-02

  • #76 fix. ignore space in URL
  • Output now includes the issue title.

0.2.0 – 2020-04-19

  • GHC 8.10 support
  • Output is more compact and more detailed.
  • Output is now colored (can be disabled with --no-colors).
  • Gitlab support. See --issuetracker-gitlabhost for host / api key pairs.
  • Huge performance improvement. Parsing a huge codebase should only be a matter of a few seconds.
  • Parallel request execution. Requests to the issue tracker host are not sequential anymore. This can dramatically reduce the runtime.
  • Ignore line. Add krank:ignore-line in your comments and the associated closed issue won’t be seen as an error anymore.
  • Failure mode: krank will return non 0 exit code if an issue is closed (an not ignored).

0.1.0.0 – 2019-10-21

  • First version. Released on an unsuspecting world.
  • Support for Github issues tracking