Skip to main content

big-code-analysis-cli

bca analyzes source code and emits per-file structured metrics, aggregated reports, AST dumps, node lookups, and more.

Migrating from the flag-style CLI? The CLI is now subcommand-driven. See the migration guide for old-form -> new-form mappings of every flag.

Installation

From PyPI (pip)

The fastest path on Linux, macOS, and Windows — no Rust toolchain required:

pip install big-code-analysis-cli   # installs the `bca` command on PATH
bca --version

Note the deliberate split between the distribution name and the command name: you pip install big-code-analysis-cli, but the installed executable is bca. The bca name on PyPI belongs to an unrelated project, and big-code-analysis is this project's importable library bindings (pip install big-code-analysis — a different deliverable). The wheel ships the full all-languages grammar set; a single py3-none-<platform> wheel covers every CPython 3.x (and PyPy) on that platform. Prebuilt wheels are published for Linux (manylinux_2_28 x86_64 / aarch64), macOS (x86_64 / arm64), and Windows (x86_64); other platforms fall back to a source build.

From crates.io (cargo)

cargo install big-code-analysis-cli

From source

cd big-code-analysis-cli/
cargo build --release

Usage

bca [OPTIONS] <COMMAND> [COMMAND OPTIONS]

The command picks what to do; its options describe both what to walk (paths, includes/excludes, parallelism, language overrides) and how to format the result. Input-selection and walker-tuning flags are scoped to the subcommand that consumes them and must be written after the subcommand token — only -w / --warnings and --report-skipped are universal and accepted in any position.

Commands

Command Purpose
metrics Per-file metric output (-O cbor/csv/json/toml/yaml, --output-dir DIR).
ops Per-file operand/operator output (same formats as metrics).
report <FORMAT> Aggregated report (markdown or html).
check Check per-function metrics against thresholds; exits 2 on threshold violations.
dump AST dump to stdout (--line-start/--line-end to scope a range).
find <NODE>... Find nodes of one or more types (--line-start/--line-end to scope a range).
count <NODE>... Count nodes of one or more types.
functions List functions/methods and their spans.
strip-comments Remove comments from source files (--in-place).
preproc Build preprocessor-data JSON for C/C++ analysis.
list-metrics [names|descriptions] List computable metrics.

Run bca <COMMAND> --help for command-specific options.

Walking options

These input-selection and walker-tuning flags are accepted by the walking subcommands (metrics, ops, report, check, dump, find, count, functions, strip-comments) and must be written after the subcommand. A flag passed to a subcommand that never consumes it is a hard usage error (exit 1), not a silent no-op.

  • -p, --paths <FILE>... — input files or directories. The walking subcommands also accept paths positionally (bca metrics src/).
  • -I, --include <GLOB> — include files matching pattern (repeatable).
  • -X, --exclude <GLOB> — exclude files matching pattern (repeatable).
  • -j, --jobs <N> — worker threads (--num-jobs is a deprecated alias).
  • -l, --language <LANG> — force a language instead of inferring. Accepts a language name (rust) or extension (rs); unknown values error out.
  • -w, --warnings — print warnings (skipped files, unrecognized languages). --warning is a deprecated alias.
  • --no-skip-generated — disable auto-skip of files marked as generated (see Skipping generated code).
  • --report-skipped — log a skipped (generated): <path> line to stderr for every file the generated-code detector excludes.
  • --preproc-data <FILE> — consume an existing preproc JSON during C/C++ analysis. Build one with bca preproc.

-w / --warnings and --report-skipped are the only universal options; they are accepted in any position, before or after the subcommand.

Building with a subset of languages

The shipped bca binary compiles every supported tree-sitter grammar in. The big-code-analysis-cli crate pins the library's all-languages feature set explicitly, so passing --no-default-features or a custom --features list to cargo build -p big-code-analysis-cli does not drop grammars from the resulting binary — feature selection on the CLI crate is not honoured (see #252 for the rationale: dropping a grammar silently from a user-facing binary would surface as "language X stopped working" rather than a build error).

Consumers who need a reduced feature set should embed the big-code-analysis library in their own Rust code and control feature selection in their own Cargo.toml. See the library's per-language Cargo features chapter for the full list of features and a worked example.

Examples

Per-file JSON metrics:

bca metrics --paths ./src -O json --output-dir ./out/

Aggregated markdown quality report:

bca report markdown --paths "$PWD" --jobs $(nproc) \
    --top 20 --strip-prefix "$PWD/"

AST dump for one file:

bca dump ./file.rs

List all metrics with one-line descriptions:

bca list-metrics descriptions

Skipping generated code

