<commit_before>require 'thor'

module CodeclimateCi
  class CLI < Thor
    method_option :codeclimate_api_token, required: true
    method_option :repo_id, required: true
    method_option :branch_name, required: true
    method_option :retry_count
    method_option :sleep_time

    desc('check', 'Check code quality with CodeClimate')

    def check
      CodeclimateCi.configuration.load_from_options(options)

      if CompareGpa.new(codeclimate_api_token, repo_id).worse?(branch_name)
        Messages.for_worse_code
        exit(1)
      else
        Messages.for_good_code
      end
    end

    default_task :check

    private

    def codeclimate_api_token
      CodeclimateCi.configuration.codeclimate_api_token
    end

    def repo_id
      CodeclimateCi.configuration.repo_id
    end

    def branch_name
      CodeclimateCi.configuration.branch_name
    end
  end
end<commit_msg>Call CompareGpa correctly<commit_after>require 'thor'

module CodeclimateCi
  class CLI < Thor
    method_option :codeclimate_api_token, required: true
    method_option :repo_id, required: true
    method_option :branch_name, required: true
    method_option :retry_count
    method_option :sleep_time

    desc('check', 'Check code quality with CodeClimate')

    def check
      CodeclimateCi.configuration.load_from_options(options)

      if CompareGpa.new(api_requester).worse?(branch_name)
        Messages.for_worse_code
        exit(1)
      else
        Messages.for_good_code
      end
    end

    default_task :check

    private

    def api_requester
      @api_requester ||= ApiRequester.new(
        CodeclimateCi.configuration.codeclimate_api_token,
        CodeclimateCi.configuration.repo_id
      )
    end

    def branch_name
      CodeclimateCi.configuration.branch_name
    end
  end
end
{'fraction_non_alphanumeric': 0.055924695459579184, 'fraction_numerical': 0.0011074197120708748, 'mean_word_length': 3.135011441647597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4407841', 'n_tokens_mistral': 581, 'n_tokens_neox': 550, 'n_words': 115}