File topics_controller.rb
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Admin::TopicsController < Admin::BaseController
include SearchConcern
before_action :verify_agent
Class TopicsController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Admin::TopicsController < Admin::BaseController
include SearchConcern
before_action :verify_agent
Method create_customer_conversation
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_customer_conversation
@forum = Forum.find(1)
@user = User.where("lower(email) = ?", params[:topic][:user][:email].downcase).first
@topic = @forum.topics.new(
Method create_internal_ticket
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_internal_ticket
@forum = Forum.find(1)
@user = User.where("lower(email) = ?", params[:topic][:user][:email].downcase).first
@topic = @forum.topics.new(
Method ticketing_ui
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ticketing_ui
@updated_topics = @topics
if params[:q].present?
search_date_from_params
search_topics
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method split_topic
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def split_topic
parent_topic = Topic.find(params[:topic_id])
parent_post = Post.find(params[:post_id])
@topic = Topic.new(
Method ticketing_ui
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ticketing_ui
@updated_topics = @topics
if params[:q].present?
search_date_from_params
search_topics
Method update_topic
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_topic
bulk_post_attributes = []
if params[:change_status].present?
user_id = current_user.id || 2
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_internal_ticket
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_internal_ticket
@forum = Forum.find(1)
@user = User.where("lower(email) = ?", params[:topic][:user][:email].downcase).first
@topic = @forum.topics.new(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_customer_conversation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_customer_conversation
@forum = Forum.find(1)
@user = User.where("lower(email) = ?", params[:topic][:user][:email].downcase).first
@topic = @forum.topics.new(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method get_topics_cohort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_topics_cohort
# If affect is all, that means all matching tickets should be bulk updated
if params[:affect].present? && params[:affect] == "all"
if params[:status].present?
@topics = Topic.where(current_status: params[:status]).all
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
TODO found Open
# TODO probably can refactor this
- Exclude checks
TODO found Open
# TODO probably can refactor this
- Exclude checks