(file *File)
| 204 | } |
| 205 | |
| 206 | func (p *PolicyToLint) validateRegoFile(file *File) { |
| 207 | original := string(file.Content) |
| 208 | formatted := p.validateAndFormatRego(original, file.Path) |
| 209 | |
| 210 | if p.Format && formatted != original { |
| 211 | if err := os.WriteFile(file.Path, []byte(formatted), 0600); err != nil { |
| 212 | p.AddError(file.Path, err.Error(), 0) |
| 213 | } else { |
| 214 | file.Content = []byte(formatted) |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | // validateWasmFile validates a WASM policy file by checking that it exports the required Execute function |
| 220 | func (p *PolicyToLint) validateWasmFile(file *File) { |
no test coverage detected