Skip to content

Commit 77cc723

Browse files
committed
Update rule and list of automatically fixable rules in docs
Signed-off-by: Sean Ledford <s_ledford@apple.com>
1 parent 45b50dd commit 77cc723

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

docs/fixing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Currently, the following rules are automatically fixable:
2222
- [use-assignment-operator](https://www.openpolicyagent.org/projects/regal/rules/style/use-assignment-operator)
2323
- [no-whitespace-comment](https://www.openpolicyagent.org/projects/regal/rules/style/no-whitespace-comment)
2424
- [directory-package-mismatch](https://www.openpolicyagent.org/projects/regal/rules/idiomatic/directory-package-mismatch)
25+
- [prefer-equals-comparison](https://www.openpolicyagent.org/projects/regal/rules/idiomatic/prefer-equals-comparison)
2526
- [use-rego-v1](https://www.openpolicyagent.org/projects/regal/rules/imports/use-rego-v1) (v0 Rego only)
2627

2728
So, how do you go on about automatically fixing reported violations?

docs/rules/idiomatic/prefer-equals-comparison.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
**Category**: Idiomatic
66

7+
**Automatically fixable**: [Yes](/regal/fixing)
8+
79
**Avoid**
810
```rego
911
package policy

pkg/fixer/fixes/preferequalscomparison.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (p *PreferEqualsComparison) Fix(fc *FixCandidate, opts *RuntimeOptions) ([]
3030
continue
3131
}
3232

33-
lines[loc.Row-1] = line[0:loc.Column-1] + "=" + line[loc.Column-1:]
33+
lines[loc.Row-1] = line[0:loc.Column] + "=" + line[loc.Column:]
3434
fixed = true
3535
}
3636

0 commit comments

Comments
 (0)