diff options
Diffstat (limited to 'vendor/github.com/google/yamlfmt/formatters/basic/features.go')
| -rw-r--r-- | vendor/github.com/google/yamlfmt/formatters/basic/features.go | 30 |
1 files changed, 12 insertions, 18 deletions
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 } |
