<commit_before>class RustAnalyzer < Formula
  desc "Experimental Rust compiler front-end for IDEs"
  homepage "https://rust-analyzer.github.io/"
  url "https://github.com/rust-analyzer/rust-analyzer.git",
       tag:      "2021-04-26",
       revision: "617535393bb5ccc7adf0bac8a3b9a9c306454e79"
  version "2021-04-26"
  license "Apache-2.0"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "d871ae4977b04db7e6d20a932328affeade2c52f1ca0060a3eafb7467c350a33"
    sha256 cellar: :any_skip_relocation, big_sur:       "e08aeba1163a0ef5945b6f473ece49bc2d080b9a47461a604f31acefbb000863"
    sha256 cellar: :any_skip_relocation, catalina:      "3af9aa2b0fb9e18a15aab9f6a2870867a3175cda044519970e6b84b86633b436"
    sha256 cellar: :any_skip_relocation, mojave:        "65c8ecc7804108313467b65f7419bf0819ceffaee8328932fed8f143dd028025"
  end

  depends_on "rust" => :build

  def install
    cd "crates/rust-analyzer" do
      system "cargo", "install", "--bin", "rust-analyzer", *std_cargo_args
    end
  end

  test do
    def rpc(json)
      "Content-Length: #{json.size}\r\n" \
      "\r\n" \
      "#{json}"
    end

    input = rpc <<-EOF
    {<commit_msg>rust-analyzer 2021-05-03<commit_after>class RustAnalyzer < Formula
  desc "Experimental Rust compiler front-end for IDEs"
  homepage "https://rust-analyzer.github.io/"
  url "https://github.com/rust-analyzer/rust-analyzer.git",
       tag:      "2021-05-03",
       revision: "eb741e895f1a73420a401f2495c711afe37d9d19"
  version "2021-05-03"
  license "Apache-2.0"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "d871ae4977b04db7e6d20a932328affeade2c52f1ca0060a3eafb7467c350a33"
    sha256 cellar: :any_skip_relocation, big_sur:       "e08aeba1163a0ef5945b6f473ece49bc2d080b9a47461a604f31acefbb000863"
    sha256 cellar: :any_skip_relocation, catalina:      "3af9aa2b0fb9e18a15aab9f6a2870867a3175cda044519970e6b84b86633b436"
    sha256 cellar: :any_skip_relocation, mojave:        "65c8ecc7804108313467b65f7419bf0819ceffaee8328932fed8f143dd028025"
  end

  depends_on "rust" => :build

  def install
    cd "crates/rust-analyzer" do
      system "cargo", "install", "--bin", "rust-analyzer", *std_cargo_args
    end
  end

  test do
    def rpc(json)
      "Content-Length: #{json.size}\r\n" \
      "\r\n" \
      "#{json}"
    end

    input = rpc <<-EOF
    {
{'fraction_non_alphanumeric': 0.1047942299533305, 'fraction_numerical': 0.1879507848960543, 'mean_word_length': 3.841889117043121, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7214046', 'n_tokens_mistral': 1237, 'n_tokens_neox': 995, 'n_words': 147}