Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 1008 Bytes

local_file.md

File metadata and controls

28 lines (19 loc) · 1008 Bytes

local_file Fix Block

The local_file fix block in the grept tool is used to write a specified content into one or more local files. This can be used to enforce certain file content rules.

Attributes

  • rule_ids: The ID list of the rules this fix is associated with. Any rule check failure would trigger this fix.
  • paths: A list of file paths where the content should be written.
  • content: The content to be written to the files.
  • mode: (Optional) The mode to set if creating a new file. Defaults to 0644.

Exported Attributes

The local_file fix block does not export any attributes.

Example

Here's an example of how to use the local_file fix block in your configuration file:

fix "local_file" "example" {
  rule_ids = ["example_rule"]
  paths    = ["/path/to/file1", "/path/to/file2"]
  content  = "Example content"
}

This will write the text "Example content" to the files at /path/to/file1 and /path/to/file2 if the rule with ID example_rule fails.