Skip to content

Template autofix rule⚓︎

Template rule demonstrating minimal syntax for autofix rules at the example of a forbidden test mapping that is removed upon fixing.

Use rule⚓︎

Warning

Not for practical use. Rule is only provided as a minimal example.

In order to use this rule:

  1. Create configmap via:
    kubectl create configmap -n semgr8ns template-autofix-rule --from-file=rules/template-autofix-rule.yaml
    kubectl label configmap -n semgr8ns template-autofix-rule semgr8s/rule=true
    

Rule⚓︎

rules/template-autofix-rule.yaml
rules:
- id: template-autofix-rule
  message: Rule template with autofix.
  languages: [yaml]
  severity: INFO
  patterns:
    - pattern: |
        semgr8s-test: forbidden-test-label-e3b0c44298fc1c
  fix: "semgr8s-test: allowed-test-label"