<commit_before># == Schema Information
#
# Table name: package
#
#  id          :integer         not null, primary key
#  name        :string(255)
#  description :text
#  created_at  :datetime
#

class Package < ActiveRecord::Base
  default_scope :order => "LOWER(name)"
  has_many :versions, :order => "id DESC"
  has_many :reviews
  has_many :taggings
  
  ## No. of packages to show per page.
  def self.per_page; 50; end
  
  ## Search On Name of Package.
  def self.search(search_term, search_results_page)
    search_term = '%' + String(search_term).downcase + '%'
    
    paginate :conditions => [ 'LOWER(name) LIKE ?', search_term],
             :include => {:versions => :maintainer},
             :page => search_results_page
  end

  def to_param
    name.gsub(".", "-")
  end
  
  def latest
    versions[0]
  end
  
  def google_url
    "http://www.google.com/search?q=" + CGI.escape("#{name} cran OR r-project -inurl:contrib -inurl:doc/packages -inurl:CRAN")
  end
  
  def scholar_url
    "http://scholar.google.com/scholar?q=" + CGI.escape(name)
  end
  
  def rhelp_url
   "http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi" +  
     "?idxname=Rhelp02a&idxname=Rhelp01&query=" + CGI.escape(name)
  end

  def rdevel_url
   "http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi" +  
     "?idxname=R-devel&query=" + CGI.escape(name)
  end
  
end
<commit_msg>Package.recent scope + whitespace cleanup<commit_after># == Schema Information
#
# Table name: package
#
#  id          :integer         not null, primary key
#  name        :string(255)
#  description :text
#  created_at  :datetime
#

class Package < ActiveRecord::Base
  has_many :versions, :order => "id DESC"
  has_many :reviews
  has_many :taggings

  default_scope :order => "LOWER(name)"
  # Used for the Package atom-feed:
  named_scope :recent, :order => "#{self.table_name}", :include => :versions,
                       :conditions => "#{self.table_name}.created_at IS NOT NULL"

  ## No. of packages to show per page.
  def self.per_page; 50; end

  ## Search On Name of Package.
  def self.search(search_term, search_results_page)
    search_term = '%' + String(search_term).downcase + '%'

    paginate :conditions => [ 'LOWER(name) LIKE ?', search_term],
             :include => {:versions => :maintainer},
             :page => search_results_page
  end

  def to_param
    name.gsub(".", "-")
  end

  def latest
    versions[0]
  end

  def google_url
    "http://www.google.com/search?q=" + CGI.escape("#{name} cran OR r-project -inurl:contrib -inurl:doc/packages -inurl:CRAN")
  end

  def scholar_url
    "http://scholar.google.com/scholar?q=" + CGI.escape(name)
  end

  def rhelp_url
   "http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi" +
     "?idxname=Rhelp02a&idxname=Rhelp01&query=" + CGI.escape(name)
  end

  def rdevel_url
   "http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi" +
     "?idxname=R-devel&query=" + CGI.escape(name)
  end

end

{'fraction_non_alphanumeric': 0.14290575025518884, 'fraction_numerical': 0.006805035726437564, 'mean_word_length': 2.983739837398374, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5791923', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1038, 'n_words': 223}