# Catch forgotten workarounds

Flag every upstream link in your files that no blocker names.

A pin nobody wrote a blocker for never shows up anywhere, so it lives forever. Give canibump a `[scan]` and it reads your files for issue, PR and MR links, then flags every one no blocker names.

`canibump.toml`

```toml
[[blocker]]
id = "libfoo-crash"
note = "drop the libfoo crash patch"
state = "github:libfoo/libfoo#412"

[scan]
paths = ["**/*.nix", "Justfile"]
exclude = ["vendor/**"]

[[scan.catcher]]
id = "jira"
pattern = 'https://jira\.example\.com/browse/(?<key>[A-Z]+-\d+)'
ref = "jira:jira.example.com#${key}"
```

`hosts/gpu.nix`

```nix
{ pkgs, ... }:

{
  # canibump:libfoo-crash
  # https://github.com/libfoo/libfoo/pull/412
  environment.systemPackages = [ (pkgs.callPackage ../pkgs/libfoo.nix { }) ];

  # Pinned until https://github.com/libbar/libbar/issues/77 is fixed.
  services.libbar.package = pkgs.libbar_2_1;

  # canibump:old-mesa-pin
  hardware.graphics.enable = true;

  # Background on the driver: https://gitlab.com/libbaz/libbaz/-/merge_requests/5 canibump-ignore
}
```

```
$ canibump
waiting   libfoo-crash  github:libfoo/libfoo#412 is open
unlisted  Justfile:1        jira:jira.example.com#OPS-12 has no blocker
unlisted  hosts/gpu.nix:8   github:libbar/libbar#77 has no blocker
unlisted  hosts/gpu.nix:11  canibump:old-mesa-pin has no blocker
```

The libfoo link belongs to a blocker, and the line marked `canibump-ignore` is just background reading. The rest want a blocker, or a delete.

## What gets read

- `paths` and `exclude` are globs relative to the manifest. `*` stays inside a directory and `**` crosses them.
- A scan never enters `.git` or a symlinked directory, so a Nix `result` link can’t drag the store in.
- An `exclude` ending in `/**` skips its directory unread.
- The manifest itself is never read, and neither is a file that isn’t UTF-8.
- A line holding `canibump-ignore` is skipped.

The scan is local and cheap, so `canibump status` runs it too. The same scan finds the [markers](https://mlavrinenko.github.io/canibump/mark-workarounds/index.md) that place each workaround.

## Catchers

A catcher is a regex run over each line, plus a `ref` template its named groups fill. The built-ins catch GitHub issues and PRs, GitLab issues and MRs, and Codeberg issues and PRs. A caught ref matches a blocker when it reads the same as the blocker’s ref in the output, case aside.

`[[scan.catcher]]` adds your own, like the Jira one above, which caught the Justfile’s link.

`Justfile`

```
# Retries the flaky upload until https://jira.example.com/browse/OPS-12 lands.
deploy:
    for i in 1 2 3; do ./upload && break; done
```

Reuse a built-in’s id to replace it, or set `enabled = false` to turn one off. The [manifest reference](https://mlavrinenko.github.io/canibump/manifest/index.md#scan) lists the built-in ids.
