mattzcarey / code-review-gpt

Code review powered by LLMs (OpenAI GPT4, Sonnet 3.5) & Embeddings ⚡️ Improve code quality and catch bugs before you break production 🚀 Lives in your Github/GitLab/Azure DevOps CI
https://oriontools.ai
MIT License
1.6k stars 162 forks source link

feat: support Terraform code review #322

Closed lintaonz closed 9 months ago

lintaonz commented 9 months ago

Support HashiCorp Terraform code review:

I have tested both file extensions with the 'gpt-3.5-turbo' model. It works great.

Example

Risk Level 3 - variables.tf

The code changes in this file have a medium risk to the code base. Here are a few suggestions for improvement:

  1. The enabled variable can have a more descriptive name. Consider renaming it to something like diagnosticsEnabled.

  2. The diag_object variable can be defined as a complex object type to improve readability and maintainability. Consider using a map or a struct to define the structure of the diag_object variable.

Example:

variable \"diag_object\" {
  description = \"(Required) Contains the diagnostics setting object.\"
  type        = map(object({
    diagnosticsEnabled = bool
    retentionEnabled   = bool
    retentionPeriod    = number
  }))
}