Repository navigation
add pager for describe component - #1215
Ben (Benbentwo) merged 84 commits into
Conversation
…mand' of https://github.com/cloudposse/atmos into feature/dev-3131-add-pager-to-atmos-describe-config-command
…mand' of https://github.com/cloudposse/atmos into feature/dev-3131-add-pager-to-atmos-describe-config-command
…mand' of https://github.com/cloudposse/atmos into feature/dev-3131-add-pager-to-atmos-describe-config-command
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…mand' of https://github.com/cloudposse/atmos into feature/dev-3131-add-pager-to-atmos-describe-config-command
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (3)
cmd/describe_component.go (1)
82-88: Consider less extreme error handling than panic.While the comment explains the rationale, panic is a severe response that terminates the application. Consider using a more graceful error handling approach like logging the error and exiting with a non-zero status code.
-// We prefer to panic because this is a developer error. -// checkFlagNotPresentError checks if the error is nil. -func checkFlagNotPresentError(err error) { - if err != nil { - panic(err) - } -} +// checkFlagNotPresentError handles errors from flag retrieval. +// These errors should never happen unless there's a developer error. +func checkFlagNotPresentError(err error) { + if err != nil { + u.LogErrorAndExit(err) + } +}cmd/describe_affected.go (1)
142-147: Cyclomatic complexity nudged over the threshold
parseDescribeAffectedCliArgshit a value of 11 (>10).
After fixing the panic above, splitting flag parsing into its own helper would drop the count and keep the function easier to reason about.
Not urgent, but worth tidying.internal/exec/describe_affected.go (1)
107-114: Heavy value parameter – pass by pointer
Execute(a DescribeAffectedCmdArgs)copies a ~6 KB struct twice (caller + callee).
Switch the signature toExecute(a *DescribeAffectedCmdArgs)(and update call-sites) to avoid the copy and quiet the linter.🧰 Tools
🪛 GitHub Check: golangci-lint
[failure] 107-107:
hugeParam: a is heavy (6120 bytes); consider passing it by pointer
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
cmd/describe_affected.go(3 hunks)cmd/describe_component.go(2 hunks)internal/exec/describe_affected.go(5 hunks)internal/exec/describe_affected_test.go(1 hunks)internal/exec/describe_component_test.go(1 hunks)pkg/utils/highlight_utils.go(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- internal/exec/describe_component_test.go
- pkg/utils/highlight_utils.go
🧰 Additional context used
🪛 GitHub Check: golangci-lint
cmd/describe_affected.go
[failure] 65-65:
cyclomatic: function parseDescribeAffectedCliArgs has cyclomatic complexity 11 (> max enabled 10)
internal/exec/describe_affected.go
[failure] 107-107:
hugeParam: a is heavy (6120 bytes); consider passing it by pointer
[failure] 168-168:
hugeParam: a is heavy (6120 bytes); consider passing it by pointer
cmd/describe_component.go
[failure] 12-12:
var errInvalidFlag is unused
🪛 golangci-lint (1.64.8)
internal/exec/describe_affected.go
[warning] 169-169: if a.Query == "" has complex nested blocks (complexity: 4)
(nestif)
cmd/describe_component.go
[error] 12-12: var errInvalidFlag is unused
(unused)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (4)
cmd/describe_component.go (4)
41-42: Great addition of pager flag!This matches the PR objective to implement a native pager for describe commands. The implementation properly retrieves and passes the pager setting.
46-56: Clean refactoring to structured parameters.The move to
DescribeComponentParamsstruct makes the code more maintainable and easier to test. This is a solid improvement over passing individual arguments.
68-68: Good simplification of format flag description.The simplified description is more concise while remaining clear.
20-20: Good use of ExactArgs for validation.Using
cobra.ExactArgs(1)is a solid improvement that ensures the command receives exactly one component argument.
|
💥 This pull request now has conflicts. Could you fix it Sam Tholiya (@samtholiya)? 🙏 |
1 similar comment
|
💥 This pull request now has conflicts. Could you fix it Sam Tholiya (@samtholiya)? 🙏 |
…-component-command
…-component-command
Ben (Benbentwo)
left a comment
There was a problem hiding this comment.
can you explain why the pager flag isn't a bool? I'm not following why we use certain strings.
…-component-command
what
atmos describe componentwhy
references
Summary by CodeRabbit
describe componentcommand, enabling paged output with syntax highlighting for YAML and JSON formats.--pagerflag in thedescribe componentcommand.