indentlabs/notebook

View on GitHub

Showing 288 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              <SpeedDial
                ariaLabel="SpeedDial example"
                icon={<SpeedDialIcon />}
                onClose={() => this.handle_close()}
                onOpen={() => this.handle_open()}
      Severity: Major
      Found in app/javascript/components/QuickPageCreatesFab.js and 1 other location - About 1 day to fix
      app/javascript/components/QuickPageCreatesFab.js on lines 32..52

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 226.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              <SpeedDial
                ariaLabel="SpeedDial example"
                icon={<SpeedDialIcon />}
                onClose={() => this.handle_close()}
                onOpen={() => this.handle_open()}
      Severity: Major
      Found in app/javascript/components/QuickPageCreatesFab.js and 1 other location - About 1 day to fix
      app/javascript/components/QuickPageCreatesFab.js on lines 53..73

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 226.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File forum_replacement_service.rb has 559 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

        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

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                $('.js-move-event-down').click(function () {
                  var event_container = $(this).closest('.timeline-event-container');
                  var event_id = event_container.data('event-id');
              
                  $.get(
              Severity: Major
              Found in app/assets/javascripts/timeline-editor.js and 1 other location - About 6 hrs to fix
              app/assets/javascripts/timeline-editor.js on lines 33..50

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 171.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                $('.js-move-event-up').click(function () {
                  var event_container = $(this).closest('.timeline-event-container');
                  var event_id = event_container.data('event-id');
              
                  $.get(
              Severity: Major
              Found in app/assets/javascripts/timeline-editor.js and 1 other location - About 6 hrs to fix
              app/assets/javascripts/timeline-editor.js on lines 52..69

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 171.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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 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

                    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

                      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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    <a href={this.content_page_view_path(this.state.page_type, this.state.page_id)}>
                                      <ListItem button>
                                        <i className={"blue-text material-icons left"}>
                                          { this.classIcon(this.state.page_type) }
                                        </i>
                        Severity: Major
                        Found in app/javascript/components/PageLookupSidebar.js and 1 other location - About 4 hrs to fix
                        app/javascript/components/PageLookupSidebar.js on lines 281..288

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 127.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language