Showing 68 of 242 total issues
Function ready
has 309 lines of code (exceeds 25 allowed). Consider refactoring. Open
Helpy.ready = function(){
$('.selectpicker').selectpicker({});
$(".best_in_place").best_in_place();
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
File app.js
has 401 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*jshint multistr: true */
var Helpy = Helpy || {};
Helpy.ready = function(){
Function admin
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
Helpy.admin = function(){
$(".alert").delay(2000).slideUp(500, function(){
$(".alert").alert('close');
});
Function initShortcuts
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Helpy.initShortcuts = function() {
// Keyboard Shortcut definition
// pipeline and search
File topics.rb
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
module API
module V1
class Topics < Grape::API
before do
Method set_vars
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def set_vars
# Configure griddler, mailer, cloudinary, recaptcha
Griddler.configuration.email_service = AppSettings["email.mail_service"].present? ? AppSettings["email.mail_service"].to_sym : :sendgrid
ActionMailer::Base.smtp_settings = {
- 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
Class User
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
Class ApplicationController
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
helper_method :recaptcha_enabled?
Class Topic
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Topic < ActiveRecord::Base
include SentenceCase
include Hashid::Rails
Class TopicsController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Admin::TopicsController < Admin::BaseController
include SearchConcern
before_action :verify_agent
Method create
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create
@topic = Topic.find(params[:topic_id])
@post = @topic.posts.new(post_params)
@post.topic_id = @topic.id
@post.user_id = current_user.id
- 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
Function track
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Helpy.track = function(){
// Put the Google Analytics clientID into the Helpy data layer
ga(function(tracker) {
Helpy.clientId = tracker.get('clientId');
File admin_helper.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
module AdminHelper
include StatsHelper
def assigned_to(topic)
if topic.assigned_user.present?
Method topic_import
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def topic_import(obj_hash, row_num, object=nil)
@@submited_record_count += 1
obj_hash.reject!{|k| k=="posts_count" }
if obj_hash["forum_id"].present? && obj_hash["user_id"].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 doc_import
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def doc_import(obj_hash, row_num, object=nil)
@@submited_record_count += 1
if obj_hash["user_id"].present? && obj_hash["category_id"].present?
if User.find_by_id(obj_hash["user_id"]).present? && Category.find_by_id(obj_hash["category_id"]).present?
begin
- 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
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create
params[:id].nil? ? @forum = Forum.find(params[:topic][:forum_id]) : @forum = Forum.find(params[:id])
@topic = @forum.topics.new(
name: params[:topic][:name],
- 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 post_import
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def post_import(obj_hash, row_num, object=nil)
@@submited_record_count += 1
obj_hash.reject!{|k| k=="attachments" }
if obj_hash["topic_id"].present? && obj_hash["user_id"].present?
if Topic.find_by_id(obj_hash["topic_id"]).present? && User.find_by_id(obj_hash["user_id"]).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 process
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process
- 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 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(