inkdex docs

Query language

The syntax of inkdex q and inkdex repl: kinds, keys, values, negation.

inkdex q '<kind>? <term>*'

A query is an optional kind, then terms. A term is key:value or a flag; a - in front negates it. Terms are combined with AND.

inkdex q 'fn name:*password* -param.count:0'
inkdex q 'fn entry -auth sink:sql.* churn:>3'
inkdex q 'class extends:BaseModel fields:>10'
inkdex q 'literal class:url in:app/'
inkdex q 'dep unused -scope:dev'

An unknown key is an error that gives its position and the closest known key:

error: invalid query: at 4: unknown key `complexty`, did you mean `complexity`?

Kinds

fn, class, symbol, file, literal, route, dep, marker, fact, secret, tag. Without a kind, the query searches symbols.

Values

FormMeaningExample
glob* and ?, case-insensitivename:*login*
regexbetween slashesname:/^get_[a-z]+$/
rangea..bcomplexity:5..10
comparison>n, >=n, <n, <=nloc:>200
lista,b (any of them)lang:py,ts

Keys

AreaKeys
Naming and placename:, qname:, fq:, lang:, in: (a directory), file:
Flagsexported, test, generated, entry, auth, unsanitized, direct, unused, neutralized, orphaned
Signature and metricsparam.name:, param.type:, param.count:, returns:, complexity:, cognitive:, loc:, nesting:
Callscalls:, callee:, caller:, callers:, callees:, unresolved:
Securitysink:, source:, sanitizer:, dangerous:, crypto:, env:, category:, rule:, confidence:
Classesextends:, implements:, methods:, fields:, decorator:, attr:
Filesflag: (test, generated, vendored, minified, config, doc), imports:, imported_by:, deps:
Literalsclass:, value:, entropy:, in_fn:
Routesmethod: (GET, POST…), path:, framework:, handler:, kind:
Dependenciesversion:, scope:, manifest:
Markerskind: (TODO, FIXME…), text:, older:
Secretsprovider:
Historychanged:, since:, author:, age:, at:, churn:
Tagstag:, tag.<name>:, label:, tool:, target:

Languages for lang:: py, ts, js, rs, go, ex, java.

Output

--count prints only the number of results; --format paths prints the files of the results, one per line, for piping into other tools:

inkdex q 'fn complexity:>20' --format paths | xargs wc -l

On this page