<commit_before># frozen_string_literal: true

class RepositoryStatusItemsController < ApplicationController
  before_action :load_vars, only: :search

  def search
    status_items = @repository_column.repository_status_items
                                     .where('status ILIKE ?', "%#{search_params[:q]}%")
                                     .limit(Constants::SEARCH_LIMIT)
                                     .select(:id, :icon, :status)

    render json: { status_items: status_items }, status: :ok
  end

  private

  def search_params
    params.permit(:q, :column_id)
  end

  def load_vars
    @repository_column = RepositoryColumn.find_by(id: search_params[:column_id])
    repository = @repository_column.repository if @repository_column
    render_404 and return unless @repository_column&.data_type == 'RepositoryStatusValue'
    render_403 unless can_manage_repository_rows?(repository)
  end
end<commit_msg>Remove scope for before_action<commit_after># frozen_string_literal: true

class RepositoryStatusItemsController < ApplicationController
  before_action :load_vars

  def search
    status_items = @repository_column.repository_status_items
                                     .where('status ILIKE ?', "%#{search_params[:q]}%")
                                     .limit(Constants::SEARCH_LIMIT)
                                     .select(:id, :icon, :status)

    render json: { status_items: status_items }, status: :ok
  end

  private

  def search_params
    params.permit(:q, :column_id)
  end

  def load_vars
    @repository_column = RepositoryColumn.find_by(id: search_params[:column_id])
    repository = @repository_column.repository if @repository_column
    render_404 and return unless @repository_column&.data_type == 'RepositoryStatusValue'
    render_403 unless can_manage_repository_rows?(repository)
  end
end
{'fraction_non_alphanumeric': 0.08333333333333333, 'fraction_numerical': 0.0064516129032258064, 'mean_word_length': 3.0281385281385282, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5446463', 'n_tokens_mistral': 521, 'n_tokens_neox': 500, 'n_words': 108}