cubesystems/releaf

View on GitHub

Showing 42 of 95 total issues

Function RemoteValidator has 259 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var RemoteValidator = function( form )
{
    // self
    var v = this;
    var body = jQuery('body');
Severity: Major
Found in releaf-core/app/assets/javascripts/releaf/include/remote_validator.js - About 1 day to fix

    Function UrlBuilder has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    function UrlBuilder( params )
    {
        if( params === undefined )
        {
            params = {};
    Severity: Minor
    Found in releaf-core/app/assets/javascripts/releaf/include/url_builder.js - 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 add has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    UrlBuilder.prototype.add = function( params, value )
    {
        if( params instanceof Array )
        {
            for( var i = 0; i < params.length; i++ )
    Severity: Minor
    Found in releaf-core/app/assets/javascripts/releaf/include/url_builder.js - 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 TableBuilder has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Releaf::Builders::TableBuilder
      include Releaf::Builders::Base
      include Releaf::Builders::Toolbox
      attr_accessor :collection, :options, :template, :resource_class
    
    
    Severity: Minor
    Found in releaf-core/app/builders/releaf/builders/table_builder.rb - About 4 hrs to fix

      Class LayoutBuilder has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class LayoutBuilder
          include Releaf::Builders::Base
          include Releaf::Builders::Template
      
          def output(&block)
      Severity: Minor
      Found in releaf-core/app/builders/releaf/builders/page/layout_builder.rb - About 3 hrs to fix

        File remote_validator.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var RemoteValidator = function( form )
        {
            // self
            var v = this;
            var body = jQuery('body');
        Severity: Minor
        Found in releaf-core/app/assets/javascripts/releaf/include/remote_validator.js - About 3 hrs to fix

          Class Settings has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Releaf::Settings < ActiveRecord::Base
          
            self.table_name = table_name_prefix + "settings"
          
            class SettingNotFound < RuntimeError; end
          Severity: Minor
          Found in releaf-core/lib/releaf/settings.rb - About 3 hrs to fix

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

            class Releaf::ActionController < ActionController::Base
              # must be first other in stange way non-text env will
              # have CSRF on richtext attachment upload
              protect_from_forgery
            
            
            Severity: Minor
            Found in releaf-core/app/controllers/releaf/action_controller.rb - About 3 hrs to fix

              Function UrlBuilder has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function UrlBuilder( params )
              {
                  if( params === undefined )
                  {
                      params = {};
              Severity: Major
              Found in releaf-core/app/assets/javascripts/releaf/include/url_builder.js - About 2 hrs to fix

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

                class Releaf::I18nDatabase::TranslationsStore
                  include Releaf::InstanceCache
                  attr_accessor :updated_at, :missing_keys
                
                  def initialize

                  Class IndexBuilder has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Releaf::Builders::IndexBuilder
                    include Releaf::Builders::View
                    include Releaf::Builders::Collection
                  
                    def header_extras
                  Severity: Minor
                  Found in releaf-core/app/builders/releaf/builders/index_builder.rb - About 2 hrs to fix

                    Function add has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    UrlBuilder.prototype.add = function( params, value )
                    {
                        if( params instanceof Array )
                        {
                            for( var i = 0; i < params.length; i++ )
                    Severity: Major
                    Found in releaf-core/app/assets/javascripts/releaf/include/url_builder.js - About 2 hrs to fix

                      Method has_error? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def has_error?(error_message, options = {})
                            error_found = false
                            if options[:field]
                              first('.field.has-error', minimum: 1) # wait for any errors to come from validation
                              all(".field.has-error", wait: false).each do |field_container|
                      Severity: Minor
                      Found in lib/releaf/rspec/features_matchers.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

                      Function init has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              init: function( editor )
                              {
                                 var me = this;
                                 CKEDITOR.dialog.add( 'MediaEmbedDialog', function (instance)
                                 {

                        Method store_settings has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def store_settings
                            settings = params.permit(settings: [:key, :value]).to_h.fetch(:settings, nil)
                            if settings
                              settings.each do|item|
                                next if item[:key].nil? || item[:value].nil?
                        Severity: Minor
                        Found in releaf-core/app/controllers/releaf/root_controller.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 join_reflection_without_through has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def join_reflection_without_through(reflection, table)
                              klass = reflection.active_record
                              other_class = reflection.klass
                        
                              table1 = table || klass.arel_table
                        Severity: Minor
                        Found in releaf-core/app/lib/releaf/search.rb - About 1 hr to fix

                          Method verify_resources_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def verify_resources_config(resource_config)
                                # perform some basic config structure validation
                                unless resource_config.is_a? Hash
                                  raise Releaf::Error, "Releaf.application.config.content.resources must be a Hash"
                                end
                          Severity: Minor
                          Found in releaf-content/lib/releaf/content/configuration.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

                          Function getUrl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          UrlBuilder.prototype.getUrl = function()
                          {
                              var query = '';
                              var isFirst = true;
                              for( var i in this.query )
                          Severity: Minor
                          Found in releaf-core/app/assets/javascripts/releaf/include/url_builder.js - 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 releaf_resources has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def releaf_resources(*args)
                              resources(*args) do
                                yield if block_given?
                                member do
                                  get :confirm_destroy if route_enabled?(:destroy, args.last)
                          Severity: Minor
                          Found in releaf-core/lib/releaf/route_mapper.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 mount_releaf_at has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def mount_releaf_at(mount_location)
                              mount_location_namespace = mount_location.delete("/").to_sym
                              Releaf.application.config.mount_location = mount_location_namespace.to_s
                              scope mount_location do
                                initialize_releaf_components
                          Severity: Minor
                          Found in releaf-core/lib/releaf/route_mapper.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

                          Severity
                          Category
                          Status
                          Source
                          Language