Skip to content

Fix/bugfixes and code quality - #3

Merged
harkaranbrar7 merged 2 commits into
mainfrom
fix/bugfixes-and-code-quality
May 17, 2026
Merged

harkaranbrar7 merged 2 commits into
mainfrom
fix/bugfixes-and-code-quality

Conversation

@harkaranbrar7

Copy link
Copy Markdown
Contributor

Summary

Fixes 6 critical bugs and applies comprehensive code quality improvements following Rust best practices.

Bug Fixes

  • files command ignoring CLI paths — was always scanning cwd regardless of user input
  • CStyleClassifier misclassifying inline /* */ comments — lines like int x = 1; /* comment */ were counted as Comment instead of Pure
  • PythonClassifier misclassifying triple-quotes with trailing code — """docstring""" x = 1 was counted as Docstring
  • CI+JSON mode breaking parsers — summary line appended after JSON output
  • JSON serialization errors silently swallowed — if let Ok(json) dropped failures
  • Threshold aggregation missing fields — only summed 6 of 12 LangStats fields, skewing noise ratio

Code Quality

  • Replace std::process::exit() with Result<ExitCode> pattern
  • Extract aggregate_stats() to eliminate duplicate aggregation logic
  • Apply all clippy fixes: uninlined format args, #[must_use], const fn, wildcard imports, cast safety, let-else patterns
  • Add Rust, YAML, TOML language detection; Dockerfile/Makefile → Shell

Validation

  • 5/5 tests pass
  • cargo clippy — zero warnings
  • cargo fmt — clean
  • Verified against real git diffs and file scans

…uage detection

- Fix files command ignoring user-provided CLI paths (was always scanning cwd)
- Fix CStyleClassifier misclassifying inline /* */ comments as pure Comment
- Fix PythonClassifier misclassifying triple-quotes with trailing code as Docstring
- Add Rust (.rs), YAML (.yml/.yaml), TOML (.toml) language detection
- Map Dockerfile/Makefile to Shell language classification
- Remove unimplemented History command stub from CLI
…ly code quality fixes

- Replace std::process::exit() with Result<ExitCode> pattern in main()
- Extract aggregate_stats() to stats.rs for shared use by report and threshold checks
- Fix threshold aggregation missing removed/comment/docstring/blank fields
- Fix JSON output silently swallowing serialization errors
- Fix CI mode appending summary line after JSON (breaking parsers)
- Apply clippy fixes: uninlined format args, #[must_use], const fn constructors
- Replace wildcard import colored::* with explicit Colorize
- Fix usize→i64 casts with TryFrom to prevent wrap on 64-bit targets
- Use let-else patterns, nested or-patterns, and move use statements to top
@harkaranbrar7
harkaranbrar7 merged commit 3abe94f into main May 17, 2026
3 checks passed
@harkaranbrar7
harkaranbrar7 deleted the fix/bugfixes-and-code-quality branch May 17, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant