<commit_before>class Tfsec < Formula
  desc "Static analysis powered security scanner for your terraform code"
  homepage "https://github.com/tfsec/tfsec"
  url "https://github.com/tfsec/tfsec/archive/v0.39.37.tar.gz"
  sha256 "08f9846770c78cd2b7d77dc67896ca721ccb17bcb3a1ef0d3529699be76b6059"
  license "MIT"

  livecheck do
    url :stable
    strategy :github_latest
  end

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "a2fd41d694823bd4b4c6ef8b8df178848b189481eedae91a4e3a1138327944b1"
    sha256 cellar: :any_skip_relocation, big_sur:       "ebe2bb1c77eda2829aa96c6dc1398072f096bec35419eb5ec45f92eee39a36ca"
    sha256 cellar: :any_skip_relocation, catalina:      "e8e2090a0eb1d0ad3c83ffc184973519328a60b0dc082435bb48f44ed336c4e0"
    sha256 cellar: :any_skip_relocation, mojave:        "f84e82b513a0ce7baf3203d5e180894be36b309c16ff2498a293852eb7b66bfe"
  end

  depends_on "go" => :build

  def install
    system "scripts/install.sh", "v#{version}"
    bin.install "tfsec"
  end

  test do
    (testpath/"good/brew-validate.tf").write <<~EOS
      resource "aws_alb_listener" "my-alb-listener" {
        port     = "443"
        protocol = "HTTPS"
      }
    EOS
    (testpath/"bad/brew-validate.tf").write <<~EOS
      }<commit_msg>tfsec 0.39.39<commit_after>class Tfsec < Formula
  desc "Static analysis powered security scanner for your terraform code"
  homepage "https://github.com/tfsec/tfsec"
  url "https://github.com/tfsec/tfsec/archive/v0.39.39.tar.gz"
  sha256 "446c79013680b12f3e6a52c192003dbd83af499f6149de543305f119a496d295"
  license "MIT"

  livecheck do
    url :stable
    strategy :github_latest
  end

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "a2fd41d694823bd4b4c6ef8b8df178848b189481eedae91a4e3a1138327944b1"
    sha256 cellar: :any_skip_relocation, big_sur:       "ebe2bb1c77eda2829aa96c6dc1398072f096bec35419eb5ec45f92eee39a36ca"
    sha256 cellar: :any_skip_relocation, catalina:      "e8e2090a0eb1d0ad3c83ffc184973519328a60b0dc082435bb48f44ed336c4e0"
    sha256 cellar: :any_skip_relocation, mojave:        "f84e82b513a0ce7baf3203d5e180894be36b309c16ff2498a293852eb7b66bfe"
  end

  depends_on "go" => :build

  def install
    system "scripts/install.sh", "v#{version}"
    bin.install "tfsec"
  end

  test do
    (testpath/"good/brew-validate.tf").write <<~EOS
      resource "aws_alb_listener" "my-alb-listener" {
        port     = "443"
        protocol = "HTTPS"
      }
    EOS
    (testpath/"bad/brew-validate.tf").write <<~EOS
      }
{'fraction_non_alphanumeric': 0.09184481393507522, 'fraction_numerical': 0.18091844813935076, 'mean_word_length': 4.1361788617886175, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6134547', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1054, 'n_words': 153}