Adds a linter for the ocm logger #1101
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->
Walkthrough
Adds an "ocmlogger" linter plugin that checks OCM SDK logger calls for format-placeholder vs variadic-argument mismatches, includes analyzer tests and test fixtures (logger stub and sample code), a Ginkgo test bootstrap, and updates several transitive Go module dependencies.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
| Dependency Management <br> go.mod, examples/go.mod | Upgraded multiple golang.org/x/* modules (e.g., x/crypto, x/net, x/sys, x/term, x/text, x/tools) and added github.com/golangci/plugin-module-register v0.1.2; updated indirect dependency versions. |
| Test Bootstrap <br> linters/linters_suite_test.go | Added Ginkgo v2 test bootstrap (TestLinters) registering the fail handler and running the "Linters Suite". |
| OCM Logger Linter Plugin <br> linters/ocm_logging_linter.go | New linter plugin registered as ocmlogger with OcmLoggerLinter, New, GetLoadMode, and BuildAnalyzers. Implements AST analysis to find calls on github.com/openshift-online/ocm-sdk-go/logging.Logger methods (Debug/Info/Warn/Error/Fatal), resolves literal format strings (including simple concatenation), counts format placeholders (ignores escaped %%), respects nolint:ocmlogger / ocm-linter:ignore (same or previous line), and reports mismatches. |
| Linter Tests <br> linters/ocm_logging_linter_test.go | Added analyzer-based test that loads the ocmlogger plugin via registry, initializes it, builds analyzers, and runs the analyzer against testdata with assertions. |
| Test Fixtures / Logger Stub <br> linters/testdata/src/data/data.go, linters/testdata/src/.../ocm-sdk-go/logging/logging.go | Added data.go with examples exercising valid/invalid format uses, dynamic-format exclusion, and nolint suppression cases; added a minimal logging.Logger stub with no-op Debug/Info/Warn/Error/Fatal methods to support tests. |
Sequence Diagram(s)
sequenceDiagram
participant Test as Linter Test
participant Reg as Plugin Registry
participant Linter as OcmLoggerLinter
participant Analyzer as Analyzer
participant AST as AST Walker
Test->>Reg: GetPlugin("ocmlogger")
Reg->>Linter: New(...)
Linter-->>Reg: plugin instance
Test->>Linter: BuildAnalyzers()
Linter->>Analyzer: create Analyzer with Run callback
Analyzer-->>Linter: Analyzer ready
Test->>Analyzer: Run on testdata
Analyzer->>AST: Walk AST nodes
loop for each log-call node
AST->>Linter: isDisabled(node)?
alt disabled via nolint
Linter-->>AST: skip node
else
AST->>Linter: extractString(formatExpr)
Linter-->>AST: format string or dynamic
AST->>Linter: countPlaceholders(format)
Linter-->>Analyzer: placeholderCount
Analyzer->>AST: compare with variadic args
alt mismatch
Analyzer-->>Test: report diagnostic
else match or dynamic
Analyzer-->>Test: no report
end
end
end
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
linters/ocm_logging_linter.go.extractString handles concatenations and edge cases safely.countPlaceholders correctly ignores escaped %% and counts verbs.linters/ocm_logging_linter_test.go and linters/testdata cover relevant edge cases.<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->
Pre-merge checks and finishing touches
<details>
<summary>❌ Failed checks (1 warning)</summary>
| Check name | Status | Explanation | Resolution |
| :----------------: | :--------- | :------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------- |
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
</details>
<details>
<summary>✅ Passed checks (2 passed)</summary>
| Check name | Status | Explanation |
| :---------------: | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Title check | ✅ Passed | The title accurately describes the main change: adding a linter for the OCM logger. It is concise and directly related to the primary objective of this pull request. |
| Description check | ✅ Passed | The description is directly related to the changeset, explaining the motivation for the linter, its purpose, expected output examples, and local testing instructions. |
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary>✨ Finishing touches</summary>
<details>
<summary>🧪 Generate unit tests (beta)</summary>
</details>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- announcements_start -->
[!TIP]
<details>
<summary>📝 Customizable high-level summaries are now available in beta!</summary>
> You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
> - Provide your own instructions using the high_level_summary_instructions setting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.> Example instruction:
> > "Divide the high-level summary into five sections:
> 1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
> 2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
> 3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
> 4. 📊 Contributor Summary — Include a Markdown table showing contributions:
> | Contributor | Lines Added | Lines Removed | Files Changed |> 5. ✔️ Additional Notes — Add any extra reviewer context.
> Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
> Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
> </details>
<!-- announcements_end -->
<!-- tips_start -->
---
<sub>Comment @coderabbitai help to get the list of available commands and usage tips.</sub>
<!-- tips_end -->
<!-- internal state start -->
<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNRo6gDYkuAQVq0yGiQnvAYNHwAZvh8uLAk/AzMIfhEpHyQBlAAco4ClFwAjIUADIWQmVAAqjYAMlywuLjciBwA9G1E6rDYAhpMzG343GSICJG4YPgYoeRDSWCItADWxPht3Nienm3FZRVZkFWIBZAAXvAMDM60OpWQAMr42BQMCQJUGAywXADyAMIAWQA+rVfgBxcEAURsoIAktloDCDu5nKRcJAPphvlxmNosPcHrhqNhWvwRgTDjYSBJ4CQAO6UMkMChIcSYfBSeBENAAGkgACk0GwSJ4AEL8hhdKgrZwoyC1FSislobi8Tl0fmeIi4Zj88h0RBgCgkARoE7y/4m6h0dCcSAAJhKDoArGBiu7CtBihwXQAODgAZgA7AAtIwAEWkLPg3HE0w4h38gXQjFJBGSswikAIkCUNDEKC+MRNhdJ0n4kRz8USmdS6Ug9PiJpSaUokDYcUUyFo+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GxUeh0wxoc0NyEeZ2htQzofAIYAf42cwkfDECN0HDDihj/KEZML+ShJuBuIj/EwEJGuxUApQL+CUGDyNgEAgNVABcmwBilLgdIcIEGRrAJCoE5Ze2DAX4LVcWRYeYkXkOkB8QcY0wbgQAE1ngptLAGZCwDjgAAApFxUCtx24/nZWL2DxHvMiAiAacLmGDTA1YIzkOkRqCoCkBvhUIv4Z0MyElZshUI8obCM8DVCOh5A20aaLEGNCSEiJXgUPH4HW4bA3QmgdMM6Ew9uu6vTPj9zQBoAkeDoQMHBzx7Pdze3ELngQkKACAFurPPHrX0T5jd9uxXGPrQAYBl94eqYrPjHxdAMAfh4Yo/LYEUGIiPMroNAOzw95x8/u23BHj2MK5kdN44fNvp1zQD5j8g2ffLgwALE1jtutAP0A13K53cXQ9PJ0L1xIAlABABCWgC2ONF34CRygUgAo0oBdYmcNAb/i0JYFykj0baE9NRiSg3iMRQ8AgJ1UgwWQrI3/QoFCJBZm5583QWkYGO/4eI2kTQmZOGLlIsYFSHGbTAsRfFcBbxugj8RNi/Fm5v+gYf8clRMhAS4gIElXCMMgCFA0RUE1BiuHQZSUZKYlc9K+MGHvjBw6E3CcRMK44SoM0KfCbAEIlICwJwYioO0QMCCSp+UANfhvwFTb9l+MkfQEAA== -->
<!-- internal state end -->
The linting step is failing because the CI is not executing the Makefile from the PR (which adds the new custom linter)
_⚠️ Potential issue_ | _🔴 Critical_
Fix the analyzer metadata - copy-paste error from template.
The analyzer Name and Doc fields are incorrect. They reference a "todo" linter instead of the OCM logger linter being implemented. This copy-paste error will cause the analyzer to be registered with the wrong metadata.
Apply this diff to fix the metadata:
func (f *OcmLoggerLinter) BuildAnalyzers() ([]*analysis.Analyzer, error) {
return []*analysis.Analyzer{
{
- Name: "todo",
- Doc: "find todos without an author",
+ Name: "ocmlogger",
+ Doc: "checks that log calls have matching format strings and arguments",
Run: f.run,
},
}, nil
}
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
func (f *OcmLoggerLinter) BuildAnalyzers() ([]*analysis.Analyzer, error) {
return []*analysis.Analyzer{
{
Name: "ocmlogger",
Doc: "checks that log calls have matching format strings and arguments",
Run: f.run,
},
}, nil
}
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
In linters/ocm_logging_linter.go around lines 60 to 68, the analyzer Name and
Doc are incorrectly set to the "todo" linter from the template; change Name to a
descriptive identifier for this linter (e.g., "ocm-logger" or
"ocm_logging_linter") and update Doc to accurately describe this analyzer (e.g.,
"find improper OCM logger usage" or "find OCM logging issues"); leave Run as
f.run and ensure the returned analyzer slice contains the corrected Name and Doc
so the analyzer is registered with the proper metadata.
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
✅ Addressed in commits a905d16 to c22f6a5
_⚠️ Potential issue_ | _🔴 Critical_
<details>
<summary>🧩 Analysis chain</summary>
Verify that the ocm-lint binary is built before the lint target executes.
The lint target now invokes $(LOCAL_BIN_PATH)/ocm-lint run, but there's no explicit dependency or build step for the ocm-lint binary in this target.
Run the following to verify the build process for ocm-lint:
---
🏁 Script executed:
#!/bin/bash
# Check if there's a build target or if golangci-lint custom builds it
echo "=== Searching for ocm-lint build instructions ==="
rg -n "ocm-lint" Makefile
echo ""
echo "=== Checking .custom-gcl.yml destination ==="
cat .custom-gcl.yml | grep -A1 "destination"
echo ""
echo "=== Verifying golangci-lint custom builds plugins ==="
golangci-lint help custom 2>&1 | grep -i "build\|plugin" | head -10
Length of output: 206
---
---
🏁 Script executed:
shell#!/bin/bash
Get the full lint target definition with context
echo "=== Full lint target and surrounding context ==="
sed -n '95,105p' Makefile
echo ""
echo "=== Search for all targets in Makefile ==="
rg -n "^[a-zA-Z_-]+:" Makefile | head -20
echo ""
echo "=== Check for ocm-lint build rules or targets ==="
rg -n "ocm-lint|ocm_lint" Makefile
echo ""
echo "=== Look for .PHONY declarations ==="
rg -n "\.PHONY" Makefile
echo ""
echo "=== Check for LOCAL_BIN_PATH definition ==="
rg -n "LOCAL_BIN_PATH" Makefile | head -5
Length of output: 1313
---
---
🏁 Script executed:
#!/bin/bash
# Check .custom-gcl.yml full contents
echo "=== Full .custom-gcl.yml content ==="
cat .custom-gcl.yml
echo ""
echo "=== Search for any setup or build docs mentioning ocm-lint ==="
rg -n "ocm-lint" . -g "*.md" -g "*.txt" -g "*.yml" -g "*.yaml" 2>/dev/null | head -20
echo ""
echo "=== Check if there's a go.mod or tooling that references ocm-lint ==="
rg -n "ocm-lint" go.mod go.sum 2>/dev/null
echo ""
echo "=== Look for any CI/CD workflow that builds ocm-lint ==="
fd -e "yml" -e "yaml" -path "*/.github/*" 2>/dev/null | head -5
Length of output: 452
---
---
🏁 Script executed:
shell#!/bin/bash
Verify if golangci-lint custom builds the plugin
echo "=== Check golangci-lint documentation for 'custom' command ==="
golangci-lint custom --help 2>&1
echo ""
echo "=== Search for any Makefile setup or initialization targets ==="
rg -n "^[a-zA-Z_-]+:" Makefile -A3 | grep -E "(setup|init|build|install)" -i
echo ""
echo "=== Check if there's a top-level target that depends on lint ==="
rg -n "lint" Makefile | grep -v "golangci-lint"
echo ""
echo "=== Look for any README or documentation on building ==="
cat README.md 2>/dev/null | grep -A5 -B5 "lint\|ocm-lint" | head -30
Length of output: 1190
---
</details>
**Add explicit ocm-lint build dependency to the lint target.**
The `lint` target invokes `$(LOCAL_BIN_PATH)/ocm-lint run` on line 101, but there's no prerequisite or build step to ensure the binary exists. The `golangci-lint custom` command (line 100) builds a custom golangci-lint binary, not the ocm-lint plugin itself. Similar tools in this Makefile (e.g., `ginkgo-install`, `goimports-install`) use explicit `go install` patterns—ocm-lint needs the same treatment.
Create an `ocm-lint-install` target (following the existing pattern) and add it as a prerequisite to the `lint` target.
<details>
<summary>🤖 Prompt for AI Agents</summary>
In Makefile around lines 98 to 101, the lint target calls
$(LOCAL_BIN_PATH)/ocm-lint run but doesn't ensure the binary exists; add an
ocm-lint-install target following the existing install-patterns (i.e., a target
that runs go install <ocm-lint-module>@<version> and places the binary under
$(LOCAL_BIN_PATH)) and then make lint depend on ocm-lint-install so the ocm-lint
binary is built/installed before $(LOCAL_BIN_PATH)/ocm-lint run is executed.
```
</details>
<!-- This is an auto-generated reply by CodeRabbit -->
✅ Addressed in commits 3d2caed to ca93b84
<!-- This is an auto-generated comment by CodeRabbit -->
Actionable comments posted: 3
<details>
<summary>🧹 Nitpick comments (3)</summary><blockquote>
<details>
<summary>.golangci.yml (1)</summary><blockquote>
5-11: Consider adding a meaningful description for the ocmlogger linter.
The description field is set to "none", which doesn't provide useful information about the linter's purpose.
Apply this diff to improve the description:
custom:
ocmlogger:
type: "module"
- description: "none"
+ description: "Validates OCM logger format strings match argument counts"
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter_test.go (1)</summary><blockquote>
20-22: Verify that only one analyzer is expected, or add an assertion for analyzer count.
The test uses analyzers[0] without checking the length of the analyzers slice. If the plugin returns zero or multiple analyzers, this could cause issues.
Apply this diff to add a safety check:
analyzers, err := plugin.BuildAnalyzers()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
+ gomega.Expect(analyzers).To(gomega.HaveLen(1), "Expected exactly one analyzer")
analysistest.Run(GinkgoT(), td, analyzers[0], "data")
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
45-49: Consider removing the commented code example from documentation.
The commented-out analyzer variable definition within the documentation comment is somewhat confusing. The struct documentation would be clearer without this example code, as the actual implementation is visible in the BuildAnalyzers method.
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 9747853fab30ac2c51f22369be3461758fd2d9ce and 5a2a6db8f58ebef80297364685699c2647ea7d98.
</details>
<details>
<summary>⛔ Files ignored due to path filters (1)</summary>
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (9)</summary>
.custom-gcl.yml (1 hunks)
.golangci.yml (1 hunks)
Makefile (1 hunks)
go.mod (2 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🧰 Additional context used</summary>
<details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
<details>
<summary>go.mod</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)</summary>
GitHub Check: Generate
GitHub Check: Test (1.21, windows-latest)
GitHub Check: Test (1.21, macos-latest)
</details>
<details>
<summary>🔇 Additional comments (9)</summary><blockquote>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1)</summary><blockquote>
1-13: LGTM!
The Logger stub correctly defines the expected signature for the linter to analyze. The no-op implementations are appropriate for test data.
</blockquote></details>
<details>
<summary>linters/linters_suite_test.go (1)</summary><blockquote>
1-13: LGTM!
Standard Ginkgo test suite bootstrap that follows best practices.
</blockquote></details>
<details>
<summary>linters/testdata/src/data/data.go (1)</summary><blockquote>
1-41: LGTM! Comprehensive test data covering positive, negative, and suppression scenarios.
The test data correctly covers:
// want assertions</blockquote></details>
<details>
<summary>.custom-gcl.yml (1)</summary><blockquote>
1-10: Module Plugin System unavailable in installed golangci-lint version.
The .custom-gcl.yml file structure correctly follows the golangci-lint Module Plugin System configuration format. However, the installed golangci-lint v2.5.0 does not support the required golangci-lint custom command. The script output confirms: "unknown command 'custom' for 'golangci-lint help'", indicating the golangci-lint custom command is not available in this binary.
Additionally, the configuration specifies version: v2.1.6, but the installed binary is v2.5.0. Either downgrade golangci-lint to v2.1.6 or verify that your installation properly includes Module Plugin System support (available in versions >= v1.57.0, though availability may depend on how the binary was built).
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (5)</summary><blockquote>
14-16: LGTM: Plugin registration follows standard pattern.
The init function correctly registers the plugin with an appropriate name.
---
52-58: LGTM: Load mode and constructor are correctly implemented.
The LoadModeSyntax is appropriate for AST analysis, and the constructor signature matches the expected plugin interface.
---
70-90: LGTM: Comment-based disabling is correctly implemented.
The logic properly checks for nolint directives on the same line or the line above, and handles both comment styles.
---
92-130: LGTM: String extraction and placeholder counting are well-implemented.
The extractString method appropriately handles literal strings and concatenation while skipping dynamic cases. The countPlaceholders method correctly counts format specifiers and handles the escaped %% sequence.
---
132-194: LGTM: Main analysis logic is correct and well-structured.
The run method properly validates OCM logger calls by:
The logic correctly assumes the OCM logger API signature: method(ctx, formatString, ...args).
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
_⚠️ Potential issue_ | _🟡 Minor_
Pre-existing inconsistency: Use ctx instead of f.ctx for logging.
This logger call uses f.ctx (Line 326) while all other logger calls in this function use the ctx parameter. The ctx parameter is enriched with the leadershipFlag context value (Line 317) and should be used consistently for all logging operations in this function.
Apply this diff to use the correct context:
if err != nil {
f.logger.Error(
- f.ctx,
+ ctx,
"error running precheck: process '%s' name '%s' err %v",
f.process, f.name, err,
)
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
ctx,
"error running precheck: process '%s' name '%s' err %v",
f.process, f.name, err,
)
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
In leadership/flag.go around lines 326 to 329, the logger call uses f.ctx
instead of the enriched ctx parameter (created at line 317); replace f.ctx with
ctx in that log call so all logging in this function consistently uses the
context carrying the leadershipFlag value.
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
Actionable comments posted: 1
<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>
<details>
<summary>leadership/flag.go (1)</summary><blockquote>
385-389: Consider standardizing error message format.
The error message format here differs from similar error messages in the file. For consistency:
"error running precheck: process '%s' name '%s' err %v""Process '%s' can't create initial state for flag: name %s err %v""Process '%s' can't update holder for flag '%s': %v"Consider adopting a uniform format for all error messages, such as:"Process '%s' can't create initial state for flag '%s': %v"
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 5a2a6db8f58ebef80297364685699c2647ea7d98 and 775580ea8829672027554d17fd16fc855d36a1c3.
</details>
<details>
<summary>📒 Files selected for processing (1)</summary>
leadership/flag.go (3 hunks)</details>
<details>
<summary>🔇 Additional comments (2)</summary><blockquote>
<details>
<summary>leadership/flag.go (2)</summary><blockquote>
330-332: LGTM! Behavioral improvement for consistency.
Adding f.lower(ctx) on precheck error makes this error path consistent with all other error paths in the function. This ensures the process immediately releases the leadership flag when precheck fails, which is the correct behavior.
---
466-470: LGTM! Error parameter now properly included.
The error parameter is now correctly included in the log message. The format string and arguments match properly (3 placeholders, 3 arguments).
Note: Format consistency across error messages was already noted in the previous comment.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
Not sure this comment is correct. golangci-lint custom is indeed creating bin/ocm-lint as configured in .custom-gcl.yml
_⚠️ Potential issue_ | _🔴 Critical_
Fix the load mode to support type information.
The GetLoadMode() method returns register.LoadModeSyntax, but the analyzer requires type information to check receiver types. Line 153 accesses pass.TypesInfo.TypeOf(sel.X), which will be unavailable or cause issues with syntax-only mode.
Apply this diff to use the correct load mode:
func (f *OcmLoggerLinter) GetLoadMode() string {
- return register.LoadModeSyntax
+ return register.LoadModeTypesInfo
}
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
func (f *OcmLoggerLinter) GetLoadMode() string {
return register.LoadModeTypesInfo
}
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
In linters/ocm_logging_linter.go around lines 52-53, the GetLoadMode method
currently returns register.LoadModeSyntax which only loads syntax and lacks type
information; change it to return the load mode that includes type information
(e.g., register.LoadModeType) so pass.TypesInfo.TypeOf(sel.X) will be populated
and the analyzer can inspect receiver types.
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
Actionable comments posted: 1
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 775580ea8829672027554d17fd16fc855d36a1c3 and c22f6a5df369492bf8f7fafc34fad719c30f5213.
</details>
<details>
<summary>⛔ Files ignored due to path filters (1)</summary>
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (10)</summary>
.custom-gcl.yml (1 hunks)
.golangci.yml (1 hunks)
Makefile (1 hunks)
go.mod (2 hunks)
leadership/flag.go (3 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (5)</summary>
linters/testdata/src/data/data.go
linters/linters_suite_test.go
.golangci.yml
.custom-gcl.yml
linters/ocm_logging_linter_test.go
</details>
<details>
<summary>🧰 Additional context used</summary>
<details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
<details>
<summary>go.mod</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)</summary>
GitHub Check: Test (1.21, ubuntu-latest)
GitHub Check: Test (1.21, macos-latest)
GitHub Check: Test (1.21, windows-latest)
</details>
<details>
<summary>🔇 Additional comments (7)</summary><blockquote>
<details>
<summary>leadership/flag.go (1)</summary><blockquote>
327-329: LGTM! Format strings now match argument counts.
The updated error log messages correctly align the number of format placeholders with the number of arguments, which will satisfy the new OCM logger linter requirements.
Also applies to: 387-388, 468-469
</blockquote></details>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1)</summary><blockquote>
1-13: LGTM! Appropriate minimal test stub.
This provides the necessary Logger interface for testing the OCM logger linter without introducing unnecessary complexity.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (3)</summary><blockquote>
70-90: Well-implemented nolint suppression.
The logic correctly checks for suppression comments on both the same line and the line immediately above, supporting both nolint:ocmlogger and ocm-linter:ignore formats.
---
114-130: Correct placeholder counting with %% escape handling.
The implementation properly counts format placeholders while correctly skipping escaped %% sequences.
---
158-163: Precise receiver type checking.
The exact type-string comparison ensures the linter only analyzes calls on the intended Logger type, avoiding false positives on similarly-named methods.
</blockquote></details>
<details>
<summary>go.mod (2)</summary><blockquote>
29-29: Linter plugin infrastructure dependencies look good.
The additions of github.com/golangci/plugin-module-register and golang.org/x/tools align with the PR objective to add a custom OCM logger linter plugin. These provide the necessary tooling infrastructure for plugin registration and analysis.
Also applies to: 33-33
---
22-23: Version bumps are compatible with linter plugin—no breaking changes detected.
No API-breaking changes exist in golang.org/x/crypto v0.37.0 or golang.org/x/net v0.39.0. go mod verify confirms the go.mod is consistent, and the dependency graph shows no conflicts. The linter tooling integration (golangci-lint/plugin-module-register) has no reported incompatibilities with these versions. The changes are safe to proceed with.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
<details>
<summary>🧩 Analysis chain</summary>
🌐 Web query:
golangci-lint custom command plugin build
💡 Result:
Short guide — ways to add/build a custom linter (plugin) for golangci-lint
1) Module plugin system (recommended)
version: v2.x
plugins:
- module: "github.com/you/your-plugin"
import: "github.com/you/your-plugin/pkg"
version: v1.0.0
2) Go plugin system (legacy / .so plugins)
func New(conf any) ([]*analysis.Analyzer, error)
go build -buildmode=plugin plugin/example.go
(produces example.so)
Notes / gotchas
If you want, tell me which approach you prefer and I’ll give exact example files and commands for your repo layout.
Citations:
---
</details>
@ziccardi You're absolutely right, and I apologize for the incorrect analysis.
The golangci-lint custom command reads .custom-gcl.yml and builds a custom golangci-lint binary with the plugin compiled in. Based on your configuration:
name: ocm-lint → the binary is named ocm-lintdestination: ./bin → it's placed in ./bin/So golangci-lint custom does indeed create $(LOCAL_BIN_PATH)/ocm-lint before the second line executes it. The dependency chain is correct as-is.
Would you like me to resolve my original comment, or would you prefer to handle it?
<!-- This is an auto-generated reply by CodeRabbit -->
_⚠️ Potential issue_ | _🔴 Critical_
Critical: Update golang.org/x/oauth2 to address high-severity vulnerability.
The current version v0.15.0 is affected by CVE-2025-22868 (GO-2025-3488), a high-severity DoS vulnerability where a malformed token can cause unexpected memory consumption during parsing. This was flagged in a previous review but remains unresolved.
Apply this fix:
- golang.org/x/oauth2 v0.15.0
+ golang.org/x/oauth2 v0.30.0
Then run:
go get golang.org/x/oauth2@v0.30.0
go mod tidy
Verify compatibility with your tests before merging.
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
In go.mod around line 24, the dependency golang.org/x/oauth2 is pinned to
v0.15.0 which is vulnerable (CVE-2025-22868); update the module to v0.30.0, then
run "go get golang.org/x/oauth2@v0.30.0" followed by "go mod tidy" to update
go.sum and module graph, and run the test suite/build to verify compatibility
and fix any API changes.
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
Actionable comments posted: 1
<details>
<summary>♻️ Duplicate comments (1)</summary><blockquote>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
52-54: Fix the load mode - TypesInfo will be unavailable.
The method returns register.LoadModeSyntax, but line 153 calls pass.TypesInfo.TypeOf(sel.X) which requires type information. With syntax-only mode, TypesInfo will not be populated, causing the type check to fail.
Apply this diff to use the correct load mode:
func (f *OcmLoggerLinter) GetLoadMode() string {
- return register.LoadModeSyntax
+ return register.LoadModeTypesInfo
}
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between c22f6a5df369492bf8f7fafc34fad719c30f5213 and ca93b840f78c003c6b8f76516686e240d9da1807.
</details>
<details>
<summary>⛔ Files ignored due to path filters (2)</summary>
examples/go.sum is excluded by !/.sum
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (11)</summary>
.custom-gcl.yml (1 hunks)
.golangci.yml (1 hunks)
Makefile (1 hunks)
examples/go.mod (1 hunks)
go.mod (2 hunks)
leadership/flag.go (3 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>
leadership/flag.go
</details>
<details>
<summary>🧰 Additional context used</summary>
<details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
<details>
<summary>go.mod</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)</summary>
GitHub Check: Generate
GitHub Check: Test (1.21, ubuntu-latest)
GitHub Check: Test (1.21, windows-latest)
GitHub Check: Test (1.21, macos-latest)
</details>
<details>
<summary>🔇 Additional comments (17)</summary><blockquote>
<details>
<summary>.golangci.yml (1)</summary><blockquote>
5-11: LGTM! Custom linter configuration is correct.
The ocmlogger linter is properly configured as a module-type custom linter and enabled in the linters list. This aligns with the module plugin approach defined in .custom-gcl.yml.
</blockquote></details>
<details>
<summary>examples/go.mod (1)</summary><blockquote>
53-57: LGTM! Dependency upgrades align with parent module.
The golang.org/x/ dependency upgrades are consistent with the changes in the root go.mod and maintain proper version alignment between the examples module and the parent SDK module.
</blockquote></details>
<details>
<summary>.custom-gcl.yml (1)</summary><blockquote>
1-10: LGTM! Plugin configuration is properly structured.
The .custom-gcl.yml correctly defines the ocmlogger plugin as a local module plugin, specifying the import path and using a local build path. The golangci-lint custom command will use this to build the ocm-lint binary in ./bin/.
</blockquote></details>
<details>
<summary>Makefile (1)</summary><blockquote>
100-101: LGTM! Lint workflow correctly builds and executes custom linter.
The updated lint target properly:
1. Builds the custom ocm-lint binary with the ocmlogger plugin via golangci-lint custom
2. Executes the custom linter with $(LOCAL_BIN_PATH)/ocm-lint run
This follows the golangci-lint module plugin pattern and was confirmed correct in previous review discussion.
</blockquote></details>
<details>
<summary>go.mod (1)</summary><blockquote>
22-23: LGTM! Dependency updates support the new linter infrastructure.
The additions of plugin-module-register and golang.org/x/tools, along with the golang.org/x/ upgrades, properly support the new ocmlogger custom linter plugin and analyzer framework.
Also applies to: 29-29, 33-33, 69-73
</blockquote></details>
<details>
<summary>linters/linters_suite_test.go (1)</summary><blockquote>
1-13: LGTM! Standard Ginkgo test suite setup.
The test suite bootstrap properly initializes Ginkgo v2 and Gomega for the linters package tests, following standard Go testing conventions.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter_test.go (1)</summary><blockquote>
11-24: LGTM! Analyzer test follows standard patterns.
The test properly exercises the ocmlogger plugin through the plugin registration framework and uses analysistest.Run to verify diagnostic output against the // want comments in testdata. Error handling with Gomega assertions is appropriate.
</blockquote></details>
<details>
<summary>linters/testdata/src/data/data.go (1)</summary><blockquote>
14-41: LGTM! Comprehensive test cases for the linter.
The testdata covers all critical scenarios:
%% (lines 17-19)nolint suppression patterns (lines 34, 40)The test cases effectively validate the linter's behavior across normal, error, and suppression paths.
</blockquote></details>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1)</summary><blockquote>
1-13: LGTM! Test stub is well-formed.
The Logger stub correctly defines the method signatures that the linter will validate. The no-op implementations are appropriate for testdata.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (8)</summary><blockquote>
1-16: LGTM! Plugin registration is correct.
The imports are appropriate and the init() function properly registers the plugin.
---
18-50: LGTM! Excellent documentation.
The documentation clearly explains the linter's purpose, provides valid and invalid examples, and documents the suppression mechanisms.
---
56-58: LGTM! Constructor is straightforward.
The New function correctly instantiates the linter plugin.
---
60-68: LGTM! Analyzer metadata is correct.
The analyzer name and documentation are now properly set (previous issue with template values has been resolved).
---
70-90: LGTM! Comment suppression logic is correct.
The method correctly identifies disabled checks by examining comments on the same line or the line immediately above. It handles both nolint:ocmlogger and ocm-linter:ignore directives.
---
92-112: LGTM! String extraction handles literal concatenation.
The method correctly extracts string literals and supports concatenation with the + operator. Intentionally returns false for non-literal expressions, which is appropriate since dynamic format strings cannot be statically validated.
---
114-130: LGTM! Placeholder counting logic is correct.
The method correctly counts format placeholders, properly handling escaped %% sequences by skipping both characters.
---
132-194: LGTM! Main analyzer logic is sound.
The run method correctly:
Note: The critical issue with TypesInfo availability (due to LoadModeSyntax at line 53) must be addressed for this code to function correctly.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
Actionable comments posted: 0
<details>
<summary>♻️ Duplicate comments (1)</summary><blockquote>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
52-54: Critical: LoadMode must include type information for the analyzer to work.
The method returns register.LoadModeSyntax, but line 153 requires pass.TypesInfo.TypeOf(sel.X) to check receiver types. Without type information, pass.TypesInfo will be nil or incomplete, causing the analyzer to skip all checks.
Apply this diff to fix the load mode:
func (f *OcmLoggerLinter) GetLoadMode() string {
- return register.LoadModeSyntax
+ return register.LoadModeTypesInfo
}
</blockquote></details>
</blockquote></details>
<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
45-49: Consider removing the commented-out analyzer definition.
Lines 45-49 contain a commented-out analyzer definition that appears to be leftover template or example code. Since the actual analyzer is built in BuildAnalyzers(), this commented section can be removed to improve code clarity.
Apply this diff to clean up the documentation:
// Comments can be placed on the same line (or the line immediately above) the call.
-//
-// var OcmLoggerLinter = &analysis.Analyzer{
-// Name: "ocmlogger",
-// Doc: "checks that log calls have matching format strings and arguments",
-// Run: run,
-// }
type OcmLoggerLinter struct{}
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between ca93b840f78c003c6b8f76516686e240d9da1807 and 4208c4d76df2c4ea4128ec453cdab1433f8b467f.
</details>
<details>
<summary>⛔ Files ignored due to path filters (1)</summary>
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (11)</summary>
.custom-gcl.yml (1 hunks)
.golangci.yml (1 hunks)
Makefile (1 hunks)
examples/go.mod (1 hunks)
go.mod (1 hunks)
leadership/flag.go (3 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (6)</summary>
go.mod
leadership/flag.go
linters/testdata/src/data/data.go
examples/go.mod
linters/linters_suite_test.go
.golangci.yml
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)</summary>
GitHub Check: Test (1.21, macos-latest)
GitHub Check: Generate
GitHub Check: Test (1.21, windows-latest)
</details>
<details>
<summary>🔇 Additional comments (11)</summary><blockquote>
<details>
<summary>.custom-gcl.yml (1)</summary><blockquote>
1-10: LGTM! Configuration correctly defines the custom linter plugin.
The module-based plugin configuration properly declares the ocmlogger linter and specifies the destination matching the Makefile's LOCAL_BIN_PATH. The golangci-lint custom command will build the custom binary with the plugin compiled in.
</blockquote></details>
<details>
<summary>Makefile (1)</summary><blockquote>
98-101: LGTM! Lint workflow correctly integrates the custom linter.
The two-step process (build custom binary via golangci-lint custom, then execute ocm-lint run) properly implements the custom linter integration. As confirmed in previous discussion, golangci-lint custom reads .custom-gcl.yml and creates $(LOCAL_BIN_PATH)/ocm-lint before the second command executes.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter_test.go (1)</summary><blockquote>
11-24: LGTM! Test properly exercises the analyzer using the standard framework.
The test correctly uses the analysistest framework to load the plugin, build analyzers, and validate diagnostics against the testdata. The use of GinkgoT() appropriately bridges Ginkgo with the analysis test runner.
</blockquote></details>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1)</summary><blockquote>
1-13: LGTM! Logger stub provides the necessary test interface.
The no-op Logger implementation with the correct method signatures (context, format string, variadic args) is appropriate for analyzer test data.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (7)</summary><blockquote>
14-16: LGTM! Plugin registration follows the standard pattern.
The initialization correctly registers the "ocmlogger" plugin with the factory function, aligning with the plugin name used in configuration and tests.
---
56-58: LGTM! Factory function correctly instantiates the linter.
---
60-68: LGTM! Analyzer metadata is correct.
The analyzer is properly configured with the correct name and documentation.
---
70-90: LGTM! Directive suppression logic is correctly implemented.
The function properly checks for disable comments on the same line or line above, and correctly handles both nolint:ocmlogger and ocm-linter:ignore directives.
---
92-112: LGTM! String extraction handles literals and concatenation appropriately.
The method correctly extracts string literals and handles concatenation with the + operator. Returning false for non-literal expressions is the intended behavior, as documented in the analyzer's logic (lines 170-176).
---
114-130: LGTM! Placeholder counting correctly handles escaped sequences.
The logic properly counts format placeholders while correctly handling escaped %% sequences. The implementation works for standard format specifiers including those with width/precision modifiers.
---
132-194: LGTM! Analyzer logic correctly validates format strings and arguments.
The implementation properly:
The logic is sound and the implementation is clear.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
Actionable comments posted: 0
<details>
<summary>♻️ Duplicate comments (2)</summary><blockquote>
<details>
<summary>go.mod (1)</summary><blockquote>
24-24: Critical: Update golang.org/x/oauth2 to address high-severity vulnerability.
The dependency golang.org/x/oauth2 v0.15.0 remains vulnerable to CVE-2025-22868 (GO-2025-3488), a high-severity DoS vulnerability. This was flagged in a previous review but is still unresolved.
Apply this fix:
- golang.org/x/oauth2 v0.15.0
+ golang.org/x/oauth2 v0.30.0
Then run:
go get golang.org/x/oauth2@v0.30.0
go mod tidy
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
52-54: Critical: Fix the load mode to enable type information.
GetLoadMode() returns register.LoadModeSyntax, but line 153 uses pass.TypesInfo.TypeOf(sel.X) to check receiver types. Type information is unavailable in syntax-only mode, which will cause the analyzer to fail or skip all checks.
Apply this diff:
func (f *OcmLoggerLinter) GetLoadMode() string {
- return register.LoadModeSyntax
+ return register.LoadModeTypesInfo
}
</blockquote></details>
</blockquote></details>
<details>
<summary>🧹 Nitpick comments (3)</summary><blockquote>
<details>
<summary>linters/ocm_logging_linter.go (3)</summary><blockquote>
70-90: Consider caching comment positions for better performance.
The isDisabled method scans all comments in all files for every node checked. For large codebases, this could be inefficient.
Consider building a map of disabled line numbers once per file:
// In run(), before ast.Inspect:
disabledLines := make(map[string]map[int]bool) // filename -> line -> disabled
for _, file := range pass.Files {
filename := pass.Fset.Position(file.Pos()).Filename
disabledLines[filename] = make(map[int]bool)
for _, cg := range file.Comments {
for _, c := range cg.List {
if strings.Contains(c.Text, "nolint:ocmlogger") ||
strings.Contains(c.Text, "ocm-linter:ignore") {
pos := pass.Fset.Position(c.Pos())
disabledLines[filename][pos.Line] = true
}
}
}
}
// Then check: disabledLines[filename][line] || disabledLines[filename][line-1]
---
114-130: Consider more robust format string parsing.
The current implementation counts any % followed by a non-% character as a placeholder. This doesn't account for:
%[1]s (which don't consume sequential arguments)%s (which consume an extra argument)For more accurate analysis, consider using fmt's internal format parsing logic or at least handle the width specifier case:
func (f *OcmLoggerLinter) countPlaceholders(fmtString string) int {
count := 0
for i := 0; i < len(fmtString); i++ {
if fmtString[i] != '%' {
continue
}
if i+1 < len(fmtString) && fmtString[i+1] == '%' {
i++ // skip %%
continue
}
// Skip to verb (simplified - real parsing is complex)
i++
if i < len(fmtString) && fmtString[i] == '*' {
count++ // width argument
i++
}
count++ // the actual placeholder
}
return count
}
Note: Full format string parsing is complex. This approach is acceptable for initial implementation.
---
165-168: Minor: Clarify the comment.
The comment states "If the number of parameters is less than 2, it is a compilation error", but 2 parameters (ctx and msg) is actually valid—only fewer than 2 would be an error.
Consider rewording:
- if len(call.Args) < 2 {
- // If the number of parameters is less than 2, it is a compilation error
- return true
- }
+ if len(call.Args) < 2 {
+ // Logger methods require at least 2 arguments (ctx, msg); fewer would be a compilation error
+ return true
+ }
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between be4af6240d2178a520d41651f05e69f5214de89f and 39ab6b9ab81f819f6b21cd4db26f60ae1949481d.
</details>
<details>
<summary>⛔ Files ignored due to path filters (2)</summary>
examples/go.sum is excluded by !*/.sum
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
examples/go.mod (1 hunks)
go.mod (2 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>
linters/testdata/src/data/data.go
linters/ocm_logging_linter_test.go
</details>
<details>
<summary>🧰 Additional context used</summary>
<details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
<details>
<summary>go.mod</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)</summary>
GitHub Check: Test (1.21, macos-latest)
GitHub Check: Test (1.21, windows-latest)
</details>
<details>
<summary>🔇 Additional comments (6)</summary><blockquote>
<details>
<summary>examples/go.mod (1)</summary><blockquote>
53-57: LGTM! Dependency upgrades aligned with root module.
The transitive dependency updates for golang.org/x/net, golang.org/x/sys, golang.org/x/term, and golang.org/x/text correctly align with the upgrades in the root go.mod.
</blockquote></details>
<details>
<summary>go.mod (1)</summary><blockquote>
22-23: LGTM! Dependency updates support the new linter plugin.
The additions of github.com/golangci/plugin-module-register and golang.org/x/tools, along with the upgrades to various golang.org/x/ packages, appropriately support the new OCM logger linter plugin infrastructure.
Also applies to: 29-29, 33-33, 69-73
</blockquote></details>
<details>
<summary>linters/linters_suite_test.go (1)</summary><blockquote>
1-13: LGTM! Standard Ginkgo test suite bootstrap.
The test suite setup follows standard Ginkgo v2 patterns and correctly integrates with the testing framework.
</blockquote></details>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1)</summary><blockquote>
1-13: LGTM! Appropriate test fixture.
The minimal Logger stub provides the necessary method signatures (Debug, Info, Warn, Error, Fatal) with correct parameters (context.Context, string, ...any) for testing the linter.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (2)</summary><blockquote>
132-194: Core analyzer logic is sound (pending LoadMode fix).
The main analysis logic correctly:
Once the LoadMode issue (line 52-53) is resolved, this should function correctly.
---
102-109: Remove or clarify the binary expression handling.
Go does not support the + operator for string literal concatenation at the source level. Adjacent string literals like "hello" "world" are automatically concatenated by the parser without creating a BinaryExpr node. This branch appears unreachable for valid Go code and may cause confusion.
If this was intended to handle adjacent literals, they're already concatenated in the BasicLit. If you want to support string variables being concatenated, note that those wouldn't be analyzable at compile-time anyway. Consider removing this code:
func (f *OcmLoggerLinter) extractString(expr ast.Expr) (string, bool) {
switch e := expr.(type) {
case *ast.BasicLit:
if e.Kind == token.STRING {
s, err := strconv.Unquote(e.Value)
if err != nil {
return "", false
}
return s, true
}
- case *ast.BinaryExpr:
- if e.Op == token.ADD {
- left, ok1 := f.extractString(e.X)
- right, ok2 := f.extractString(e.Y)
- if ok1 && ok2 {
- return left + right, true
- }
- }
}
return "", false
}
Likely an incorrect or invalid review comment.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
_⚠️ Potential issue_ | _🔴 Critical_
Add bounds check before accessing analyzers[0].
The code accesses analyzers[0] without verifying the slice is non-empty, which will panic if BuildAnalyzers() returns an empty slice.
Apply this diff to add a bounds check:
analyzers, err := plugin.BuildAnalyzers()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
+ gomega.Expect(analyzers).NotTo(gomega.BeEmpty())
analysistest.Run(GinkgoT(), td, analyzers[0], "data")
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
analyzers, err := plugin.BuildAnalyzers()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(analyzers).NotTo(gomega.BeEmpty())
analysistest.Run(GinkgoT(), td, analyzers[0], "data")
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
In linters/ocm_logging_linter_test.go around lines 20 to 22, the test indexes
analyzers[0] without ensuring the slice is non-empty; add a bounds check by
asserting the slice has at least one element (e.g.
gomega.Expect(analyzers).NotTo(gomega.BeEmpty()) or
gomega.Expect(len(analyzers)).To(gomega.BeNumerically(">", 0))) immediately
after the BuildAnalyzers call, then proceed to call analysistest.Run with
analyzers[0]; ensure the test fails clearly if the slice is empty.
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
Actionable comments posted: 1
<details>
<summary>♻️ Duplicate comments (1)</summary><blockquote>
<details>
<summary>go.mod (1)</summary><blockquote>
24-24: ⚠️ Critical: Update golang.org/x/oauth2 to address high-severity vulnerability (UNRESOLVED from prior review).
The version v0.15.0 is affected by CVE-2025-22868 (GO-2025-3488) and GHSA-6v2p-p543-phr9—high-severity DoS vulnerabilities in token parsing. This issue was flagged in a previous review and remains unresolved. This is a blocker and must be fixed before merging.
Apply this fix:
- golang.org/x/oauth2 v0.15.0
+ golang.org/x/oauth2 v0.30.0
Then run:
go get golang.org/x/oauth2@v0.30.0
go mod tidy
Verify compatibility with your tests before merging.
</blockquote></details>
</blockquote></details>
<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>
<details>
<summary>linters/ocm_logging_linter_test.go (1)</summary><blockquote>
22-22: Consider testing all analyzers instead of just the first.
The test currently only runs analyzers[0]. If the plugin provides multiple analyzers, consider iterating through all of them to ensure complete test coverage.
If multiple analyzers are expected, apply this diff:
- analysistest.Run(GinkgoT(), td, analyzers[0], "data")
+ for _, analyzer := range analyzers {
+ analysistest.Run(GinkgoT(), td, analyzer, "data")
+ }
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 39ab6b9ab81f819f6b21cd4db26f60ae1949481d and a3f2ed4384bd566a7deb18ee9e1f1047b361e7c6.
</details>
<details>
<summary>⛔ Files ignored due to path filters (2)</summary>
examples/go.sum is excluded by !/.sum
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
examples/go.mod (1 hunks)
go.mod (2 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (5)</summary>
linters/testdata/src/data/data.go
linters/linters_suite_test.go
linters/ocm_logging_linter.go
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go
examples/go.mod
</details>
<details>
<summary>🧰 Additional context used</summary>
<details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
<details>
<summary>go.mod</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)</summary>
GitHub Check: Test (1.21, windows-latest)
GitHub Check: Test (1.21, macos-latest)
</details>
<details>
<summary>🔇 Additional comments (3)</summary><blockquote>
<details>
<summary>go.mod (2)</summary><blockquote>
22-23: Verify compatibility of golang.org/x/crypto and golang.org/x/net updates.
The updates from v0.20.0 → v0.37.0 (crypto) and v0.21.0 → v0.39.0 (net) are substantial. Ensure these version jumps do not introduce breaking changes with your OAuth2/TLS usage patterns or the linter infrastructure.
---
29-29: ✅ New linter infrastructure dependencies look appropriate.
The additions of github.com/golangci/plugin-module-register v0.1.2 and golang.org/x/tools v0.32.0 align well with the PR's objective to add a custom OCM logger linter. Placing them in the second require block is the correct pattern for toolchain dependencies. The indirect dependency updates (lines 69–73) are expected transitive consequences.
Also applies to: 33-33, 69-73
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter_test.go (1)</summary><blockquote>
17-17: No issues found. The code is correct.
The nil parameter is intentionally handled by the plugin's New function signature accepting any type. The BuildAnalyzers() method always returns a slice with exactly one analyzer, making the access to analyzers[0] safe and the test coverage complete.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
lgtm
Approved these changes.
@ziccardi, can you please resolve the conflicts?
Actionable comments posted: 0
<details>
<summary>♻️ Duplicate comments (2)</summary><blockquote>
<details>
<summary>go.mod (1)</summary><blockquote>
22-24: Still using vulnerable golang.org/x/oauth2 v0.15.0 – please bump to a fixed release.
Static analysis (and a prior review) flag v0.15.0 as affected by high‑severity issues (e.g. GO-2025-3488 / GHSA-6v2p-p543-phr9). It’s safer to update this along with the other x/ bumps, e.g. to v0.30.0 (or the current recommended version) and re‑run tests.
A concrete change you can apply:
- golang.org/x/oauth2 v0.15.0
+ golang.org/x/oauth2 v0.30.0
Then locally run:
go get golang.org/x/oauth2@v0.30.0
go mod tidy
go test ./...
to verify compatibility and adjust if newer API changes require it.
</blockquote></details>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
47-54: Load mode must include type info since run() relies on pass.TypesInfo.
run calls pass.TypesInfo.TypeOf(sel.X), but GetLoadMode currently returns register.LoadModeSyntax, which may not populate TypesInfo and can lead to missing type information or panics depending on the loader. This linter needs a load mode that provides type info.
Suggested fix:
-func (l *OcmLoggerLinter) GetLoadMode() string { return register.LoadModeSyntax }
+func (l *OcmLoggerLinter) GetLoadMode() string { return register.LoadModeTypesInfo }
After this change, verify that the plugin still loads correctly under golangci-lint with the updated golang.org/x/tools and that pass.TypesInfo is non‑nil in your tests.
Also applies to: 158-193
</blockquote></details>
</blockquote></details>
<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>
<details>
<summary>linters/ocm_logging_linter.go (1)</summary><blockquote>
140-156: Placeholder counting is simple and may flag advanced fmt patterns.
countPlaceholders treats every non‑%% % as a placeholder, which is fine for typical log messages but will miscount patterns like %d or indexed verbs (%[2]d) where a single placeholder consumes multiple or reused arguments. If such patterns are common in logs, consider tightening the parser to better approximate fmt semantics; otherwise this is acceptable as a deliberate trade‑off.
</blockquote></details>
</blockquote></details>
<details>
<summary>📜 Review details</summary>
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
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between a3f2ed4384bd566a7deb18ee9e1f1047b361e7c6 and 5dbf4ac787a5e09239642b6b456cc412a1788c05.
</details>
<details>
<summary>⛔ Files ignored due to path filters (2)</summary>
examples/go.sum is excluded by !/.sum
go.sum is excluded by !/.sum
</details>
<details>
<summary>📒 Files selected for processing (7)</summary>
examples/go.mod (1 hunks)
go.mod (2 hunks)
linters/linters_suite_test.go (1 hunks)
linters/ocm_logging_linter.go (1 hunks)
linters/ocm_logging_linter_test.go (1 hunks)
linters/testdata/src/data/data.go (1 hunks)
linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1 hunks)
</details>
<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>
linters/linters_suite_test.go
linters/ocm_logging_linter_test.go
</details>
<details>
<summary>🧰 Additional context used</summary>
<details>
<summary>🧬 Code graph analysis (1)</summary>
<details>
<summary>linters/testdata/src/data/data.go (1)</summary><blockquote>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (6)</summary>
Logger (7-7)
Logger (9-9)
Logger (10-10)
Logger (11-11)
Logger (12-12)
Logger (13-13)
</details>
</blockquote></details>
</details><details>
<summary>🪛 OSV Scanner (2.2.4)</summary>
<details>
<summary>go.mod</summary>
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: Unexpected memory consumption during token parsing in golang.org/x/oauth2
(GO-2025-3488)
---
[HIGH] 24-24: golang.org/x/oauth2 0.15.0: golang.org/x/oauth2 Improper Validation of Syntactic Correctness of Input vulnerability
(GHSA-6v2p-p543-phr9)
</details>
</details>
</details>
<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)</summary>
GitHub Check: Generate
GitHub Check: Test (1.21, ubuntu-latest)
GitHub Check: Test (1.21, windows-latest)
GitHub Check: Test (1.21, macos-latest)
GitHub Check: Lint
</details>
<details>
<summary>🔇 Additional comments (3)</summary><blockquote>
<details>
<summary>examples/go.mod (1)</summary><blockquote>
53-57: Examples module deps aligned with root go.mod.
Updating the x/net, x/sys, x/term, and x/text versions here to match the root module keeps the examples in lockstep with the main SDK and looks good.
</blockquote></details>
<details>
<summary>linters/testdata/src/data/data.go (1)</summary><blockquote>
1-50: Testdata nicely exercises formatting, %% handling, and nolint behavior.
These cases cover literal vs dynamic formats, correct counting of placeholders with %%, and both same‑line and previous‑line //nolint:ocmlogger suppression, which matches the linter logic and should give good confidence in behavior.
</blockquote></details>
<details>
<summary>linters/testdata/src/github.com/openshift-online/ocm-sdk-go/logging/logging.go (1)</summary><blockquote>
1-13: Logger stub matches the linter’s expected receiver type.
The stub’s type and method signatures line up with the string type checks in the linter (logging.Logger / *logging.Logger), so it’s a good fit for testdata without adding runtime behavior.
</blockquote></details>
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/openshift-online/ocm-sdk-go/pull/1101#pullrequestreview-3460378122" title="Approved">andreadecorte</a>, <a href="https://github.com/openshift-online/ocm-sdk-go/pull/1101#issuecomment-3575988321" title="Approved">oriAdler</a>, <a href="https://github.com/openshift-online/ocm-sdk-go/pull/1101#" title="Author self-approved">ziccardi</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
security/snyk failure seems like a known issue https://redhat-internal.slack.com/archives/C06M02W2L01/p1753702448730799
@ziccardi, thanks for adding this enhancement :)
Verified the changes locally:
make lint
golangci-lint --version
golangci-lint has version (devel) built with go1.24.7 from (unknown, modified: ?, mod sum: "") on (unknown)
golangci-lint custom
/home/oadler/github.com/openshift-online/ocm-sdk-go/bin/ocm-lint run
leadership/flag.go:325:6: number of format placeholders (1) does not match number of arguments (3) (ocmlogger)
f.logger.Error(
^
leadership/flag.go:385:4: number of format placeholders (2) does not match number of arguments (3) (ocmlogger)
f.logger.Error(
^
leadership/flag.go:466:4: number of format placeholders (3) does not match number of arguments (2) (ocmlogger)
f.logger.Error(
^
3 issues:
* ocmlogger: 3
make: *** [Makefile:102: lint] Error 1
andreadecorte
ziccardi
Linting issues in using ocm logger were not detected by the linter because the logger methods are not ending with
fand the first parameter is not the string format. This PR adds a custom linter to detect them.This PR just adds the linter code. A following PR will enable it into the Makefile
linter output example:
How to run it locally
This MR does not enable the linter because otherwise the linting step of the CI will fail. The reason is that the linter runs with the linters from
masterand doesn't see the new one introduced by this PR.That means that if you want to test this PR locally you will have to add the missing configuration manually
1. Create a file called .custom-gcl.yml in the root of the project with the following content:
2. Modify the .golangici.yml file adding the following into the
linterssection:3. change the Makefile
linttarget: