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:58:01 -0600
committermo khan <mo@mokhan.ca>2025-07-24 17:58:01 -0600
commit72296119fc9755774719f8f625ad03e0e0ec457a (patch)
treeed236ddee12a20fb55b7cfecf13f62d3a000dcb5 /vendor/github.com/google/yamlfmt/formatters/basic/features.go
parenta920a8cfe415858bb2777371a77018599ffed23f (diff)
parenteaa1bd3b8e12934aed06413d75e7482ac58d805a (diff)
Merge branch 'the-spice-must-flow' into 'main'
Add SpiceDB Authorization See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!19
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
}