Skip to content

feat: allow explicit use of package managers#372

Merged
2bndy5 merged 1 commit into
mainfrom
no-mod-sys
Jun 18, 2026
Merged

feat: allow explicit use of package managers#372
2bndy5 merged 1 commit into
mainfrom
no-mod-sys

Conversation

@2bndy5

@2bndy5 2bndy5 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

The adds 2 new CLI options (for both cpp-linter and clang-tools binaries):

  1. --mod-sys defaults to the value of a CI env var (if present); allows enabling package managers in non-CI contexts.
  2. --no-mod-sys strictly disallow use of package-managers; overrides the default value of --mod-sys.

Using both options in 1 invocation causes a conflict error.

resolves #364

Summary by CodeRabbit

  • New Features
    • Added --mod-sys and --no-mod-sys CLI flags to control whether system package managers are used for clang tool installation. System package manager usage is automatically enabled in CI environments unless explicitly disabled via --no-mod-sys.

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

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an allow_system_package_manager: bool parameter to RequestedVersion::eval_tool that gates the try_install_package code path. The clang-tools-manager binary exposes this via a new --mod-sys CLI flag (with implicit CI detection), and the cpp-linter crate adds corresponding --mod-sys and --no-mod-sys flags with independent CI env-variable logic. The clap dependency gains the env feature to support environment-variable binding.

Changes

System Package Manager Opt-In Flag

Layer / File(s) Summary
eval_tool signature and conditional gate
clang-tools-manager/src/version.rs, clang-tools-manager/Cargo.toml
RequestedVersion::eval_tool gains allow_system_package_manager: bool; try_install_package is now called only when that flag is true. clap's env feature is enabled to support environment-variable binding.
clang-tools-manager CLI and wiring
clang-tools-manager/src/main.rs
CliOptions gains mod_sys: bool with --mod-sys flag that conflicts with --no-mod-sys. The install loop computes the boolean from options.mod_sys, options.no_mod_sys, and the CI env var, then passes it to eval_tool.
clang-tools-manager test updates
clang-tools-manager/src/version.rs
Test imports include std::env. All eval_tool invocations in tests pass the new boolean: false for eval_no_value and eval_download_path; runtime CI-derived value for eval_version.
cpp-linter CLI and run logic
cpp-linter/src/cli/mod.rs, cpp-linter/src/run.rs
GeneralOptions gains mod_sys and no_mod_sys fields with mutually exclusive --mod-sys and --no-mod-sys flags. Verbosity doc is clarified. run_main computes the boolean from these flags and the CI env var, then passes it to capture_clang_tools_output.
cpp-linter clang_tools integration
cpp-linter/src/clang_tools/mod.rs
capture_clang_tools_output gains modify_system: bool parameter. Both clang-tidy and clang-format version discovery paths pass this flag to eval_tool. Test helper test_db_parse passes false.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • cpp-linter/cpp-linter-rs#52: Both PRs modify the same cpp-linter/src/clang_tools/mod.rs::capture_clang_tools_output signature and its call sites, with overlapping code-level changes to function parameters and threading logic.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #364: it introduces --mod-sys and --no-mod-sys flags, ensures system package managers are only attempted by default in CI environments, and allows explicit opt-in/opt-out control.
Out of Scope Changes check ✅ Passed All code changes are directly related to the objectives of adding system package manager control flags and threading the allow_system_package_manager parameter through the relevant functions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly summarizes the main change: adding explicit control over package manager usage through new CLI flags.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.43%. Comparing base (959ae38) to head (8d961f2).

Files with missing lines Patch % Lines
clang-tools-manager/src/version.rs 94.73% 1 Missing ⚠️
cpp-linter/src/run.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #372   +/-   ##
=======================================
  Coverage   92.42%   92.43%           
=======================================
  Files          23       23           
  Lines        3632     3649   +17     
=======================================
+ Hits         3357     3373   +16     
- Misses        275      276    +1     

☔ 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 2bndy5 marked this pull request as ready for review June 18, 2026 10:34
coderabbitai[bot]

This comment was marked as resolved.

@2bndy5 2bndy5 changed the title feat: do not use system package managers by default feat: allow explicitly use of package managers Jun 18, 2026
The adds 2 new CLI options (for both `cpp-linter` and `clang-tools` binaries):

1. `--mod-sys` defaults to the value of a `CI` env var (if present); allows enabling package managers in non-CI contexts.
2. `--no-mod-sys` strictly disallow use of package-managers; overrides the default value of `--mod-sys`.

Using both options in 1 invocation causes a conflict error.

resolves #364
@2bndy5 2bndy5 changed the title feat: allow explicitly use of package managers feat: allow explicit use of package managers Jun 18, 2026
coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as low quality.

@2bndy5 2bndy5 merged commit fd15454 into main Jun 18, 2026
87 of 88 checks passed
@2bndy5 2bndy5 deleted the no-mod-sys branch June 18, 2026 23:19
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.

require --mod-sys in non-CI contexts to install via system package managers

1 participant