From 0ca3301ebf61276d0547359bdc2508b31f52fd20 Mon Sep 17 00:00:00 2001 From: Ken'ichiro Oyama Date: Wed, 10 Sep 2025 10:42:02 +0900 Subject: [PATCH] fix: rename stepLength to stepCount --- README.md | 4 ++-- config/config.go | 4 ++-- tailor/helper_test.go | 2 +- tailor/lint.go | 8 ++++---- tailor/lint_test.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cb38633..c4d7b2c 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ lint: allowStateFlow: false insecureAuthorization: enabled: false - stepLength: + stepCount: enabled: true max: 30 multipleMutations: @@ -208,7 +208,7 @@ lint: - https://docs.tailor.tech/reference/service-lifecycle-policy - Enabled by default to promote migration away from deprecated features - **insecureAuthorization** - Detect insecure authorization patterns -- **stepLength** - Ensure pipeline steps don't exceed maximum length +- **stepCount** - Ensure pipeline steps don't exceed maximum count - **multipleMutations** - Identify multiple mutations in a single operation - **queryBeforeMutation** - Check for queries before mutations diff --git a/config/config.go b/config/config.go index a321ad2..10c906b 100644 --- a/config/config.go +++ b/config/config.go @@ -27,7 +27,7 @@ type Rules struct { type Pipeline struct { DeprecatedFeature PipelineDeprecatedFeature `yaml:"deprecatedFeature,omitempty,omitzero"` InsecureAuthorization InsecureAuthorization `yaml:"insecureAuthorization,omitempty,omitzero"` - StepLength StepLength `yaml:"stepLength,omitempty,omitzero"` + StepCount StepCount `yaml:"stepCount,omitempty,omitzero"` MultipleMutations MultipleMutations `yaml:"multipleMutations,omitempty,omitzero"` QueryBeforeMutation QueryBeforeMutation `yaml:"queryBeforeMutation,omitempty,omitzero"` } @@ -43,7 +43,7 @@ type InsecureAuthorization struct { Enabled bool `default:"true" yaml:"enabled,omitempty"` } -type StepLength struct { +type StepCount struct { Enabled bool `default:"true" yaml:"enabled,omitempty"` Max int `default:"30" yaml:"max,omitempty"` } diff --git a/tailor/helper_test.go b/tailor/helper_test.go index 69095c5..a97dd08 100644 --- a/tailor/helper_test.go +++ b/tailor/helper_test.go @@ -26,7 +26,7 @@ func createTestConfig(t *testing.T) *config.Config { InsecureAuthorization: config.InsecureAuthorization{ Enabled: true, }, - StepLength: config.StepLength{ + StepCount: config.StepCount{ Enabled: true, Max: 10, }, diff --git a/tailor/lint.go b/tailor/lint.go index d9b009f..5344bb9 100644 --- a/tailor/lint.go +++ b/tailor/lint.go @@ -86,13 +86,13 @@ func (c *Client) Lint(resources *Resources) ([]*LintWarn, error) { }) } - stepLength := len(r.Steps) - // Pipeline/StepLength - if c.cfg.Lint.Rules.Pipeline.StepLength.Enabled && stepLength > c.cfg.Lint.Rules.Pipeline.StepLength.Max { + stepCount := len(r.Steps) + // Pipeline/StepCount + if c.cfg.Lint.Rules.Pipeline.StepCount.Enabled && stepCount > c.cfg.Lint.Rules.Pipeline.StepCount.Max { warns = append(warns, &LintWarn{ Type: LintTargetTypePipeline, Name: fmt.Sprintf("%s/%s", p.NamespaceName, r.Name), - Message: fmt.Sprintf("resolver has too many steps (%d > %d)", stepLength, c.cfg.Lint.Rules.Pipeline.StepLength.Max), + Message: fmt.Sprintf("resolver has too many steps (%d > %d)", stepCount, c.cfg.Lint.Rules.Pipeline.StepCount.Max), }) } diff --git a/tailor/lint_test.go b/tailor/lint_test.go index cdbbe7f..953aa21 100644 --- a/tailor/lint_test.go +++ b/tailor/lint_test.go @@ -260,8 +260,8 @@ func TestClient_Lint_Pipeline(t *testing.T) { { name: "step length warning", configMod: func(c *config.Config) { - c.Lint.Rules.Pipeline.StepLength.Enabled = true - c.Lint.Rules.Pipeline.StepLength.Max = 1 + c.Lint.Rules.Pipeline.StepCount.Enabled = true + c.Lint.Rules.Pipeline.StepCount.Max = 1 }, resources: &Resources{ Pipelines: []*Pipeline{