Showing 68 of 242 total issues
Method create_user_for_email
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.create_user_for_email(email_address, token, name, ticket_status)
# create user
@user = User.new
@token, enc = Devise.token_generator.generate(User, :reset_password_token)
- 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
Avoid too many return
statements within this method. Open
return if ['trash','spam'].include?(@topic.current_status)
Function ready
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Helpy.ready = function(){
$('.selectpicker').selectpicker({});
$(".best_in_place").best_in_place();
- 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
Method search_topics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search_topics
if @start_date.present? && @end_date.present?
topics_to_search = Topic.where('created_at >= ?', @start_date).where('created_at <= ?', @end_date)
else
topics_to_search = Topic.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
Method avatar_image
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def avatar_image(user, size=40, font=16)
return if user.nil?
if user.profile_image.present?
image_tag(user.profile_image.url, width: "#{size}px", class: 'img-circle')
elsif cloudinary_enabled? && user.avatar.present?
- 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 current_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_user
passed_token = request.headers["X-Token"] || params["token"]
token = ApiKey.where(access_token: passed_token).first
if token && !token.expired?
- 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"