helpyio/helpy

View on GitHub

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();
Severity: Major
Found in app/assets/javascripts/app.js - About 1 day to fix

    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
    Severity: Minor
    Found in app/controllers/admin/topics_controller.rb - About 6 hrs to fix

      File app.js has 401 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*jshint multistr: true */
      
      var Helpy = Helpy || {};
      
      Helpy.ready = function(){
      Severity: Minor
      Found in app/assets/javascripts/app.js - About 5 hrs to fix

        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');
          });
        Severity: Major
        Found in app/assets/javascripts/admin.js - About 5 hrs to fix

          Function initShortcuts has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Helpy.initShortcuts = function() {
          
            // Keyboard Shortcut definition
          
            // pipeline and search
          Severity: Major
          Found in app/assets/javascripts/shortcuts.js - About 5 hrs to fix

            File topics.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module API
              module V1
                class Topics < Grape::API
            
                  before do
            Severity: Minor
            Found in app/controllers/api/v1/topics.rb - About 3 hrs to fix

              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 = {
              Severity: Minor
              Found in app/controllers/application_controller.rb - About 3 hrs to fix

              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,
              Severity: Minor
              Found in app/models/user.rb - About 3 hrs to fix

                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?
                Severity: Minor
                Found in app/controllers/application_controller.rb - About 3 hrs to fix

                  Class Topic has 26 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Topic < ActiveRecord::Base
                  
                    include SentenceCase
                    include Hashid::Rails
                    
                  Severity: Minor
                  Found in app/models/topic.rb - About 3 hrs to fix

                    Class TopicsController has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Admin::TopicsController < Admin::BaseController
                    
                      include SearchConcern
                    
                      before_action :verify_agent
                    Severity: Minor
                    Found in app/controllers/admin/topics_controller.rb - About 2 hrs to fix

                      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
                      Severity: Minor
                      Found in app/controllers/posts_controller.rb - About 2 hrs to fix

                      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');
                      Severity: Major
                      Found in app/assets/javascripts/event-tracking.js - About 2 hrs to fix

                        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?
                        Severity: Minor
                        Found in app/helpers/admin_helper.rb - About 2 hrs to fix

                          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?
                          Severity: Minor
                          Found in app/jobs/import_job.rb - About 2 hrs to fix

                          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
                          Severity: Minor
                          Found in app/jobs/import_job.rb - About 2 hrs to fix

                          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],
                          Severity: Minor
                          Found in app/controllers/topics_controller.rb - About 2 hrs to fix

                          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?
                          Severity: Minor
                          Found in app/jobs/import_job.rb - About 2 hrs to fix

                          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
                          
                          
                          
                          
                          
                          Severity: Minor
                          Found in lib/email_processor.rb - About 1 hr to fix

                          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(
                          Severity: Minor
                          Found in app/controllers/admin/topics_controller.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language