<commit_before>module AppStats
  module Stats

    #Sort the Ruby files in your project by number of has_many
    PIPE_MINUS_COVERAGE = '| grep -v "coverage"'
    CURRENT_FILE = File.basename(__FILE__)
    PIPE_MINUS_CURRENT_FILE = "| grep -v \"#{CURRENT_FILE}\""
    HAS_MANY_SEARCH = "ack \" has_many \" -c | awk -F \":\" '{print $2,$1}' | grep -v \"0\" #{PIPE_MINUS_COVERAGE} #{PIPE_MINUS_CURRENT_FILE} | sort -rn"

    #Sort the Ruby files in your project by LOC
    SORT_LOC_SEARCH = "find . -iname \"*.rb\" -type f -exec wc -l {} \; | sort -rn"

    #Count the lines of Ruby code in your app
    LOC_COUNT_SEARCH = "find . -iname \"*.rb\" -type f -exec cat {} \; | wc -l"

    def self.get_raw(command)
      `#{command}`
    end

    def self.get_has_many_relationships
      get_raw(HAS_MANY_SEARCH).split("\n")
    end

    def self.get_loc_sorted
      get_raw(SORT_LOC_SEARCH).split("\n")
    end

    def self.get_loc_count
      get_raw(LOC_COUNT_SEARCH).split("\n")
    end


  end
end<commit_msg>cleanup code in stats file<commit_after>module AppStats
  module Stats

    #Sort the Ruby files in your project by number of has_many
    PIPE_MINUS_COVERAGE = '| grep -v "coverage"'
    CURRENT_FILE = File.basename(__FILE__)
    PIPE_MINUS_CURRENT_FILE = "| grep -v \"#{CURRENT_FILE}\""
    HAS_MANY_SEARCH = "ack \" has_many \" -c | awk -F \":\" '{print $2,$1}' | grep -v \"0\" #{PIPE_MINUS_COVERAGE} #{PIPE_MINUS_CURRENT_FILE} | sort -rn"

    #Sort the Ruby files in your project by LOC
    SORT_LOC_SEARCH = "find . -iname \"*.rb\" -type f -exec wc -l {} \; | sort -rn"

    #Count the lines of Ruby code in your app
    LOC_COUNT_SEARCH = "find . -iname \"*.rb\" -type f -exec cat {} \; | wc -l"

    def self.get_raw(command)
      `#{command}`
    end

    def self.get_has_many_relationships
      get_raw(HAS_MANY_SEARCH).split("\n")
    end

    def self.get_loc_sorted
      get_raw(SORT_LOC_SEARCH).split("\n")
    end

    def self.get_loc_count
      get_raw(LOC_COUNT_SEARCH).split("\n")
    end
  end
end
{'fraction_non_alphanumeric': 0.1367437284800787, 'fraction_numerical': 0.002951303492375799, 'mean_word_length': 2.787709497206704, 'pattern_counts': {'":': 2, '<': 3, '<?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': '3477166', 'n_tokens_mistral': 781, 'n_tokens_neox': 750, 'n_words': 197}