<commit_before>module CFMEGit
  class Commit
    attr_reader :bz_ids, :grit_commit, :branch, :sha_id

    def initialize(grit_commit, branch)
      @grit_commit = grit_commit
      @branch = branch
      @bz_ids = []
      @sha_id = grit_commit.id
      extract_bz_ids
    end

    def attributes
      {
        :branch => branch,
        :sha_id => sha_id
      }
    end

    def extract_bz_ids
      grit_commit.message.each_line do |line|
        if line =~ /show_bug.cgi\?id=([0-9]+)/
          @bz_ids << $1
        end
      end
    end
  end
end<commit_msg>Look for a full URL to the bug with only leading spaces.<commit_after>module CFMEGit
  class Commit
    attr_reader :bz_ids, :grit_commit, :branch, :sha_id

    BUG_URL_REGEX = %r{^\s*https://bugzilla\.redhat\.com/show_bug\.cgi\?id=(?<bug_id>\d+)$}

    def initialize(grit_commit, branch)
      @grit_commit = grit_commit
      @branch = branch
      @bz_ids = []
      @sha_id = grit_commit.id
      extract_bz_ids
    end

    def attributes
      {
        :branch => branch,
        :sha_id => sha_id
      }
    end

    def extract_bz_ids
      grit_commit.message.each_line do |line|
        match = BUG_URL_REGEX.match(line)
        @bz_ids << match[:bug_id] if match
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1031496062992126, 'fraction_numerical': 0.002362204724409449, 'mean_word_length': 2.1538461538461537, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, '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': '476301', 'n_tokens_mistral': 477, 'n_tokens_neox': 450, 'n_words': 98}