Skip to content

refactor: use stricter linting rules#353

Merged
2bndy5 merged 2 commits into
mainfrom
stricter-linting
Jun 11, 2026
Merged

refactor: use stricter linting rules#353
2bndy5 merged 2 commits into
mainfrom
stricter-linting

Conversation

@2bndy5

@2bndy5 2bndy5 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator
  • mandates no panicking code (eg. unwrap(), expect(), panic!(), etc) used in production; tests are allowed to panic.
  • ensures all public API has a doc comment. Any public API missing a doc comment now has a one.
  • collapsed single-file submodules into a normal submodule (eg. common_fs/mod.rs becomes just common_fs.rs)

Summary by CodeRabbit

  • New Features

    • Added REST client helpers for debug checks and log-group start/end.
  • Bug Fixes / Improvements

    • Safer comment generation with fallible error propagation.
    • Filtered out invalid zero line numbers when computing added-line ranges.
    • Tests adjusted to allow certain test-only unwrap/expect usage.
  • Documentation

    • Expanded Rustdoc comments across CLI, error types, and tooling modules.
  • Refactor

    • Hardened crate linting and made the git-related module internal.

@2bndy5 2bndy5 added the enhancement New feature or request label Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR refactors lint policies from scattered module-level denials into centralized crate-level configuration, expands Rustdoc coverage across error types and CLI structures, improves error handling in RestClient by replacing unwrap calls with proper Result propagation, adds three new public RestClient methods for logging support, validates added-line numbers via NonZeroU32 in FileObj, and changes the git module from public to private.

Changes

Lint policy centralization, documentation, and error handling

Layer / File(s) Summary
Clang tools data contract enhancements
cpp-linter/src/clang_tools/clang_format.rs, cpp-linter/src/clang_tools/clang_tidy.rs, cpp-linter/src/clang_tools/mod.rs
FormatAdvice and TidyAdvice gain doc comments for their patched cache paths; clang-tools module Rustdoc expanded for CACHE_DIR, capture_clang_tools_output, ReviewComments helpers, and make_patch.
CLI docs and option structs
cpp-linter/src/cli/mod.rs, cpp-linter/src/cli/structs.rs
Add docs for Verbosity variants, Cli flattened option groups and commands field; expand ClangParams, FeedbackInput, and LinesChangedOnly documentation; test clippy allows updated.
FileObj added-lines validation
cpp-linter/src/common_fs.rs
Filter added_lines through NonZeroU32, refactor consolidate_numbers_to_ranges to accept non-zero input, and add test for single added line handling.
RestClient error handling and logging API
cpp-linter/src/rest_client.rs
Add is_debug_enabled, start_log_group, end_log_group; make comment builders return Result and propagate errors with ?; include clang detail blocks only when versions present; map mutex poison to ClientError.
Crate-level lint policy & module visibility
cpp-linter/src/lib.rs, cpp-linter/src/git.rs, cpp-linter/src/logger.rs, cpp-linter/src/main.rs, cpp-linter/src/run.rs
Introduce crate-level #![deny(...)] for selected clippy lints and missing_docs; remove pub from git module and adjust module/test-level lint attributes and cfg gating.
Comprehensive error documentation
cpp-linter/src/error.rs
Add module-level Rustdoc and per-variant documentation for FileObjError, ClientError, ClangCaptureError, and ClangTaskError without changing types/signatures.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • cpp-linter/cpp-linter-rs#52: Overlaps with added RestClient start_log_group/end_log_group behavior and log-grouping responsibilities.

Suggested labels

documentation, rust

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor: use stricter linting rules' directly and clearly summarizes the main change: implementing stricter linting rules across the codebase, which aligns with the PR objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stricter-linting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.59259% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.74%. Comparing base (ead918a) to head (9376992).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cpp-linter/src/rest_client.rs 84.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #353      +/-   ##
==========================================
- Coverage   92.89%   92.74%   -0.16%     
==========================================
  Files          22       22              
  Lines        3380     3403      +23     
==========================================
+ Hits         3140     3156      +16     
- Misses        240      247       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

2bndy5 added 2 commits June 11, 2026 13:39
- mandates no panicking code (eg. `unwrap()`, `expect()`, `panic!()`, etc) used in production; tests are allowed to panic.
- ensures all public API has a doc comment. Any public API missing a doc comment now has a one.
- collapsed single-file submodules into a normal submodule (eg. `common_fs/mod.rs` becomes just `common_fs.rs`)
@2bndy5 2bndy5 force-pushed the stricter-linting branch from d2193db to 9376992 Compare June 11, 2026 20:48
coderabbitai[bot]

This comment was marked as low quality.

@2bndy5 2bndy5 merged commit 793c310 into main Jun 11, 2026
87 of 88 checks passed
@2bndy5 2bndy5 deleted the stricter-linting branch June 11, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant