Skip to content

fix(modernize): camelcase-config rule false-positives on schema-defined snake_case keys#309

Merged
intel352 merged 5 commits intomainfrom
copilot/modernize-camelcase-config-rule
Mar 12, 2026
Merged

fix(modernize): camelcase-config rule false-positives on schema-defined snake_case keys#309
intel352 merged 5 commits intomainfrom
copilot/modernize-camelcase-config-rule

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

The camelcase-config rule flagged snake_case config keys that are intentionally snake_case because the module's own schema defines them that way (e.g. openapi's spec_file, register_routes, swagger_ui, max_body_bytes). Suggesting camelCase for these keys would break the config.

Changes

  • modernize/rules.go: camelCaseConfigRule() now instantiates schema.NewModuleSchemaRegistry() once at rule-creation time. For each module node, it resolves the type field and builds a set of schema-defined key names — any key matching a schema-declared field is exempt from the snake_case check.
  • cmd/wfctl/modernize_test.go: Two new tests:
    • Schema-defined snake_case keys on a known module type (openapi) produce zero findings
    • Unknown module types still have their snake_case keys flagged as before

Example — no longer flagged

- name: api-docs
  type: openapi
  config:
    spec_file: ./specs/api.yaml       # schema-defined → exempt
    register_routes: false            # schema-defined → exempt
    swagger_ui:                       # schema-defined → exempt
      enabled: true
      path: /docs
Original prompt

This section details on the original issue you should resolve

<issue_title>modernize camelcase-config rule: false positive for openapi plugin snake_case config keys</issue_title>
<issue_description>## Summary

The modernize command's camelcase-config rule flags the openapi module's config keys (spec_file, register_routes, swagger_ui) as anti-patterns, suggesting camelCase instead. However, these are the official config key names defined by the openapi plugin itself.

Reproduction

- name: api-docs
  type: openapi
  config:
    spec_file: ./specs/chimera-api.yaml
    register_routes: false
    swagger_ui:
      enabled: true
      path: /docs

Running modernize on this config produces:

Module "api-docs" config key "spec_file" is snake_case (use camelCase)
Module "api-docs" config key "register_routes" is snake_case (use camelCase)
Module "api-docs" config key "swagger_ui" is snake_case (use camelCase)

Expected Behavior

The camelcase-config rule should be aware of the actual config schema for each module type. If the module's schema defines keys in snake_case (as confirmed by get_module_schema openapi), those keys should not be flagged.

Verification

get_module_schema openapi returns spec_file, register_routes, swagger_ui, and max_body_bytes — all snake_case. Using camelCase variants would likely break the config.

Suggested Fix

Either:

  1. Have camelcase-config consult the module's config schema and skip keys that match the schema's own names, or
  2. Maintain a per-module-type allowlist of snake_case keys that are intentional

Environment

  • workflow v0.3.33
  • wfctl (latest as of 2026-03-12)</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…e rule

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix false positive for openapi plugin snake_case config keys fix(modernize): camelcase-config rule false-positives on schema-defined snake_case keys Mar 12, 2026
@intel352 intel352 marked this pull request as ready for review March 12, 2026 11:50
Copilot AI review requested due to automatic review settings March 12, 2026 11:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the modernize CLI’s camelcase-config rule to avoid false positives when a module’s schema intentionally defines snake_case config keys (e.g., openapi), preventing suggestions that would break valid configs.

Changes:

  • Teach camelcase-config to consult the module schema registry and exempt schema-declared config keys from snake_case findings.
  • Add tests confirming schema-defined snake_case keys for openapi are not flagged.
  • Add a regression test ensuring unknown module types still have snake_case keys flagged.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
modernize/rules.go Exempts schema-declared config keys (per module type) from the snake_case check to prevent invalid modernization advice.
cmd/wfctl/modernize_test.go Adds coverage for the new exemption behavior and ensures unknown module types retain prior behavior.
Comments suppressed due to low confidence (1)

modernize/rules.go:637

  • The rule description says the engine "requires camelCase", but the rule now explicitly allows schema-defined snake_case keys. Consider adjusting the description to avoid implying snake_case is always invalid (e.g., "typically requires camelCase" or "except where the module schema defines otherwise").
		ID:          "camelcase-config",
		Description: "Detect snake_case config field names (engine requires camelCase)",
		Severity:    "warning",

Comment on lines +525 to +530
doc := parseTestYAML(t, input)
findings := rule.Check(doc, []byte(input))
if len(findings) == 0 {
t.Fatal("expected findings for snake_case config keys on unknown module type")
}
}
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This test only asserts that some finding is produced. To better cover the intended behavior and catch regressions (e.g., wrong key reported), assert that at least one finding message mentions snake_key (and optionally the module name/type) instead of only checking len(findings) > 0.

Copilot generated this review using guidance from organization custom instructions.
@github-actions
Copy link

github-actions bot commented Mar 12, 2026

⏱ Benchmark Results

No significant performance regressions detected.

benchstat comparison (baseline → PR)
## benchstat: baseline → PR
baseline-bench.txt:244: parsing iteration count: invalid syntax
baseline-bench.txt:306365: parsing iteration count: invalid syntax
baseline-bench.txt:577797: parsing iteration count: invalid syntax
baseline-bench.txt:870229: parsing iteration count: invalid syntax
baseline-bench.txt:1165838: parsing iteration count: invalid syntax
baseline-bench.txt:1449918: parsing iteration count: invalid syntax
benchmark-results.txt:244: parsing iteration count: invalid syntax
benchmark-results.txt:313481: parsing iteration count: invalid syntax
benchmark-results.txt:614937: parsing iteration count: invalid syntax
benchmark-results.txt:931066: parsing iteration count: invalid syntax
benchmark-results.txt:1251320: parsing iteration count: invalid syntax
benchmark-results.txt:1549656: parsing iteration count: invalid syntax
goos: linux
goarch: amd64
pkg: github.com/GoCodeAlone/workflow/dynamic
cpu: AMD EPYC 7763 64-Core Processor                
                            │ benchmark-results.txt │
                            │        sec/op         │
InterpreterCreation-4                  7.339m ± 60%
ComponentLoad-4                        3.425m ±  8%
ComponentExecute-4                     1.988µ ±  2%
PoolContention/workers-1-4             1.084µ ±  5%
PoolContention/workers-2-4             1.080µ ±  1%
PoolContention/workers-4-4             1.082µ ±  1%
PoolContention/workers-8-4             1.083µ ±  2%
PoolContention/workers-16-4            1.088µ ±  2%
ComponentLifecycle-4                   3.464m ±  1%
SourceValidation-4                     2.299µ ±  1%
RegistryConcurrent-4                   751.3n ±  6%
LoaderLoadFromString-4                 3.480m ±  1%
geomean                                18.44µ

                            │ benchmark-results.txt │
                            │         B/op          │
InterpreterCreation-4                  1.944Mi ± 0%
ComponentLoad-4                        2.097Mi ± 0%
ComponentExecute-4                     1.203Ki ± 0%
PoolContention/workers-1-4             1.203Ki ± 0%
PoolContention/workers-2-4             1.203Ki ± 0%
PoolContention/workers-4-4             1.203Ki ± 0%
PoolContention/workers-8-4             1.203Ki ± 0%
PoolContention/workers-16-4            1.203Ki ± 0%
ComponentLifecycle-4                   2.099Mi ± 0%
SourceValidation-4                     1.984Ki ± 0%
RegistryConcurrent-4                   1.133Ki ± 0%
LoaderLoadFromString-4                 2.099Mi ± 0%
geomean                                15.05Ki

                            │ benchmark-results.txt │
                            │       allocs/op       │
InterpreterCreation-4                   15.09k ± 0%
ComponentLoad-4                         17.43k ± 0%
ComponentExecute-4                       25.00 ± 0%
PoolContention/workers-1-4               25.00 ± 0%
PoolContention/workers-2-4               25.00 ± 0%
PoolContention/workers-4-4               25.00 ± 0%
PoolContention/workers-8-4               25.00 ± 0%
PoolContention/workers-16-4              25.00 ± 0%
ComponentLifecycle-4                    17.48k ± 0%
SourceValidation-4                       32.00 ± 0%
RegistryConcurrent-4                     2.000 ± 0%
LoaderLoadFromString-4                  17.47k ± 0%
geomean                                  181.2

cpu: AMD EPYC 9V74 80-Core Processor                
                            │ baseline-bench.txt │
                            │       sec/op       │
InterpreterCreation-4               6.393m ± 63%
ComponentLoad-4                     3.411m ±  1%
ComponentExecute-4                  1.907µ ±  3%
PoolContention/workers-1-4          1.049µ ±  2%
PoolContention/workers-2-4          1.041µ ±  1%
PoolContention/workers-4-4          1.053µ ±  1%
PoolContention/workers-8-4          1.049µ ±  1%
PoolContention/workers-16-4         1.043µ ±  1%
ComponentLifecycle-4                3.472m ±  2%
SourceValidation-4                  2.075µ ±  1%
RegistryConcurrent-4                762.4n ±  1%
LoaderLoadFromString-4              3.558m ±  1%
geomean                             17.81µ

                            │ baseline-bench.txt │
                            │        B/op        │
InterpreterCreation-4               1.944Mi ± 0%
ComponentLoad-4                     2.097Mi ± 0%
ComponentExecute-4                  1.203Ki ± 0%
PoolContention/workers-1-4          1.203Ki ± 0%
PoolContention/workers-2-4          1.203Ki ± 0%
PoolContention/workers-4-4          1.203Ki ± 0%
PoolContention/workers-8-4          1.203Ki ± 0%
PoolContention/workers-16-4         1.203Ki ± 0%
ComponentLifecycle-4                2.099Mi ± 0%
SourceValidation-4                  1.984Ki ± 0%
RegistryConcurrent-4                1.133Ki ± 0%
LoaderLoadFromString-4              2.099Mi ± 0%
geomean                             15.05Ki

                            │ baseline-bench.txt │
                            │     allocs/op      │
InterpreterCreation-4                15.09k ± 0%
ComponentLoad-4                      17.43k ± 0%
ComponentExecute-4                    25.00 ± 0%
PoolContention/workers-1-4            25.00 ± 0%
PoolContention/workers-2-4            25.00 ± 0%
PoolContention/workers-4-4            25.00 ± 0%
PoolContention/workers-8-4            25.00 ± 0%
PoolContention/workers-16-4           25.00 ± 0%
ComponentLifecycle-4                 17.48k ± 0%
SourceValidation-4                    32.00 ± 0%
RegistryConcurrent-4                  2.000 ± 0%
LoaderLoadFromString-4               17.47k ± 0%
geomean                               181.2

pkg: github.com/GoCodeAlone/workflow/middleware
cpu: AMD EPYC 7763 64-Core Processor                
                                  │ benchmark-results.txt │
                                  │        sec/op         │
CircuitBreakerDetection-4                     287.5n ± 2%
CircuitBreakerExecution_Success-4             22.50n ± 0%
CircuitBreakerExecution_Failure-4             64.38n ± 0%
geomean                                       74.68n

                                  │ benchmark-results.txt │
                                  │         B/op          │
CircuitBreakerDetection-4                    144.0 ± 0%
CircuitBreakerExecution_Success-4            0.000 ± 0%
CircuitBreakerExecution_Failure-4            0.000 ± 0%
geomean                                                 ¹
¹ summaries must be >0 to compute geomean

                                  │ benchmark-results.txt │
                                  │       allocs/op       │
CircuitBreakerDetection-4                    1.000 ± 0%
CircuitBreakerExecution_Success-4            0.000 ± 0%
CircuitBreakerExecution_Failure-4            0.000 ± 0%
geomean                                                 ¹
¹ summaries must be >0 to compute geomean

cpu: AMD EPYC 9V74 80-Core Processor                
                                  │ baseline-bench.txt │
                                  │       sec/op       │
CircuitBreakerDetection-4                  297.2n ± 1%
CircuitBreakerExecution_Success-4          22.69n ± 0%
CircuitBreakerExecution_Failure-4          70.42n ± 1%
geomean                                    78.02n

                                  │ baseline-bench.txt │
                                  │        B/op        │
CircuitBreakerDetection-4                 144.0 ± 0%
CircuitBreakerExecution_Success-4         0.000 ± 0%
CircuitBreakerExecution_Failure-4         0.000 ± 0%
geomean                                              ¹
¹ summaries must be >0 to compute geomean

                                  │ baseline-bench.txt │
                                  │     allocs/op      │
CircuitBreakerDetection-4                 1.000 ± 0%
CircuitBreakerExecution_Success-4         0.000 ± 0%
CircuitBreakerExecution_Failure-4         0.000 ± 0%
geomean                                              ¹
¹ summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/module
cpu: AMD EPYC 7763 64-Core Processor                
                                 │ benchmark-results.txt │
                                 │        sec/op         │
JQTransform_Simple-4                        905.7n ± 25%
JQTransform_ObjectConstruction-4            1.460µ ± 28%
JQTransform_ArraySelect-4                   3.318µ ±  1%
JQTransform_Complex-4                       37.73µ ±  0%
JQTransform_Throughput-4                    1.780µ ±  1%
SSEPublishDelivery-4                        61.81n ±  0%
geomean                                     1.622µ

                                 │ benchmark-results.txt │
                                 │         B/op          │
JQTransform_Simple-4                      1.273Ki ± 0%
JQTransform_ObjectConstruction-4          1.773Ki ± 0%
JQTransform_ArraySelect-4                 2.625Ki ± 0%
JQTransform_Complex-4                     16.22Ki ± 0%
JQTransform_Throughput-4                  1.984Ki ± 0%
SSEPublishDelivery-4                        0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

                                 │ benchmark-results.txt │
                                 │       allocs/op       │
JQTransform_Simple-4                        10.00 ± 0%
JQTransform_ObjectConstruction-4            15.00 ± 0%
JQTransform_ArraySelect-4                   30.00 ± 0%
JQTransform_Complex-4                       324.0 ± 0%
JQTransform_Throughput-4                    17.00 ± 0%
SSEPublishDelivery-4                        0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

cpu: AMD EPYC 9V74 80-Core Processor                
                                 │ baseline-bench.txt │
                                 │       sec/op       │
JQTransform_Simple-4                     835.6n ± 32%
JQTransform_ObjectConstruction-4         1.412µ ± 26%
JQTransform_ArraySelect-4                3.405µ ±  3%
JQTransform_Complex-4                    41.77µ ±  3%
JQTransform_Throughput-4                 1.741µ ±  1%
SSEPublishDelivery-4                     56.49n ±  1%
geomean                                  1.596µ

                                 │ baseline-bench.txt │
                                 │        B/op        │
JQTransform_Simple-4                   1.273Ki ± 0%
JQTransform_ObjectConstruction-4       1.773Ki ± 0%
JQTransform_ArraySelect-4              2.625Ki ± 0%
JQTransform_Complex-4                  16.22Ki ± 0%
JQTransform_Throughput-4               1.984Ki ± 0%
SSEPublishDelivery-4                     0.000 ± 0%
geomean                                             ¹
¹ summaries must be >0 to compute geomean

                                 │ baseline-bench.txt │
                                 │     allocs/op      │
JQTransform_Simple-4                     10.00 ± 0%
JQTransform_ObjectConstruction-4         15.00 ± 0%
JQTransform_ArraySelect-4                30.00 ± 0%
JQTransform_Complex-4                    324.0 ± 0%
JQTransform_Throughput-4                 17.00 ± 0%
SSEPublishDelivery-4                     0.000 ± 0%
geomean                                             ¹
¹ summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/schema
cpu: AMD EPYC 7763 64-Core Processor                
                                    │ benchmark-results.txt │
                                    │        sec/op         │
SchemaValidation_Simple-4                       1.124µ ± 5%
SchemaValidation_AllFields-4                    1.694µ ± 5%
SchemaValidation_FormatValidation-4             1.600µ ± 2%
SchemaValidation_ManySchemas-4                  1.836µ ± 3%
geomean                                         1.538µ

                                    │ benchmark-results.txt │
                                    │         B/op          │
SchemaValidation_Simple-4                      0.000 ± 0%
SchemaValidation_AllFields-4                   0.000 ± 0%
SchemaValidation_FormatValidation-4            0.000 ± 0%
SchemaValidation_ManySchemas-4                 0.000 ± 0%
geomean                                                   ¹
¹ summaries must be >0 to compute geomean

                                    │ benchmark-results.txt │
                                    │       allocs/op       │
SchemaValidation_Simple-4                      0.000 ± 0%
SchemaValidation_AllFields-4                   0.000 ± 0%
SchemaValidation_FormatValidation-4            0.000 ± 0%
SchemaValidation_ManySchemas-4                 0.000 ± 0%
geomean                                                   ¹
¹ summaries must be >0 to compute geomean

cpu: AMD EPYC 9V74 80-Core Processor                
                                    │ baseline-bench.txt │
                                    │       sec/op       │
SchemaValidation_Simple-4                    1.084µ ± 6%
SchemaValidation_AllFields-4                 1.631µ ± 5%
SchemaValidation_FormatValidation-4          1.567µ ± 5%
SchemaValidation_ManySchemas-4               1.581µ ± 2%
geomean                                      1.446µ

                                    │ baseline-bench.txt │
                                    │        B/op        │
SchemaValidation_Simple-4                   0.000 ± 0%
SchemaValidation_AllFields-4                0.000 ± 0%
SchemaValidation_FormatValidation-4         0.000 ± 0%
SchemaValidation_ManySchemas-4              0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

                                    │ baseline-bench.txt │
                                    │     allocs/op      │
SchemaValidation_Simple-4                   0.000 ± 0%
SchemaValidation_AllFields-4                0.000 ± 0%
SchemaValidation_FormatValidation-4         0.000 ± 0%
SchemaValidation_ManySchemas-4              0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/store
cpu: AMD EPYC 7763 64-Core Processor                
                                   │ benchmark-results.txt │
                                   │        sec/op         │
EventStoreAppend_InMemory-4                   1.148µ ±  7%
EventStoreAppend_SQLite-4                     1.539m ±  4%
GetTimeline_InMemory/events-10-4              14.07µ ±  3%
GetTimeline_InMemory/events-50-4              68.87µ ± 11%
GetTimeline_InMemory/events-100-4             123.9µ ±  0%
GetTimeline_InMemory/events-500-4             641.3µ ±  1%
GetTimeline_InMemory/events-1000-4            1.308m ±  0%
GetTimeline_SQLite/events-10-4                109.3µ ±  1%
GetTimeline_SQLite/events-50-4                250.7µ ±  3%
GetTimeline_SQLite/events-100-4               422.7µ ±  1%
GetTimeline_SQLite/events-500-4               1.788m ±  0%
GetTimeline_SQLite/events-1000-4              3.493m ±  1%
geomean                                       220.0µ

                                   │ benchmark-results.txt │
                                   │         B/op          │
EventStoreAppend_InMemory-4                     808.5 ± 8%
EventStoreAppend_SQLite-4                     1.983Ki ± 2%
GetTimeline_InMemory/events-10-4              7.953Ki ± 0%
GetTimeline_InMemory/events-50-4              46.62Ki ± 0%
GetTimeline_InMemory/events-100-4             94.48Ki ± 0%
GetTimeline_InMemory/events-500-4             472.8Ki ± 0%
GetTimeline_InMemory/events-1000-4            944.3Ki ± 0%
GetTimeline_SQLite/events-10-4                16.74Ki ± 0%
GetTimeline_SQLite/events-50-4                87.14Ki ± 0%
GetTimeline_SQLite/events-100-4               175.4Ki ± 0%
GetTimeline_SQLite/events-500-4               846.1Ki ± 0%
GetTimeline_SQLite/events-1000-4              1.639Mi ± 0%
geomean                                       67.47Ki

                                   │ benchmark-results.txt │
                                   │       allocs/op       │
EventStoreAppend_InMemory-4                     7.000 ± 0%
EventStoreAppend_SQLite-4                       53.00 ± 0%
GetTimeline_InMemory/events-10-4                125.0 ± 0%
GetTimeline_InMemory/events-50-4                653.0 ± 0%
GetTimeline_InMemory/events-100-4              1.306k ± 0%
GetTimeline_InMemory/events-500-4              6.514k ± 0%
GetTimeline_InMemory/events-1000-4             13.02k ± 0%
GetTimeline_SQLite/events-10-4                  382.0 ± 0%
GetTimeline_SQLite/events-50-4                 1.852k ± 0%
GetTimeline_SQLite/events-100-4                3.681k ± 0%
GetTimeline_SQLite/events-500-4                18.54k ± 0%
GetTimeline_SQLite/events-1000-4               37.29k ± 0%
geomean                                        1.162k

cpu: AMD EPYC 9V74 80-Core Processor                
                                   │ baseline-bench.txt │
                                   │       sec/op       │
EventStoreAppend_InMemory-4                1.189µ ± 12%
EventStoreAppend_SQLite-4                  1.134m ± 10%
GetTimeline_InMemory/events-10-4           12.59µ ±  3%
GetTimeline_InMemory/events-50-4           55.96µ ± 29%
GetTimeline_InMemory/events-100-4          111.8µ ±  1%
GetTimeline_InMemory/events-500-4          567.2µ ±  1%
GetTimeline_InMemory/events-1000-4         1.155m ±  1%
GetTimeline_SQLite/events-10-4             90.19µ ±  1%
GetTimeline_SQLite/events-50-4             227.7µ ±  1%
GetTimeline_SQLite/events-100-4            394.9µ ±  2%
GetTimeline_SQLite/events-500-4            1.717m ±  1%
GetTimeline_SQLite/events-1000-4           3.364m ±  1%
geomean                                    196.2µ

                                   │ baseline-bench.txt │
                                   │        B/op        │
EventStoreAppend_InMemory-4                  754.0 ± 8%
EventStoreAppend_SQLite-4                  1.983Ki ± 1%
GetTimeline_InMemory/events-10-4           7.953Ki ± 0%
GetTimeline_InMemory/events-50-4           46.62Ki ± 0%
GetTimeline_InMemory/events-100-4          94.48Ki ± 0%
GetTimeline_InMemory/events-500-4          472.8Ki ± 0%
GetTimeline_InMemory/events-1000-4         944.3Ki ± 0%
GetTimeline_SQLite/events-10-4             16.74Ki ± 0%
GetTimeline_SQLite/events-50-4             87.14Ki ± 0%
GetTimeline_SQLite/events-100-4            175.4Ki ± 0%
GetTimeline_SQLite/events-500-4            846.1Ki ± 0%
GetTimeline_SQLite/events-1000-4           1.639Mi ± 0%
geomean                                    67.08Ki

                                   │ baseline-bench.txt │
                                   │     allocs/op      │
EventStoreAppend_InMemory-4                  7.000 ± 0%
EventStoreAppend_SQLite-4                    53.00 ± 0%
GetTimeline_InMemory/events-10-4             125.0 ± 0%
GetTimeline_InMemory/events-50-4             653.0 ± 0%
GetTimeline_InMemory/events-100-4           1.306k ± 0%
GetTimeline_InMemory/events-500-4           6.514k ± 0%
GetTimeline_InMemory/events-1000-4          13.02k ± 0%
GetTimeline_SQLite/events-10-4               382.0 ± 0%
GetTimeline_SQLite/events-50-4              1.852k ± 0%
GetTimeline_SQLite/events-100-4             3.681k ± 0%
GetTimeline_SQLite/events-500-4             18.54k ± 0%
GetTimeline_SQLite/events-1000-4            37.29k ± 0%
geomean                                     1.162k

Benchmarks run with go test -bench=. -benchmem -count=6.
Regressions ≥ 20% are flagged. Results compared via benchstat.

@intel352
Copy link
Contributor

@copilot apply changes based on the comments in this thread

Also fix the failing linter

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 12, 2026

@copilot apply changes based on the comments in this thread

Also fix the failing linter

Applied in b0249f4:

  • Linter fix: Replaced for _, field := range ms.ConfigFields with index-based iteration (for i := range ms.ConfigFields) to avoid the rangeValCopy gocritic warning.
  • Schema key caching: Introduced a schemaKeyCache map[string]map[string]bool (keyed by module type) that is populated lazily. Subsequent modules of the same type reuse the cached set instead of rebuilding it.
  • Stronger test assertion: TestCamelCaseConfigCheck_UnknownModuleTypeStillFlagged now verifies that at least one finding message contains "snake_key" rather than just checking len(findings) > 0.

@intel352
Copy link
Contributor

@copilot Fix the failing linter

Copy link
Contributor Author

Copilot AI commented Mar 12, 2026

@copilot Fix the failing linter

The linter is already passing on the current HEAD (7bae68c). The ifElseChain failure you saw was on the intermediate merge commit b1e9206 — it was resolved when main was merged again at 7bae68c, which brought in the switch statement fix from another PR. Running golangci-lint run locally now reports 0 issues.

@intel352 intel352 merged commit 2144385 into main Mar 12, 2026
12 checks passed
@intel352 intel352 deleted the copilot/modernize-camelcase-config-rule branch March 12, 2026 16:15
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.

modernize camelcase-config rule: false positive for openapi plugin snake_case config keys

3 participants