Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.55 KB

File metadata and controls

47 lines (33 loc) · 1.55 KB

git_ignore Fix Block

The git_ignore fix block in the grept tool is used to manage the .gitignore file in a repository. This block can be used to ensure certain entries are present or absent in the .gitignore file. If there's no .gitignore file, this fix would create one.

Attributes

  • rule_ids: The ID list of the rules this fix is associated with. Any rule check failure would trigger this fix.
  • exist: A list of entries that must be present in the .gitignore file.
  • not_exist: A list of entries that must not be present in the .gitignore file.

Exported Attributes

The git_ignore fix block does not export any attributes.

Example

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

fix "git_ignore" "example" {
  rule_ids   = ["example_rule"]
  exist      = ["*.log", "tmp/"]
  not_exist  = ["*.bak"]
}

This will ensure that the entries *.log and tmp/ are present in the .gitignore file, and the entry *.bak is not present. If the rule with ID example_rule fails, the .gitignore file will be updated accordingly.

You can also use the exist attribute alone to ensure certain entries are present:

fix "git_ignore" "example" {
  rule_ids = ["example_rule"]
  exist    = ["*.log", "tmp/"]
}

Or use the not_exist attribute alone to ensure certain entries are not present:

fix "git_ignore" "example" {
  rule_ids   = ["example_rule"]
  not_exist  = ["*.bak"]
}

These will update the .gitignore file accordingly if the rule with ID example_rule fails.