| Crates.io | bullshitdetector |
| lib.rs | bullshitdetector |
| version | 0.1.0 |
| created_at | 2025-11-17 23:28:34.589283+00 |
| updated_at | 2025-11-17 23:28:34.589283+00 |
| description | Blazing-fast pattern detector for magic numbers, hardcoded values, and code smells using regex and golden-ratio math |
| homepage | https://github.com/Ruffian-L/niodoo-tcs |
| repository | https://github.com/Ruffian-L/niodoo-tcs |
| max_upload_size | |
| id | 1937671 |
| size | 237,719 |
Blazing-fast static analysis tool for detecting magic numbers, hardcoded values, and code smells in Rust (and other languages).
cargo install bullshitdetector
[dependencies]
bullshitdetector = "0.1"
bullshitdetector scan-magic ./src
bullshitdetector scan ./src --output report.json
use bullshitdetector::{DetectConfig, scan_code};
let code = r#"
if confidence > 0.85 { // β οΈ Magic number!
do_something();
}
"#;
let config = DetectConfig::default();
let alerts = scan_code(code, &config)?;
for alert in alerts {
println!("Found {} at line {}", alert.issue_type, alert.location.0);
}
| Pattern | Example | Severity |
|---|---|---|
| Magic Numbers | if x > 0.85 |
π΄ Critical |
| Hardcoded Timeouts | Duration::from_secs(30) |
π High |
| Arc/RwLock Abuse | Arc<RwLock<HashMap<...>>> |
π‘ Medium |
| Unwrap Abuse | .unwrap() chains |
π‘ Medium |
| Sleep Abuse | std::thread::sleep in async |
π‘ Medium |
π΄ CRITICAL: Hardcoded Threshold
File: src/pipeline/stages.rs:231
Code: if knot > 0.4
Suggestion: Move to PipelineConfig::knot_threshold
π‘ MEDIUM: Magic Number Assignment
File: src/detection.rs:145
Code: let base_top_p = 0.35;
Suggestion: Extract to constant or config
Create a .bullshitdetector.toml:
[detect]
confidence_threshold = 0.618 # Golden ratio inverse
max_snippet_length = 500
enable_regex_fallback = true
[scan]
exclude_patterns = ["**/test/**", "**/tests/**"]
include_extensions = ["rs", "py", "js"]
use bullshitdetector::{DetectConfig, BullshitType};
let mut config = DetectConfig::default();
config.enable_tree_sitter = false; // Regex only for speed
config.confidence_threshold = 0.7; // Adjust sensitivity
let alerts = scan_code(code, &config)?;
#!/bin/bash
# Pre-commit hook
./bullshitdetector scan-magic src | grep -q "CRITICAL" && exit 1
Full documentation available at docs.rs/bullshitdetector
Contributions welcome! The detector is designed to be extended with new patterns.
BullshitType enum in src/lib.rssrc/detect.rsMIT License - Copyright (c) 2025 Jason Van Pham (ruffian-l on GitHub) @ The Niodoo Collaborative
Who you gonna call? π» BULLSHITBUSTERS!