indentlabs/notebook

View on GitHub

Showing 183 of 288 total issues

Function Modernizr has 605 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.Modernizr = (function( window, document, undefined ) {

    var version = '2.7.1',

    Modernizr = {},
Severity: Major
Found in app/assets/javascripts/modernizr.js - About 3 days to fix

    Function Modernizr has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
    Open

    window.Modernizr = (function( window, document, undefined ) {
    
        var version = '2.7.1',
    
        Modernizr = {},
    Severity: Minor
    Found in app/assets/javascripts/modernizr.js - About 2 days 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

    File modernizr.js has 607 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * Modernizr v2.7.1
     * www.modernizr.com
     *
     * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
    Severity: Major
    Found in app/assets/javascripts/modernizr.js - About 1 day to fix

      File content_controller.rb has 525 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class ContentController < ApplicationController
        before_action :authenticate_user!, except: [:show, :changelog, :api_sort] \
          + Rails.application.config.content_types[:all_non_universe].map { |type| type.name.downcase.pluralize.to_sym }
      
        skip_before_action :cache_most_used_page_information, only: [
      Severity: Major
      Found in app/controllers/content_controller.rb - About 1 day to fix

        File basil_controller.rb has 506 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class BasilController < ApplicationController
          before_action :authenticate_user!, except: [:complete_commission, :about, :stats, :jam, :queue_jam_job, :commission_info]
        
          before_action :require_admin_access, only: [:review], unless: -> { Rails.env.development? }
        
        
        Severity: Major
        Found in app/controllers/basil_controller.rb - About 1 day to fix

          File forum_replacement_service.rb has 503 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class ForumReplacementService < Service
            # Cool replacements we could eventually do not for pranking
            # [roll N] = random number between 1 and N
            # [roll N, M] = random number between N and M
            # [@reader] = username of the reader
          Severity: Major
          Found in app/services/forum_replacement_service.rb - About 1 day to fix

            Function RadarChart has 187 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function RadarChart(id, data, options) {
                var cfg = {
                 w: 600,                //Width of the circle
                 h: 600,                //Height of the circle
                 margin: {top: 100, right: 100, bottom: 100, left: 100}, //The margins of the SVG
            Severity: Major
            Found in app/assets/javascripts/d3-charts/radar_chart.js - About 7 hrs to fix

              Method attribute_categories has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.attribute_categories(user, show_hidden: false)
                    # TODO: this is a code smell; we should probably either be whitelisting or fixing whatever is calling
                    #       this with the wrong models
                    return [] if ['attribute_category', 'attribute_field'].include?(content_name)
              
              
              Severity: Minor
              Found in app/models/concerns/has_attributes.rb - About 6 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

              File js-mindmap.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               js-mindmap
              
               Copyright (c) 2008/09/10 Kenneth Kufluk http://kenneth.kufluk.com/
              
              
              Severity: Minor
              Found in public/navigator/js-mindmap.js - About 6 hrs to fix

                Method content has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def content
                    # Fetch the content page from our already-queried cache of current user content
                    @content_type = params[:content_type].humanize
                    @content      = @current_user_content[@content_type].detect do |page|
                      page.id == params[:id].to_i
                Severity: Major
                Found in app/controllers/basil_controller.rb - About 5 hrs to fix

                  Method text_outline_export has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.text_outline_export(universe_ids)
                      page_types = Rails.application.config.content_types[:all]
                      temporary_user_id_reference = Universe.find_by(id: universe_ids).user_id
                  
                      export_text = StringIO.new
                  Severity: Minor
                  Found in app/services/export_service.rb - About 5 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 39 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class User < ApplicationRecord
                    acts_as_paranoid
                  
                    # Include default devise modules. Others available are:
                    # :confirmable, :lockable, :timeoutable and :omniauthable
                  Severity: Minor
                  Found in app/models/users/user.rb - About 5 hrs to fix

                    Class ContentController has 39 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ContentController < ApplicationController
                      before_action :authenticate_user!, except: [:show, :changelog, :api_sort] \
                        + Rails.application.config.content_types[:all_non_universe].map { |type| type.name.downcase.pluralize.to_sym }
                    
                      skip_before_action :cache_most_used_page_information, only: [
                    Severity: Minor
                    Found in app/controllers/content_controller.rb - About 5 hrs to fix

                      Method text_markdown_export has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.text_markdown_export(universe_ids)
                          page_types = Rails.application.config.content_types[:all]
                          temporary_user_id_reference = Universe.find_by(id: universe_ids).user_id
                      
                          export_text = StringIO.new
                      Severity: Minor
                      Found in app/services/export_service.rb - About 5 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 pageData has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        pageData() {
                          if (this.state.show_data) {
                            return (
                              <div
                                role="presentation"
                      Severity: Major
                      Found in app/javascript/components/PageLookupSidebar.js - About 5 hrs to fix

                        Method json_export has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.json_export(universe_ids)
                            page_types = Rails.application.config.content_types[:all]
                            temporary_user_id_reference = Universe.find_by(id: universe_ids).user_id
                        
                            export_object = {}
                        Severity: Minor
                        Found in app/services/export_service.rb - About 4 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 constructor has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          constructor(el) {
                            this.el = el;
                            if (!(this.el.length > 0)) { return; }
                        
                            window.editor = new MediumEditor('#editor', {
                        Severity: Major
                        Found in app/assets/javascripts/document_editor.js - About 4 hrs to fix

                          Function constructor has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            constructor(props) {
                              super(props);
                          
                              this.state = {
                                'open': false
                          Severity: Major
                          Found in app/javascript/components/QuickActionsSidebar.js - About 4 hrs to fix

                            Function mindmap has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              $.fn.mindmap = function (options) {
                                // Define default settings.
                                options = $.extend({
                                  attract: 15,
                                  repulse: 6,
                            Severity: Major
                            Found in public/navigator/js-mindmap.js - About 4 hrs to fix

                              File PageLookupSidebar.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /*
                                Usage:
                                <%= react_component("PageLookupSidebar", {document_id: @document.id}) %>
                              */
                              
                              
                              Severity: Minor
                              Found in app/javascript/components/PageLookupSidebar.js - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language