turboquant-rs 0.4.1

TurboQuant KV-Cache Quantization — 3-bit compression with zero accuracy loss (Zandieh et al., ICLR 2026)
Documentation
# rustqual.toml — Configuration for the rustqual code quality analyzer
#
# Place this file in your project root.
# Run `rustqual --init` to generate this file.

# ── Function Classification ──────────────────────────────────────────────

# Function names (or glob patterns) to exclude from analysis.
# Examples: "main", "test_*", "visit_*"
ignore_functions = [
    "main",
    "test_*",
    # Test / bench helpers called only from #[test] / #[bench] functions.
    # Rustqual's DEAD_CODE testonly heuristic flags these as uncalled
    # because they don't carry the #[test] attribute themselves; these
    # name patterns cover the project's documented test-helper conventions.
    "wht_*",
    "rotation_*",
    "roundtrip_*",
    "*_check",
    "*_roundtrip",
    # Test-data factories (exact names, not a glob, so that production
    # helpers like `make_quant_config` are still analysed).
    "make_kv",
    "make_q",
    "make_kv_gpu",
    "make_q_gpu",
    "make_config",
    "pqo_config",
    "cosine_sim",
    "compute_*",
    "measure_compression_ratio",
    "random_unit_vec",
    "random_normal_vec",
    "run_large_cache_e2e",
    "attend_config",
    "mse_distortion",
    "assert_codebook_valid",
    "assert_symmetric",
    "assert_in_range",
    "cuda_device",
    "drive_decode",
    "create_tq*_cache",
    "bench_*",
]

# Glob patterns for files to exclude from analysis.
# Examples: "generated/**", "tests/**"
exclude_files = []

# If true, closures count as "logic" even when passed to iterator adaptors.
# Default: false (lenient — closures inside .map()/.filter() are ignored).
strict_closures = false

# If true, iterator chains (.map, .filter, .fold, ...) count as own calls.
# Default: false.
strict_iterator_chains = false

# If true, recursive calls (function calling itself) are allowed and don't
# count as violations. Default: false.
allow_recursion = false

# If true, the ? operator counts as logic (implicit control flow).
# Default: false.
strict_error_propagation = false

# ── Suppression Health ───────────────────────────────────────────────────

# Maximum ratio of suppressed functions before a warning is emitted.
# Default: 0.05 (5%). Temporarily bumped to 0.07 until a few rustqual
# false-positive bugs are fixed (then lower back toward 0.05).
max_suppression_ratio = 0.07

# If true, exit with code 1 when warnings are present (e.g. suppression ratio exceeded).
# Default: false. Use --fail-on-warnings CLI flag to enable.
fail_on_warnings = false

# ── Complexity Analysis ──────────────────────────────────────────────────

[complexity]
enabled = true
max_cognitive = 15
max_cyclomatic = 10
include_nesting_penalty = true
detect_magic_numbers = true
allowed_magic_numbers = [
    # Small ints that appear universally in index arithmetic.
    "0", "1", "-1", "2", "3", "4", "5", "6", "7", "8", "9",
    # Low-range integers used as sequential test-seed indices in
    # many generators (each test gets a distinct deterministic seed).
    "11", "12", "13", "14", "15", "20", "21", "22", "23", "30", "31",
    "48",
    # Small floats that appear universally in arithmetic.
    "0.0", "1.0", "-1.0", "2.0", "3.0", "4.0", "0.5",
    # Standard ML head dimensions (powers of 2 from 16 up to 1024). These
    # are the conventional choices for transformer attention and appear
    # in test fixtures as self-documenting values.
    "16", "32", "64", "128", "256", "512", "1024",
    # Standard test batch / sample counts.
    "10", "100", "1000", "10000",
    "50", "1024",
    # Standard numerical tolerances used in approx::assert_abs_diff_eq
    # and statistical bias/variance bounds.
    "1e-6", "1e-8", "1e-10",
    # Common test seeds / counts that appear across many files but have no
    # semantic meaning beyond "pick a distinct deterministic value".
    "42",       # widely-used default seed
    "77",
    "12345", "54321", "99999",
    "11111", "22222", "33333", "44444", "55555", "66666",
    "7777", "8888", "9999",
    "1337",
    # Round-thousand offsets used to separate seed ranges in tests and benches.
    "2000", "3000", "4000", "5000", "6000", "7000", "8000", "9000",
]

# ── DRY / Duplicate Detection ───────────────────────────────────────────

[duplicates]
enabled = true
similarity_threshold = 0.85
min_tokens = 30
min_lines = 5
min_statements = 3
ignore_tests = true
ignore_trait_impls = true
detect_dead_code = true
detect_wildcard_imports = true
detect_repeated_matches = true

# ── Boilerplate Detection ───────────────────────────────────────────────

[boilerplate]
enabled = true
# Optional: limit to specific patterns (empty = all patterns).
# patterns = ["BP-001", "BP-003"]
suggest_crates = true

# ── SRP (Single Responsibility) ─────────────────────────────────────────

[srp]
enabled = true
smell_threshold = 0.6
max_fields = 12
max_methods = 20
max_fan_out = 10
lcom4_threshold = 2
weights = [0.4, 0.25, 0.15, 0.2]
file_length_baseline = 300
file_length_ceiling = 800
max_independent_clusters = 3
min_cluster_statements = 5
# Maximum number of parameters before a function triggers SRP-004.
max_parameters = 5

# ── Coupling Analysis ───────────────────────────────────────────────────

[coupling]
enabled = true
max_instability = 0.8
max_fan_in = 15
max_fan_out = 12
# Check Stable Dependencies Principle (stable modules should not depend on unstable ones).
check_sdp = true

# ── Test Quality Analysis ──────────────────────────────────────────────

[test]
enabled = true
# Optional: path to LCOV coverage file for TQ-004/TQ-005 checks.
# coverage_file = "lcov.info"

# ── Quality Score Weights ──────────────────────────────────────────────
# Weights for each dimension in the overall quality score.
# Must sum to approximately 1.0.

[weights]
iosp = 0.25
complexity = 0.20
dry = 0.15
srp = 0.20
coupling = 0.10
test = 0.10