The code check
A finding says a package you depend on has a flaw. The code check answers the next question: does our code actually use it? watchdep check runs where the code already is, searches it, and sends the server a draft verdict for each open finding. A verdict is a draft: it never changes a finding’s state. A person decides.
Where it runs
Only in the CLI, on a developer’s machine or in CI, with the part’s token. The watchdep server never reads source code, so a part connected only through GitHub shows “use not checked” until someone runs the code check where the code is.
watchdep check # with WATCHDEP_SERVER and WATCHDEP_TOKEN, as for scan
watchdep check --dry-run # print the verdicts, send nothing
watchdep check --assist # have a model draft each verdict, with your own key
watchdep check --assist --provider google --model gemini-4-argon
watchdep models --provider openai # the models --assist can use with that provider
watchdep check fetches the part’s open findings from the server, searches the folder it is run in (or the path given), and sends back the verdicts. It may report only on findings with places in its token’s part. In GitHub Actions, watchdep-action runs it with command: check; see CI.
Exit codes: 0 sent; 2 the server did not answer; 3 no token, a refused token, or a rejected result.
How it searches
It reads the source files of each package’s language (JavaScript and TypeScript, Python, Ruby, Go, Java, Kotlin and Scala, PHP, Rust, C#, Dart, Elixir), up to 1 MB each, never installed dependencies or build output; a Rakefile, Guardfile or Capfile counts as Ruby. It looks for the ways each language imports the package: require or import ... from for npm; import or from ... import by module name for Python (python-multipart is multipart, PyYAML is yaml, pycryptodome is Crypto); require for Ruby (actionpack is action_controller or action_dispatch); the module path for Go; the group id for Java; the vendor namespace for PHP; use, extern crate or a crate::path for Rust; package:name/ for Dart. Where an advisory names the affected functions, it looks for those names in the files that import the package.
When it can say “not used”
“Not used” is a strong claim, so the check makes it only when it can be sure:
- The names the package is imported by are known. For npm, Go, Rust and Dart they follow from the package name. For Python they come from the packages installed in the part’s
.venvorvenv, else from a list of known names; for Ruby from arequire:in the Gemfile, the gems installed invendor/bundle, else a list of known names. Maven, Composer, NuGet and Hex packages never get “not used”: a Java group id is often not the package it provides, and a PHP class can be used with nouseline. - Every source file of the language was searched. A file over 1 MB, one that could not be read, or one that is a symbolic link makes the verdict unclear.
- For Ruby, nothing loads the gem without naming it.
Bundler.requireloads every gem the Gemfile declares, so when the code calls it, a gem with norequireline is unclear, unless the Gemfile saysrequire: falsefor it.
Otherwise the verdict is unclear, and the reason says which of these was missing.
Verdicts
| What the search found | Verdict |
|---|---|
| Imported, and an affected function the advisory names is called | used |
| Imported, and the advisory names no affected functions | used (any use may reach the flaw) |
| Imported, the advisory names affected functions, and none appears | unclear |
| A transitive package, not imported directly | unclear (it comes in through another package, which may use it) |
A direct dependency that no searched file imports, with its import names known, every file searched and (Ruby) no Bundler.require that loads it |
not used |
| A direct dependency that no searched file imports, but one of those is missing | unclear, with the reason |
| No source files of the package’s language | unclear |
| A runtime, database or operating system package | unclear (not searched) |
Never miss. When the check cannot tell, the verdict is unclear, never not used. When a finding has places in several files of the part, the loudest verdict stands.
Evidence
Each verdict comes with a one-paragraph reason and its evidence as path:line with a short note, for example config.ru:4, imports rack. On the server:
- Each verdict is stored with the part, the token, the commit, and whether it was assisted (and by which model).
- The log records it, for example “Code check in api: used in our code (assisted). A draft: a person decides”, by “CLI (token api-ci)”.
- The finding page’s Code check shows, per part, the latest verdict, its reason and its evidence (with the lines around it when snippets are allowed).
- Finding rows say “Used in our code” (red), “Not used, per code check” (blue) or “Use unclear, per code check” (deep orange).
- Marking a finding not affected keeps the latest code check evidence with the decision in the log. See Decisions.
The assisted check
With --assist, a model reads the search’s evidence and drafts each verdict and reason. It is called from your machine with your own key, from the provider you choose:
--provider |
Key | Default --model |
|---|---|---|
anthropic |
ANTHROPIC_API_KEY, or your Anthropic login |
claude-opus-5-5 |
google |
GEMINI_API_KEY |
gemini-4-carbon |
openai |
OPENAI_API_KEY |
none: name one (watchdep models --provider openai lists them) |
Without --provider, the first key set, in that order, chooses. The watchdep server never holds or sees the key.
The assistant may sharpen the verdict and the reason, but it may never turn a use the search found into “not used”: that becomes unclear. A refusal, an error or an answer that cannot be read keeps the search’s verdict and says why.
What leaves your machine
| Goes to | What | When |
|---|---|---|
| Your watchdep server | the verdict, the reason, and the evidence as file paths and line numbers with a short note | always |
| Your watchdep server | a few lines of code around each piece of evidence, stored and shown on the finding page | only when the workspace owner switched on “Code check snippets” (Settings, Workspace; off by default) |
| the provider you chose, from your machine, with your key | for each finding: the advisory id and summary, the package and version, the affected function names, the evidence with the lines around it, and the search’s draft verdict | only with --assist |
Never sent: whole files, your installed dependencies (they are not even read), and your provider key to the watchdep server. Without snippets switched on and without --assist, no line of your code leaves the machine. watchdep check --dry-run prints the verdicts and evidence and sends nothing to the server (with --assist as well, the model is still asked).