improve code quality and separation of concerns#75
Conversation
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Core (cargo-gears-core) refactor: - LintParams — now takes workspace_root, resolved booleans, dylint_skip - TestParams — now takes resolved workspace_root, config_path, runner, modules, dependencies, feature_set - BuildParams — now takes resolved paths, flags, dependencies - RunParams — now takes resolved paths, flags, watch_policy; returns RunOutcome enum - GearsCommand — removed Lint, Test, Build, Run variants (manifest-based commands no longer route through it) - BuildRunParams and its override helpers (otel_enabled, fips_enabled, release_build, clean_build) — deleted CLI (cargo-gears) refactor: - Cli::run() — dispatches manifest-based commands directly via resolve()?.run() / resolve_and_run() - LintArgs::resolve() — manifest resolution + effective selection logic (moved from core) - TestArgs::resolve() — manifest resolution + runner override (moved from core) - BuildRunArgs::resolve() — manifest resolution + boolean overrides → ResolvedBuildRun - RunArgs::resolve_and_run() — owns the watch re-resolve loop - Integration tests updated to verify CLI parsing directly via Cli::command() Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
New resolution tests (14 unit tests in CLI crate): - common/mod.rs — 4 tests: CLI overrides vs manifest defaults, clean-defaults-to-release logic - lint.rs — 8 tests: manifest policy fallback, explicit selection overrides, --all, strict validation, dylint skip - testing.rs — 2 tests: manifest runner default, CLI runner override Removed leftovers: - cmd_test.rs — deleted entirely (only had field-inspection tests) - cmd_build.rs — removed 2 field-inspection tests, kept conflict test - cmd_run.rs — removed 3 field-inspection tests, kept conflict test - cmd_lint.rs — removed field-inspection test, kept path side-effect test - parse_cli helper — removed (no longer needed) Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Also, changed all fields from pub to pub(crate), and added public getter methods Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
refactor: CLI core
refactor: Simplify / consolidate TestParams and TestPlan
Refactor/cli core
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughManifest-based commands now resolve in the CLI before execution. Core command and run/test/lint data structures now store resolved values, lint references switch to ChangesCommand Resolution Lifted to CLI Layer
Lint Macro Path Rename
Gear Annotation Path Update
Gears Config Namespace Rename
CI Workflow Updates
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
# Conflicts: # crates/cargo-gears-lints/tests/ui/de0104_no_api_dto_in_domain/with_api_dto.stderr
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cargo-gears-core/src/build/mod.rs`:
- Around line 13-27: The BuildParamsBuilder struct is missing a field to capture
the name override that can be passed via the --name command line argument. Add
an optional String field (following the pattern of existing optional fields like
app, env, etc.) to store the generated_name override in BuildParamsBuilder,
create a corresponding setter method for it, and ensure this field is used when
constructing the final BuildParams to allow the name override to be properly
carried through instead of always using the manifest name.
In `@crates/cargo-gears/src/common/mod.rs`:
- Around line 75-77: The `name` field from `BuildRunArgs` is not being passed
through to `BuildParamsBuilder` and `RunParamsBuilder`, which causes the CLI
`--name` override to be ignored. Add a `name` field and corresponding setter
method to both `BuildParamsBuilder` and `RunParamsBuilder`. Then in the
resolution paths where these builders are finalized (in both build and run
flows), apply the pattern `self.name.unwrap_or(resolved.generated_name)` to use
the CLI-provided name if available, otherwise use the manifest-derived generated
name. Finally, add a regression test that verifies the `cargo gears build --name
custom_name` and `cargo gears run --name custom_name` CLI overrides work
correctly and override the manifest-derived names.
In `@crates/cargo-gears/src/testing.rs`:
- Around line 70-78: The feature policy lookup at feature_set.get(module) uses
the raw CLI input (module parameter), but when the user provides a package name
instead of a module name, the lookup key doesn't match the module name stored in
the feature_set, causing the configured feature matrix to be skipped. Modify the
code to use the actual resolved module name for the feature_set lookup instead
of the raw CLI input. The module name should be determined from the modules map
using the package that was resolved by package_for_module, ensuring the feature
policy lookup succeeds regardless of whether the user provided a module name or
package alias.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b4728e86-0f3e-4b63-937c-898199916ee8
📒 Files selected for processing (57)
crates/cargo-gears-core/src/build/mod.rscrates/cargo-gears-core/src/common.rscrates/cargo-gears-core/src/lib.rscrates/cargo-gears-core/src/lint/mod.rscrates/cargo-gears-core/src/run/mod.rscrates/cargo-gears-core/src/test/cargo.rscrates/cargo-gears-core/src/test/llvm-cov.rscrates/cargo-gears-core/src/test/mod.rscrates/cargo-gears-lints/README.mdcrates/cargo-gears-lints/docs/de01_domain_layer/de0104_no_api_dto_in_domain/README.mdcrates/cargo-gears-lints/docs/de02_api_layer/de0203_dtos_must_use_api_dto/README.mdcrates/cargo-gears-lints/src/de01_domain_layer/de0104_no_api_dto_in_domain.rscrates/cargo-gears-lints/src/de02_api_layer/de0203_dtos_must_use_api_dto.rscrates/cargo-gears-lints/src/lint_utils.rscrates/cargo-gears-lints/tests/ui/de0104_no_api_dto_in_domain/with_api_dto.rscrates/cargo-gears-lints/tests/ui/de0104_no_api_dto_in_domain/with_api_dto.stderrcrates/cargo-gears-lints/tests/ui/de0104_no_api_dto_in_domain/without_api_dto.rscrates/cargo-gears-lints/tests/ui/de0201_dtos_only_in_api_rest/dto_in_api_rest.stderrcrates/cargo-gears-lints/tests/ui/de0202_dtos_not_referenced_outside_api/import_dto_in_api.stderrcrates/cargo-gears-lints/tests/ui/de0203_dtos_must_use_api_dto/missing_api_dto.stderrcrates/cargo-gears-lints/tests/ui/de0204_dtos_must_have_toschema_derive/has_toschema.stderrcrates/cargo-gears-lints/tests/ui/de0204_dtos_must_have_toschema_derive/missing_toschema.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_camel_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_enum_variant_rename_camel_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_camel_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_kebab_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_name_camel_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_pascal_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_rename_nested_camel_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_screaming_kebab_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_screaming_snake_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_field_uppercase.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_kebab_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_lowercase.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_pascal_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_rename_all_nested_camel_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_screaming_kebab_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_screaming_snake_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/fail_uppercase.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass_enum_variant_rename_snake_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass_field_lowercase.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass_field_name_with_snake_rename.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass_field_rename_nested_snake_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass_field_snake_case.stderrcrates/cargo-gears-lints/tests/ui/de0803_api_snake_case/pass_rename_all_nested_snake_case.stderrcrates/cargo-gears/src/build.rscrates/cargo-gears/src/common/mod.rscrates/cargo-gears/src/lib.rscrates/cargo-gears/src/lint.rscrates/cargo-gears/src/run.rscrates/cargo-gears/src/testing.rscrates/cargo-gears/tests/cmd_build.rscrates/cargo-gears/tests/cmd_lint.rscrates/cargo-gears/tests/cmd_run.rscrates/cargo-gears/tests/cmd_test.rscrates/cargo-gears/tests/common/mod.rs
💤 Files with no reviewable changes (1)
- crates/cargo-gears/tests/cmd_test.rs
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
fix: Coderabbit issues
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Clean up unused imports and empty impl block after removal Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
fix: run hangs on child exit
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
fix: DE1101 prefixes
Signed-off-by: Bechma <19294519+Bechma@users.noreply.github.com>
Signed-off-by: Mauro Lacy <11656534+maurolacy@users.noreply.github.com>
feature: List lints
Summary by CodeRabbit
dry-runJSON output and support for explicit generated-name overrides.deploynow requires--manifest(no fallback generation).modulestogears, and gears annotations now use#[toolkit::gear(...)].config mod addnow uses--depand only adds local modules.cf_gears_toolkit_macros::api_dto.