From d48fe690c3c071cb5c8e3aa4d4672a32230a5e2d Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 24 Jul 2025 17:40:45 -0600 Subject: refactor: extract job to process relationship updates in background --- .../google/yamlfmt/formatters/basic/features.go | 30 +++++++++------------- 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'vendor/github.com/google/yamlfmt/formatters/basic/features.go') diff --git a/vendor/github.com/google/yamlfmt/formatters/basic/features.go b/vendor/github.com/google/yamlfmt/formatters/basic/features.go index de736f4..fc933f4 100644 --- a/vendor/github.com/google/yamlfmt/formatters/basic/features.go +++ b/vendor/github.com/google/yamlfmt/formatters/basic/features.go @@ -15,9 +15,8 @@ package basic import ( - "github.com/braydonk/yaml" "github.com/google/yamlfmt" - "github.com/google/yamlfmt/formatters/basic/anchors" + yamlFeatures "github.com/google/yamlfmt/formatters/basic/features" "github.com/google/yamlfmt/internal/features" "github.com/google/yamlfmt/internal/hotfix" ) @@ -55,24 +54,19 @@ func ConfigureFeaturesFromConfig(config *Config) yamlfmt.FeatureList { return configuredFeatures } -// These features will directly use the `yaml.Node` type and -// as such are specific to this formatter. -type YAMLFeatureFunc func(yaml.Node) error -type YAMLFeatureList []YAMLFeatureFunc +func ConfigureYAMLFeaturesFromConfig(config *Config) yamlFeatures.YAMLFeatureList { + var featureList yamlFeatures.YAMLFeatureList -func (y YAMLFeatureList) ApplyFeatures(node yaml.Node) error { - for _, f := range y { - if err := f(node); err != nil { - return err - } + if config.DisallowAnchors { + featureList = append(featureList, yamlFeatures.Check) } - return nil -} -func ConfigureYAMLFeaturesFromConfig(config *Config) YAMLFeatureList { - var features YAMLFeatureList - if config.DisallowAnchors { - features = append(features, anchors.Check) + if config.ForceArrayStyle != "" { + featureList = append( + featureList, + yamlFeatures.FeatureForceSequenceStyle(config.ForceArrayStyle), + ) } - return features + + return featureList } -- cgit v1.2.3