<commit_before># coding: utf-8
class EntriesController < ApplicationController
  include LikableController
  include SavableController
  include ReadableController

  before_action :set_entry    , only: [:show, :show_feedly, :crawl, :edit, :update, :destroy]
  before_action :set_feed     , only: [:index]
  before_action :set_keyword  , only: [:index]
  before_action :set_tag      , only: [:index]
  before_action :set_issue    , only: [:index]
  before_action :set_query    , only: [:index]
  before_action :require_admin, only: [:new, :create, :destroy, :update]

  def index
    if @keyword.present?
      @entries = @keyword.entries
                         .order('published DESC')
                         .page(params[:page])
    elsif @tag.present?
      @entries = @tag.entries
                     .order('published DESC')
                     .page(params[:page])
    elsif @feed.present?
      @entries = Entry.where(feed_id: @feed.id)
                      .order('published DESC')
                      .page(params[:page])
    elsif @issue.present?
      @entry_issues = @issue.entry_issues
                            .order('engagement DESC')
                            .page(params[:page])
      @entries = @issue.entries
                   .page(params[:page])
    else
      @entries = Entry.search(@query)
                      .order('published DESC')
                      .page(params[:page])
    end
    Entry.set_count_of_enclosures(@entries)
    @liked_entries = LikedEntry.where(user_id: current_user.id,
                                      entry_id: @entries.map { |e| e.id })<commit_msg>Reduce lines of method in order to reduce rubocup warnings<commit_after># coding: utf-8
class EntriesController < ApplicationController
  include LikableController
  include SavableController
  include ReadableController

  before_action :set_entry    , only: [:show, :show_feedly, :crawl, :edit, :update, :destroy]
  before_action :set_feed     , only: [:index]
  before_action :set_keyword  , only: [:index]
  before_action :set_tag      , only: [:index]
  before_action :set_issue    , only: [:index]
  before_action :set_query    , only: [:index]
  before_action :require_admin, only: [:new, :create, :destroy, :update]

  def index
    if @keyword.present?
      @entries = @keyword.entries
                         .order('published DESC')
                         .page(params[:page])
    elsif @tag.present?
      @entries = @tag.entries
                     .order('published DESC')
                     .page(params[:page])
    elsif @feed.present?
      @entries = Entry.where(feed_id: @feed.id)
                      .order('published DESC')
                      .page(params[:page])
    elsif @issue.present?
      @entry_issues = @issue.entry_issues
                            .order('engagement DESC')
                            .page(params[:page])
      @entries = @issue.entries.page(params[:page])
    else
      @entries = Entry.search(@query)
                      .order('published DESC')
                      .page(params[:page])
    end
    Entry.set_count_of_enclosures(@entries)
    @liked_entries = LikedEntry.where(user_id: current_user.id,
                                      entry_id: @entries.map { |e| e.id })
{'fraction_non_alphanumeric': 0.11501988375650046, 'fraction_numerical': 0.000611807892321811, 'mean_word_length': 2.033395176252319, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4537915', 'n_tokens_mistral': 962, 'n_tokens_neox': 930, 'n_words': 202}