{{- /* Creates a section for each setting of a linter/formatter. @param {string} info The name of the data file containing the linter/formatter information. @param {string} settings The name of the data file containing the linter/formatter settings. @example {{% golangci/items/settings info="formatters_info" settings="formatter_settings" %}} */ -}} {{- $fileInfo := .Get "info" -}} {{- $fileSettings := .Get "settings" -}} {{- $gcilVersion := index $.Site.Data.version.version -}} {{- $info := index $.Site.Data $fileInfo -}} {{- $settings := index $.Site.Data $fileSettings -}} {{- range sort $info "name" -}} {{- if .internal -}} {{- continue -}} {{- end -}} ## {{ .name }} {{/* Description */}} {{ if .deprecation -}} {{- $replacement := "" -}} {{- if .deprecation.replacement -}} {{- $replacement = print " Use `" .deprecation.replacement "` instead." -}} {{- end -}} {{ print (partial "golangci/items/format-description" .deprecation.message) $replacement }} {{ else }} {{ partial "golangci/items/format-description" .desc }} {{ end }} {{/* Badges */}}
{{ partial "shortcodes/badge" (dict "border" false "icon" "calendar" "class" "hx:mx-1" "content" (print "Since golangci-lint " .since) ) }} {{ if .deprecation -}} {{ partial "shortcodes/badge" (dict "border" true "icon" "sparkles" "class" "hx:mx-1" "content" (print "Deprecated since " .deprecation.since) "color" "red" ) }} {{ else }} {{ if (partial "golangci/items/compare-versions" (dict "a" $gcilVersion "b" .since)) }} {{ partial "shortcodes/badge" (dict "border" false "icon" "sparkles" "class" "hx:mx-1" "content" "New" "color" "yellow" ) }} {{ end }} {{ if .canAutoFix }} {{ partial "shortcodes/badge" (dict "border" false "icon" "sparkles" "class" "hx:mx-1" "content" "Autofix" "color" "blue" ) }} {{ end }} {{ end }} {{- if .originalURL -}} {{ partial "shortcodes/badge" (dict "border" true "icon" "github" "class" "hx:mx-1" "content" "Repository" "link" .originalURL ) }} {{- end -}}
{{/* Settings */}} {{- $setting := index $settings .name -}} {{- if $setting -}} ```yaml {{ $setting | safeHTML}} ``` {{- else -}} _No settings available._ {{- end }} {{ end -}}