<commit_before>require_relative 'builder'

module PradLibs
  class PullRequestTemplateBuilder < Builder
    def initialize pull_request, slack_params
      @pool = PradLibs.load_template_file(File.join(PRADLIBS_TPLS, "pr_template/pr_template.yml"))
      @pr = pull_request
      @pl = get_pradlibs

      @dict = combine_looker_uppers Dictionary.new
      @slack_params = slack_params.with_indifferent_access
    end

    def create
      message = create_title
      {
        "response_type": :in_channel,
        "attachments": [
          {
            "pretext": "#{@slack_params[:user_name]} requests code review for a PR with +#{@pr.additions} / -#{@pr.deletions} in the #{@pl[:repo]} repository. <!here>",
            "fallback": "Purpose\n#{purpose}\n\nImplementation\n#{implementation}",
            "title": "#{@pr.title} ",
            "title_link": @pr.html_url,
            "text": message,
            "color": "#F35A00",
            "mrkdwn_in": [ "text" ]
          }
        ]
      }
    end

    def combine_looker_uppers dict
      dict.merge({
        prt: prt,
        pl: @pl,
        pr: @pr
      })
    end

    def prt
      {
        purpose: purpose,
        implementation: implementation,
        trello_card_url: trello_card_url,
        has_trello_card?: has_trello_card?
      }<commit_msg>Revert "The additions and deletions continue to search for their true home..."<commit_after>require_relative 'builder'

module PradLibs
  class PullRequestTemplateBuilder < Builder
    def initialize pull_request, slack_params
      @pool = PradLibs.load_template_file(File.join(PRADLIBS_TPLS, "pr_template/pr_template.yml"))
      @pr = pull_request
      @pl = get_pradlibs

      @dict = combine_looker_uppers Dictionary.new
      @slack_params = slack_params.with_indifferent_access
    end

    def create
      message = create_title
      {
        "response_type": :in_channel,
        "attachments": [
          {
            "pretext": "#{@slack_params[:user_name]} requests code review for a PR in the #{@pl[:repo]} repository. <!here>",
            "fallback": "Purpose\n#{purpose}\n\nImplementation\n#{implementation}",
            "title": "#{@pr.title} (+#{@pr.additions} / -#{@pr.deletions})",
            "title_link": @pr.html_url,
            "text": message,
            "color": "#F35A00",
            "mrkdwn_in": [ "text" ]
          }
        ]
      }
    end

    def combine_looker_uppers dict
      dict.merge({
        prt: prt,
        pl: @pl,
        pr: @pr
      })
    end

    def prt
      {
        purpose: purpose,
        implementation: implementation,
        trello_card_url: trello_card_url,
        has_trello_card?: has_trello_card?
      }
{'fraction_non_alphanumeric': 0.11758201253225212, 'fraction_numerical': 0.002948765204570586, 'mean_word_length': 2.2659446450060168, 'pattern_counts': {'":': 18, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1769942', 'n_tokens_mistral': 897, 'n_tokens_neox': 865, 'n_words': 172}