Skip to content

Conversation

@gpb88
Copy link
Contributor

@gpb88 gpb88 commented Oct 30, 2025

No description provided.

@andreadecorte
Copy link
Contributor

@CodeRabbit review

@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Walkthrough

Added an exported helper function GetBoolNotNil(f *bool) bool to pkg/utils and corresponding unit tests verifying nil, true, and false pointer behavior.

Changes

Cohort / File(s) Change Summary
New utility helper and tests
pkg/utils/utils.go, pkg/utils/utils_test.go
Added exported GetBoolNotNil(f *bool) bool to safely evaluate boolean pointers; added DescribeTable tests covering nil, true, and false pointer cases.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Utils as pkg/utils
    Note over Utils: New function GetBoolNotNil(f *bool)
    Caller->>Utils: GetBoolNotNil(f)
    alt f is nil
        Utils-->>Caller: false
    else f != nil
        alt *f is true
            Utils-->>Caller: true
        else
            Utils-->>Caller: false
        end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify nil-safety and boolean evaluation in pkg/utils/utils.go
  • Confirm tests in pkg/utils/utils_test.go cover nil, true, and false cases and follow test conventions

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No pull request description was provided by the author. Add a description explaining the purpose and context of moving GetBoolNotNil to ocm-common, even if brief.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: moving the GetBoolNotNil function to ocm-common, which aligns with the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 27d1c10 and c42cb6b.

📒 Files selected for processing (2)
  • pkg/utils/utils.go (2 hunks)
  • pkg/utils/utils_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/utils/utils_test.go
  • pkg/utils/utils.go

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/utils/utils.go (1)

74-76: Add documentation for the public function.

The implementation is correct and safe. However, as an exported function, it should have a godoc comment explaining its behavior (returns true only when the pointer is non-nil and points to true).

Apply this diff to add documentation:

+// GetBoolNotNil returns true if the boolean pointer is non-nil and points to true,
+// otherwise returns false.
 func GetBoolNotNil(f *bool) bool {
 	return f != nil && *f
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between d12de25 and 2f7d6d0.

📒 Files selected for processing (2)
  • pkg/utils/utils.go (2 hunks)
  • pkg/utils/utils_test.go (1 hunks)
🔇 Additional comments (2)
pkg/utils/utils_test.go (1)

43-55: LGTM! Comprehensive test coverage.

The test suite properly validates all edge cases for GetBoolNotNil: nil pointer, pointer to true, and pointer to false. The use of DescribeTable makes the tests clear and maintainable.

pkg/utils/utils.go (1)

6-7: LGTM! Standard import formatting.

The blank line appropriately separates standard library imports from third-party imports, following Go conventions.

@gpb88 gpb88 changed the title OCM-18954 | Move GetBoolNotNil function to ocm-common OCM-18954 | feat: Move GetBoolNotNil function to ocm-common Nov 12, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/utils/utils.go (1)

74-76: Implementation looks good and addresses past review feedback.

The implementation correctly handles nil pointers using short-circuit evaluation. This matches the cleaner approach suggested by ziccardi in the past review.

Consider adding a doc comment for this exported function, following Go conventions:

+// GetBoolNotNil returns true if f is non-nil and points to true, otherwise returns false.
 func GetBoolNotNil(f *bool) bool {
 	return f != nil && *f
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 2f7d6d0 and 27d1c10.

📒 Files selected for processing (2)
  • pkg/utils/utils.go (2 hunks)
  • pkg/utils/utils_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/utils/utils_test.go

@andreadecorte
Copy link
Contributor

lgtm

@andreadecorte andreadecorte merged commit dbfc861 into openshift-online:main Nov 13, 2025
8 checks passed
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.

3 participants