big-code-analysis-cli 2.3.1__py3-none-win_amd64.whl → 2.5.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- big_code_analysis_cli-2.5.0.data/scripts/bca.exe +4 -0
- big_code_analysis_cli-2.5.0.dist-info/METADATA +208 -0
- big_code_analysis_cli-2.5.0.dist-info/RECORD +26 -0
- {big_code_analysis_cli-2.3.1.dist-info → big_code_analysis_cli-2.5.0.dist-info}/WHEEL +1 -1
- {big_code_analysis_cli-2.3.1.dist-info → big_code_analysis_cli-2.5.0.dist-info}/licenses/THIRD-PARTY-LICENSES-bca.md +292 -529
- {big_code_analysis_cli-2.3.1.dist-info → big_code_analysis_cli-2.5.0.dist-info}/sboms/big-code-analysis-cli.cyclonedx.json +1518 -1375
- man/bca-check.1 +25 -12
- man/bca-count.1 +16 -3
- man/bca-diff-baseline.1 +1 -1
- man/bca-diff.1 +20 -7
- man/bca-dump.1 +15 -2
- man/bca-exemptions.1 +15 -2
- man/bca-find.1 +16 -3
- man/bca-functions.1 +15 -2
- man/bca-init.1 +15 -2
- man/bca-list-metrics.1 +1 -1
- man/bca-metrics.1 +16 -3
- man/bca-ops.1 +15 -2
- man/bca-preproc.1 +15 -2
- man/bca-report.1 +15 -2
- man/bca-strip-comments.1 +15 -2
- man/bca-vcs-commit.1 +1 -1
- man/bca-vcs-trend.1 +1 -1
- man/bca-vcs.1 +15 -2
- man/bca.1 +5 -5
- big_code_analysis_cli-2.3.1.data/scripts/bca.exe +0 -4
- big_code_analysis_cli-2.3.1.dist-info/METADATA +0 -195
- big_code_analysis_cli-2.3.1.dist-info/RECORD +0 -26
- {big_code_analysis_cli-2.3.1.dist-info → big_code_analysis_cli-2.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: big-code-analysis-cli
|
|
3
|
+
Version: 2.5.0
|
|
4
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Programming Language :: Rust
|
|
8
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
9
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: THIRD-PARTY-LICENSES-bca.md
|
|
12
|
+
Summary: The bca command-line tool: compute and export code metrics for many languages
|
|
13
|
+
Keywords: metrics,tree-sitter,static-analysis,cli
|
|
14
|
+
Author-email: Calixte Denizet <cdenizet@mozilla.com>, Elijah Zupancic <elijah@zupancic.name>
|
|
15
|
+
License-Expression: MPL-2.0
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
|
+
Project-URL: Documentation, https://dekobon.github.io/big-code-analysis/
|
|
19
|
+
Project-URL: Repository, https://github.com/dekobon/big-code-analysis
|
|
20
|
+
|
|
21
|
+
# big-code-analysis-cli
|
|
22
|
+
|
|
23
|
+
`bca` is the command-line front end for the
|
|
24
|
+
[big-code-analysis](https://crates.io/crates/big-code-analysis) library.
|
|
25
|
+
It analyzes source code and emits per-file structured metrics,
|
|
26
|
+
aggregated reports, threshold checks, AST dumps, and node lookups. The
|
|
27
|
+
full reference is the
|
|
28
|
+
[user guide](https://dekobon.github.io/big-code-analysis/commands/index.html).
|
|
29
|
+
|
|
30
|
+
> **Migrating from the flag-style CLI?** The CLI is now subcommand-driven.
|
|
31
|
+
> See the [migration guide](../big-code-analysis-book/src/migration.md)
|
|
32
|
+
> for old-form -> new-form mappings of every flag.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
### From [PyPI](https://pypi.org/) (pip)
|
|
37
|
+
|
|
38
|
+
Install a prebuilt wheel on Linux, macOS, or Windows without a Rust
|
|
39
|
+
toolchain:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
pip install big-code-analysis-cli # installs the `bca` command on PATH
|
|
43
|
+
bca --version
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The [distribution name](https://pypi.org/project/big-code-analysis-cli/)
|
|
47
|
+
and the command name differ on purpose: you
|
|
48
|
+
`pip install big-code-analysis-cli`, but the installed executable is
|
|
49
|
+
`bca`. The `bca` name on PyPI belongs to an unrelated project, and
|
|
50
|
+
`big-code-analysis` is this project's importable *library* bindings
|
|
51
|
+
(`pip install big-code-analysis`), a different deliverable.
|
|
52
|
+
|
|
53
|
+
The wheel ships the full `all-languages` grammar set. A single
|
|
54
|
+
`py3-none-<platform>` wheel covers every CPython 3.x (and PyPy) on that
|
|
55
|
+
platform. Prebuilt wheels are published for Linux (`manylinux_2_28`
|
|
56
|
+
`x86_64` / `aarch64`), macOS (`x86_64` / `arm64`), and Windows
|
|
57
|
+
(`x86_64`); other platforms fall back to a source build.
|
|
58
|
+
|
|
59
|
+
### From crates.io ([Cargo](https://doc.rust-lang.org/cargo/))
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
cargo install big-code-analysis-cli
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### From source
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
cd big-code-analysis-cli/
|
|
69
|
+
cargo build --release
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
bca [OPTIONS] <COMMAND> [COMMAND OPTIONS]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The command picks *what to do*; its options describe *what to walk*
|
|
79
|
+
(paths, includes and excludes, parallelism, language overrides) and how
|
|
80
|
+
to format the result. Input-selection and walker-tuning flags are
|
|
81
|
+
**scoped to the subcommand that consumes them** and must be written
|
|
82
|
+
**after** the subcommand token. Only `-w` / `--warnings` and
|
|
83
|
+
`--report-skipped` are universal and accepted in any position.
|
|
84
|
+
|
|
85
|
+
## Commands
|
|
86
|
+
|
|
87
|
+
| Command | Purpose |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| `metrics` | Per-file metric output (`-O cbor/csv/json/toml/yaml`, `--output-dir DIR`). |
|
|
90
|
+
| `ops` | Per-file operand/operator output (same formats as `metrics`). |
|
|
91
|
+
| `report <FORMAT>` | Aggregated report (`markdown` or `html`). |
|
|
92
|
+
| `check` | Check per-function metrics against thresholds; exits 2 on threshold violations. |
|
|
93
|
+
| `dump` | AST dump to stdout (`--line-start`/`--line-end` to scope a range). |
|
|
94
|
+
| `find -t <NODE>...` | Find nodes of one or more types, one `-t`/`--type` per type (`--line-start`/`--line-end` to scope a range). |
|
|
95
|
+
| `count -t <NODE>...` | Count nodes of one or more types, one `-t`/`--type` per type. |
|
|
96
|
+
| `functions` | List functions/methods and their spans. |
|
|
97
|
+
| `strip-comments` | Remove comments from source files (`--in-place` or `--output FILE`). |
|
|
98
|
+
| `preproc` | Build preprocessor-data JSON for C/C++ analysis. |
|
|
99
|
+
| `list-metrics [names\|descriptions]` | List computable metrics. |
|
|
100
|
+
| `vcs [commit\|trend]` | Rank files by change-history risk; score one commit; sample a trend. |
|
|
101
|
+
| `init` | Scaffold `bca.toml`, `.bcaignore`, and `.bca-baseline.toml`. |
|
|
102
|
+
| `diff` | Compare two metric-output runs (or `--since <ref>` against the working tree). |
|
|
103
|
+
| `diff-baseline` | Diff two `.bca-baseline.toml` files. |
|
|
104
|
+
| `exemptions` | List everything the `check` gate skips: markers, `[check.exclude]` globs, baseline entries. |
|
|
105
|
+
|
|
106
|
+
Run `bca <COMMAND> --help` for command-specific options.
|
|
107
|
+
|
|
108
|
+
## Walking options
|
|
109
|
+
|
|
110
|
+
The walking subcommands (`metrics`, `ops`, `report`, `check`, `dump`,
|
|
111
|
+
`find`, `count`, `functions`, `strip-comments`, `preproc`, `exemptions`,
|
|
112
|
+
`init`, `diff`, and the bare `vcs` ranking) accept these input-selection
|
|
113
|
+
and walker-tuning flags, written **after** the subcommand. A flag passed
|
|
114
|
+
to a subcommand that never consumes it is a hard usage error (exit 1),
|
|
115
|
+
not a silent no-op.
|
|
116
|
+
|
|
117
|
+
- `-p, --paths <FILE>...`: input files or directories. Most walking
|
|
118
|
+
subcommands also accept paths positionally (`bca metrics src/`); the
|
|
119
|
+
exceptions are `report`, `vcs`, and `init` (`--paths` only; `init`
|
|
120
|
+
scaffolds into `--dir`) and `diff` (its positionals are the two
|
|
121
|
+
result sets).
|
|
122
|
+
- `-I, --include <GLOB>`: include files matching pattern (repeatable).
|
|
123
|
+
- `-X, --exclude <GLOB>`: exclude files matching pattern (repeatable).
|
|
124
|
+
- `-j, --jobs <N|auto>`: worker threads; the default `auto` uses the
|
|
125
|
+
effective CPU count (`--num-jobs` is a deprecated alias).
|
|
126
|
+
- `-l, --language <LANG>`: force a language instead of inferring. Accepts
|
|
127
|
+
a language name (`rust`) or extension (`rs`); unknown values error out.
|
|
128
|
+
- `-w, --warnings`: print warnings (skipped files, unrecognized
|
|
129
|
+
languages). `--warning` is a deprecated alias.
|
|
130
|
+
- `--no-skip-generated`: disable auto-skip of files marked as generated
|
|
131
|
+
(see [Skipping generated code](#skipping-generated-code)).
|
|
132
|
+
- `--report-skipped`: log a `skipped (generated): <path>` line to stderr
|
|
133
|
+
for every file the generated-code detector excludes.
|
|
134
|
+
- `--preproc-data <FILE>`: consume an existing preproc JSON during C/C++
|
|
135
|
+
analysis. Build one with `bca preproc`.
|
|
136
|
+
|
|
137
|
+
`-w` / `--warnings` and `--report-skipped` are the only universal options;
|
|
138
|
+
they are accepted in any position, before or after the subcommand.
|
|
139
|
+
|
|
140
|
+
## Building with a subset of languages
|
|
141
|
+
|
|
142
|
+
The shipped `bca` binary compiles in every supported
|
|
143
|
+
[tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar. The
|
|
144
|
+
`big-code-analysis-cli` crate pins the library's `all-languages` feature
|
|
145
|
+
set explicitly, so passing `--no-default-features` or a custom
|
|
146
|
+
`--features` list to `cargo build -p big-code-analysis-cli` does **not**
|
|
147
|
+
drop grammars from the resulting binary. Feature selection on the CLI
|
|
148
|
+
crate is not honoured: dropping a grammar silently from a user-facing
|
|
149
|
+
binary would surface as "language X stopped working" rather than as a
|
|
150
|
+
build error ([#252][issue-252]).
|
|
151
|
+
|
|
152
|
+
To ship a reduced grammar set, embed the `big-code-analysis` library in
|
|
153
|
+
your own Rust code and select features in your own `Cargo.toml`. The
|
|
154
|
+
library's [per-language Cargo features][cargo-features] chapter lists
|
|
155
|
+
the features and gives a worked example.
|
|
156
|
+
|
|
157
|
+
[cargo-features]: https://dekobon.github.io/big-code-analysis/library/cargo-features.html
|
|
158
|
+
[issue-252]: https://github.com/dekobon/big-code-analysis/issues/252
|
|
159
|
+
|
|
160
|
+
## Examples
|
|
161
|
+
|
|
162
|
+
Per-file JSON metrics:
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
bca metrics --paths ./src -O json --output-dir ./out/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Aggregated markdown quality report:
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
bca report --format markdown --paths "$PWD" --jobs $(nproc) \
|
|
172
|
+
--top 20 --strip-prefix "$PWD/"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
AST dump for one file:
|
|
176
|
+
|
|
177
|
+
```sh
|
|
178
|
+
bca dump ./file.rs
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
List all metrics with one-line descriptions:
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
bca list-metrics descriptions
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Skipping generated code
|
|
188
|
+
|
|
189
|
+
Generated files inflate metrics for code no human will refactor. By
|
|
190
|
+
default, `bca` scans the first ~50 lines / 5 KiB of each file for a
|
|
191
|
+
generated-code marker and skips matches before parsing.
|
|
192
|
+
|
|
193
|
+
Recognized markers (case-insensitive):
|
|
194
|
+
|
|
195
|
+
- `@generated`: a marker emitted by code generators.
|
|
196
|
+
- `DO NOT EDIT`: a marker used by
|
|
197
|
+
[Go's generated-code convention](https://go.dev/s/generatedcode) and
|
|
198
|
+
other generators.
|
|
199
|
+
- `GENERATED CODE`: [Lizard](https://github.com/terryyin/lizard)'s
|
|
200
|
+
marker, recognized for compatibility.
|
|
201
|
+
|
|
202
|
+
A marker phrase that appears only deep in the file body (past the scan
|
|
203
|
+
window) does not trigger the skip.
|
|
204
|
+
|
|
205
|
+
To analyze everything, pass `--no-skip-generated`. To audit which files
|
|
206
|
+
were excluded, pass `--report-skipped`; the CLI logs
|
|
207
|
+
`skipped (generated): <path>` to stderr for each file.
|
|
208
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
big_code_analysis_cli-2.5.0.data/scripts/bca.exe,sha256=I6p7Ql1UGy1lJIjK6LSvKargJt3LORTN8x4i2tIx4Do,52457472
|
|
2
|
+
big_code_analysis_cli-2.5.0.dist-info/METADATA,sha256=eDoRuGq7z7VjHWaaCT_534aT4Gry_eRF_1J4aI1r7Rw,8720
|
|
3
|
+
big_code_analysis_cli-2.5.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
|
|
4
|
+
big_code_analysis_cli-2.5.0.dist-info/licenses/LICENSE,sha256=gjTyRor408X6Rv63kxZP8iZMcQsu9-U3r0PiBY2SCg0,15934
|
|
5
|
+
big_code_analysis_cli-2.5.0.dist-info/licenses/THIRD-PARTY-LICENSES-bca.md,sha256=0nhCpc58hGjVfH2LKEweUBpBp5tPu9QaqQMl-q2ngWQ,282738
|
|
6
|
+
big_code_analysis_cli-2.5.0.dist-info/sboms/big-code-analysis-cli.cyclonedx.json,sha256=Fw38x-AcTRP0iLDDgLExHYMdPnt3nBO35XgUMlvRD5k,297145
|
|
7
|
+
man/bca-check.1,sha256=35G3AW2cdo9Pt_xrhPWuJ9bgdpLOw8XVJcU4ozoOm_o,26302
|
|
8
|
+
man/bca-count.1,sha256=QyBozu982ZwPd3tQsXTtwrpeEVAI03fdHVZz2RGKGb4,8897
|
|
9
|
+
man/bca-diff-baseline.1,sha256=4C3nKQoK5CM3WGvrxkir-aMb-QD67129aMbEqtR5HHg,3184
|
|
10
|
+
man/bca-diff.1,sha256=qiaN1MVW-aJbq7TQNCaEVImFxILEyqH3f7tYVgyihbs,12948
|
|
11
|
+
man/bca-dump.1,sha256=iVcpAz8mJP1-OJVyjaQVukj8d4gGsB34ATYw9SZjpYU,10036
|
|
12
|
+
man/bca-exemptions.1,sha256=UfgNlDTW0NKtBHOGtu_HpRlkFc6CWkhhFuzW9kkKQe0,10881
|
|
13
|
+
man/bca-find.1,sha256=qj0rwIgB9gcKocrSx05_SqO5b0Jdy-f3SUme19yZbo0,9928
|
|
14
|
+
man/bca-functions.1,sha256=ddE3Iy85TYWNOG47LMl2DiHm0nvC1cK-TzCjaOhCiWg,9260
|
|
15
|
+
man/bca-init.1,sha256=TB9icbQ7QTdo7xWtJrFjcwrlGSbUFQbJG1XNejpVaaM,9392
|
|
16
|
+
man/bca-list-metrics.1,sha256=KZutNHGIMqZa_mK2VCZQ7rLIUrbaFqO9-j2lDKFcDXE,1192
|
|
17
|
+
man/bca-metrics.1,sha256=TgcZZuo5E_2cSp398v0C6mTICwBJD4AEcR6Kp08YCqQ,12896
|
|
18
|
+
man/bca-ops.1,sha256=7CJuSFOY_D94i1Az_QB5jivfwt1L71AIq7dRUpffOg0,11223
|
|
19
|
+
man/bca-preproc.1,sha256=gbb1grer3Neuq88Zv6uMF2E6CPjtQHf4dAE10ITtFgo,8414
|
|
20
|
+
man/bca-report.1,sha256=KSLKQxAZSpPCfiFRdHjQ7CHTC5MRTIjffC1TOFPVfEA,10079
|
|
21
|
+
man/bca-strip-comments.1,sha256=lD92OFnk83WlgUD9kGheZUmW_RFIn8G-w8vKPFY9iMI,9006
|
|
22
|
+
man/bca-vcs-commit.1,sha256=ln3EBivoZfM40sRD8j360jViFgcdB10hdkORhh9VQcU,5250
|
|
23
|
+
man/bca-vcs-trend.1,sha256=8kQ8SG1kqw7pGLYuLGQuAaAO116hwUQ-_v3yI5vuCbY,4642
|
|
24
|
+
man/bca-vcs.1,sha256=X6tP68VrnHVyqyTHluIOAV9QWi8gdZZFqNpy6Z8dqpI,14692
|
|
25
|
+
man/bca.1,sha256=tT3Yalv9VWiSdjMCh0RHyPhybKJj-mH88GN1IFOf6kY,5052
|
|
26
|
+
big_code_analysis_cli-2.5.0.dist-info/RECORD,,
|