| Crates.io | sca |
| lib.rs | sca |
| version | 0.3.18 |
| created_at | 2025-10-15 14:04:17.379478+00 |
| updated_at | 2025-11-19 11:02:57.168059+00 |
| description | Smells Code Analyzer rewritten in Rust |
| homepage | |
| repository | https://github.com/Artawower/smells-code-analyzer |
| max_upload_size | |
| id | 1884429 |
| size | 390,139 |
Rust implementation of the original smells-code-analyzer CLI.
The binary reproduces the TypeScript version’s behaviour: it loads the same JSON
configuration, filters candidate files, walks TypeScript syntax trees via
tree-sitter, calls the configured language server for reference counts, and
prints the familiar emoji-styled report.
sca --config-file <path> [--threshold <n>]globset/ignoreinitialize, didOpen, references, shutdowncd sca-rust
cargo build --release
./target/release/sca --config-file ../config.json
You can override the maximum number of allowed “dead” entities:
./target/release/sca --config-file ../config.json --threshold 50
To analyse a specific set of files listed in changed-files.txt (newline separated paths), use:
./target/release/sca --config-file ../config.json --files-from changed-files.txt
Paths may be absolute or relative to the list file; entries outside the analysed directory or missing on disk are skipped.
Generate a JSON snapshot of all detected errors (without emoji):
./target/release/sca --config-file ../config.json --generate-snapshot errors.json
Compare current analysis against a previous snapshot and fail with exit code if new errors are found:
./target/release/sca --config-file ../config.json --compare-snapshot errors.json
The --compare-snapshot flag will print all new errors and exit with an error if any new issues are detected.
Both snapshot flags work with --files-from to scope the analysis to a specific file list.
Important: Snapshots store file paths relative to analyzeDirectory from your config. This ensures snapshots are portable between different environments (e.g., local development vs CI), where absolute paths may differ.
Note
The language server referenced in the config (e.g.node .../typescript-language-server) must be accessible on the host machine before running the binary.
src/
main.rs # CLI entry + orchestration
config.rs # JSON config loading, validation, encoding helpers
model.rs # Shared data structures
sanitize.rs # Source pre-processing
analyzer/
mod.rs # Analyzer facade + aggregation helpers
files.rs # File discovery utilities
tree.rs # Tree-sitter traversal and node extraction
lsp.rs # Async JSON-RPC LSP client
report.rs # Emoji-styled report rendering
Logging is powered by tracing. Set RUST_LOG=debug for verbose diagnostics,
including raw LSP stderr output.
cargo fmt ensures Rustfmt compliance (already applied).cargo test runs unit coverage (sanitize and report modules today).cargo check validates the build graph (requires access to crates.io).Cargo.toml metadata (version, description, repository, readme, keywords, etc.).cargo fmt && cargo check && cargo test && cargo doc --no-deps.git tag -a vX.Y.Z -m "sca-rust vX.Y.Z").cargo publish --dry-run
cargo publish
cargo build --release
# tar/zip target/release/sca for each target triple you cross-compile
Consider using cross or GitHub Actions to produce multi-platform artefacts.