<commit_before>class ProjectsController < ApplicationController
  layout 'default'
  
  def index
    @projects = Projects.load_all
    
    @projects.each do |project|
      InProgressBuildStatus.delete_in_progress_build_status_file_if_any(project)
    end
    
    respond_to do |format|
      format.html
      format.js
      format.rss { render :action => 'rss', :layout => false }
    end
  end

  def force_build   
    @project = nil
    begin       
      @project = Projects.find(params[:project])
      @project.request_force_build
    rescue 
      @project = nil
    end
    @project
 end
  
  def code
    @project = Projects.find(params[:project])
    
    path = File.join(@project.path, 'work', params[:path])
    @line = params[:line].to_i if params[:line]
    
    if File.directory?(path)
      render :text => 'directories are not yet supported'
    elsif File.exists?(path)
      @content = File.read(path)
    else
      render_not_found
    end
  end
  
  private
  
  def serialize_states(projects)
    projects.collect { |project| "#{project.name}:#{project.builder_and_build_states_tag}" }.join(';')
  end

  def deserialize_states(states_string)
    states_string.split(';').collect { |build_state| build_state.split(':') }
  end

end<commit_msg>r249: removed some redundant code<commit_after>class ProjectsController < ApplicationController
  layout 'default'
  
  def index
    @projects = Projects.load_all
    
    @projects.each do |project|
      InProgressBuildStatus.delete_in_progress_build_status_file_if_any(project)
    end
    
    respond_to do |format|
      format.html
      format.js
      format.rss { render :action => 'rss', :layout => false }
    end
  end

  def force_build   
    @project = nil
    begin       
      @project = Projects.find(params[:project])
      @project.request_force_build
    rescue 
      @project = nil
    end
    @project
 end
  
  def code
    @project = Projects.find(params[:project])
    
    path = File.join(@project.path, 'work', params[:path])
    @line = params[:line].to_i if params[:line]
    
    if File.directory?(path)
      render :text => 'directories are not yet supported'
    elsif File.exists?(path)
      @content = File.read(path)
    else
      render_not_found
    end
  end
  
end
{'fraction_non_alphanumeric': 0.10231744643637954, 'fraction_numerical': 0.0013117621337997377, 'mean_word_length': 2.726384364820847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6872695', 'n_tokens_mistral': 722, 'n_tokens_neox': 711, 'n_words': 159}