<commit_before>class Pmd < Formula
  desc "Source code analyzer for Java, JavaScript, and more"
  homepage "https://pmd.github.io"
  url "https://github.com/pmd/pmd/releases/download/pmd_releases/6.41.0/pmd-bin-6.41.0.zip"
  sha256 "917c94ba4a8b14875a0693bea229b2af39869ba6cdc2841a44322832d66ae399"
  license "BSD-4-Clause"

  bottle do
    sha256 cellar: :any_skip_relocation, all: "e7a6cfb479e27acc5739c0ec986758232b29bd185c3b689adfc73ad1683c3858"
  end

  depends_on "openjdk"

  def install
    rm Dir["bin/*.bat"]
    libexec.install Dir["*"]
    (bin/"pmd").write_env_script libexec/"bin/run.sh", Language::Java.overridable_java_home_env
  end

  def caveats
    <<~EOS
      Run with `pmd` (instead of `run.sh` as described in the documentation).
    EOS
  end

  test do
    (testpath/"java/testClass.java").write <<~EOS
      public class BrewTestClass {
        // dummy constant
        public String SOME_CONST = "foo";

        public boolean doTest () {
          return true;
        }
      }<commit_msg>pmd 6.42.0<commit_after>class Pmd < Formula
  desc "Source code analyzer for Java, JavaScript, and more"
  homepage "https://pmd.github.io"
  url "https://github.com/pmd/pmd/releases/download/pmd_releases/6.42.0/pmd-bin-6.42.0.zip"
  sha256 "ad5a873218ae14b553cff27d4c69c0ff8da6f46686391b1ff82ad452ab1d51fb"
  license "BSD-4-Clause"

  bottle do
    sha256 cellar: :any_skip_relocation, all: "e7a6cfb479e27acc5739c0ec986758232b29bd185c3b689adfc73ad1683c3858"
  end

  depends_on "openjdk"

  def install
    rm Dir["bin/*.bat"]
    libexec.install Dir["*"]
    (bin/"pmd").write_env_script libexec/"bin/run.sh", Language::Java.overridable_java_home_env
  end

  def caveats
    <<~EOS
      Run with `pmd` (instead of `run.sh` as described in the documentation).
    EOS
  end

  test do
    (testpath/"java/testClass.java").write <<~EOS
      public class BrewTestClass {
        // dummy constant
        public String SOME_CONST = "foo";

        public boolean doTest () {
          return true;
        }
      }
{'fraction_non_alphanumeric': 0.11094747177221403, 'fraction_numerical': 0.09523809523809523, 'mean_word_length': 3.1934156378600824, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1492511', 'n_tokens_mistral': 884, 'n_tokens_neox': 770, 'n_words': 149}