Generated bindings (protobuf stubs, OpenAPI clients, lex/yacc output, build-system plumbing) inflate metrics for code no human will refactor. By default, bca scans the first ~50 lines / 5 KiB of each file for a generated-code marker and skips matches before parsing.

Recognized markers (case-insensitive):

  • @generated — Facebook / Meta convention; also emitted by buck2, rustfmt, prettier, and many code generators.
  • DO NOT EDIT — Go's // Code generated by … DO NOT EDIT. is the canonical form; the bare phrase is also widely copied (Bazel, protoc, OpenAPI clients).
  • GENERATED CODE — Lizard's marker, recognized for compatibility.

A marker phrase that appears only deep in the file body (past the scan window) does not trigger the skip.

To restore the previous behavior and analyze everything, pass --no-skip-generated. To audit which files were excluded, pass --report-skipped; the CLI logs skipped (generated): <path> to stderr for each file.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

big_code_analysis_cli-2.0.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

big_code_analysis_cli-2.0.0-py3-none-win_amd64.whl (8.0 MB view details)

Uploaded Python 3Windows x86-64

big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_x86_64.whl (7.9 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_aarch64.whl (7.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

big_code_analysis_cli-2.0.0-py3-none-macosx_11_0_arm64.whl (7.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

big_code_analysis_cli-2.0.0-py3-none-macosx_10_12_x86_64.whl (7.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file big_code_analysis_cli-2.0.0.tar.gz.

File metadata

  • Download URL: big_code_analysis_cli-2.0.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for big_code_analysis_cli-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ec476fda87590a0891bb9e2f20df95a4cc933bf9e0a6412a5579b2d94b10124e
MD5 df0a7a6a330609e845d40ac40c690834
BLAKE2b-256 54efc07e84d749d2b5d8785d484bdb091c8f98d64853e218fbdd7adfee922ea1

See more details on using hashes here.

Provenance

The following attestation bundles were made for big_code_analysis_cli-2.0.0.tar.gz:

Publisher: python-cli-wheels.yml on dekobon/big-code-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file big_code_analysis_cli-2.0.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for big_code_analysis_cli-2.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0690abf60d31f85a6e3baefff1a9914b4406079f948d9c16a325831765266c90
MD5 1aa45d629a335b7b2834fcdd1496d6f7
BLAKE2b-256 4e9d62b69f6c741ad1a2953f26c0fc161f16c34e2635e951741a6340a1013191

See more details on using hashes here.

Provenance

The following attestation bundles were made for big_code_analysis_cli-2.0.0-py3-none-win_amd64.whl:

Publisher: python-cli-wheels.yml on dekobon/big-code-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 62316880b772e2be633dccb27773f3bd42b2915376d50f021dd01e38c0405a52
MD5 cf0ec12f475c8d74700b115995e61de1
BLAKE2b-256 52f57d6d60247fc46802b5f14054f6727891e7e0655bb23b92167a7caf33d407

See more details on using hashes here.

Provenance

The following attestation bundles were made for big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: python-cli-wheels.yml on dekobon/big-code-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 336b2296913a4f6225c032adfbf0235d508fc86b54803b0bd8119e12fa781928
MD5 30d144c11b4303ab2b7fc666ace0ea5d
BLAKE2b-256 8f48f67b9c2e734d2d03e3b059190da47e8bcde2ff7ef56563792b61cb0c3ea7

See more details on using hashes here.

Provenance

The following attestation bundles were made for big_code_analysis_cli-2.0.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: python-cli-wheels.yml on dekobon/big-code-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file big_code_analysis_cli-2.0.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for big_code_analysis_cli-2.0.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 625d842fed260214d09f1654183b11152c208a7b5b232c64b5034f95c8b4e22d
MD5 a45c48bb56fd6f4c6932492d166e61b2
BLAKE2b-256 c407847522d9788d2a422c0e62f65be73ed7561049dcdd1a55c85bfa1b94c79e

See more details on using hashes here.

Provenance

The following attestation bundles were made for big_code_analysis_cli-2.0.0-py3-none-macosx_11_0_arm64.whl:

Publisher: python-cli-wheels.yml on dekobon/big-code-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file big_code_analysis_cli-2.0.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for big_code_analysis_cli-2.0.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8168fd976275cff30b5a462dd99ba48da1d9849ec4a18311f0d18b7cf1f46bf1
MD5 69a5476c56ef91e62e783a93598525d4
BLAKE2b-256 9fca03bf73609b60d727e3d964b8ccda95ac502f733f0bb9de100dbea26ad119

See more details on using hashes here.

Provenance

The following attestation bundles were made for big_code_analysis_cli-2.0.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: python-cli-wheels.yml on dekobon/big-code-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.1.0

6 files

This release

2.0.0 This release

6 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page