summaryrefslogtreecommitdiff
path: root/vendor/github.com/google/yamlfmt/formatters/basic/features.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-24 17:40:45 -0600
committermo khan <mo@mokhan.ca>2025-07-24 17:40:45 -0600
commitd48fe690c3c071cb5c8e3aa4d4672a32230a5e2d (patch)
tree414f9e91877e901cb3de12be6f466cb4929f55ab /vendor/github.com/google/yamlfmt/formatters/basic/features.go
parent7257c213887c6a80f727642b016606ec10340ed9 (diff)
refactor: extract job to process relationship updates in background
Diffstat (limited to 'vendor/github.com/google/yamlfmt/formatters/basic/features.go')
-rw-r--r--vendor/github.com/google/yamlfmt/formatters/basic/features.go30
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
}