Odania-IT/odania-gem

View on GitHub

Showing 12 of 25 total issues

Method add_plugin_config has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

            def add_plugin_config(plugin_cfg)
                config_section = plugin_cfg['config']
                group_name = plugin_cfg['plugin-config']['name']

                if $debug
Severity: Minor
Found in lib/odania/config/global_config.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 load has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

            def load(data)
                reset
                @config = data['config'] unless data['config'].nil?
                @plugin_config = data['plugin-config'] unless data['plugin-config'].nil?
                @valid_domains = data['valid_domains'] unless data['valid_domains'].nil?
Severity: Minor
Found in lib/odania/config/plugin_config.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 generate_merged_partials has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

            def generate_merged_partials
                partials = retrieve_hash_path @global_config, %w(partials _general _general default)
                partials = {} if partials.nil?

                # general specific layout
Severity: Minor
Found in lib/odania/config/subdomain_config.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 add has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

            def add(data, group_name=nil)
                duplicates = super(data, group_name)

                self.config = data['config'] unless data['config'].nil?

Severity: Minor
Found in lib/odania/config/sub_domain.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 load_global_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

            def load_global_config(config)
                throw 'Invalid global config!' if config.nil?

                reset
                @default_backend_groups = config['default_backend_groups'] unless config['default_backend_groups'].nil?
Severity: Minor
Found in lib/odania/config/global_config.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 add_plugin_config has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            def add_plugin_config(plugin_cfg)
                config_section = plugin_cfg['config']
                group_name = plugin_cfg['plugin-config']['name']

                if $debug
Severity: Minor
Found in lib/odania/config/global_config.rb - About 1 hr to fix

    Method load_from_consul has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

                def load_from_consul
                    Odania.plugin.get_all.each_pair do |plugin_name, instances|
                        $logger.info "PLUGIN NAME #{plugin_name} - #{instances.count}" if $debug
                        instances.each do |instance|
                            add_backend(instance)
    Severity: Minor
    Found in lib/odania/config/global_config.rb - About 55 mins 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 dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

                def dump
                    result = {}
                    result['group_name'] = self.group_name unless self.group_name.nil?
                    result['plugin_url'] = self.plugin_url unless self.plugin_url.nil?
                    result['cacheable'] = self.cacheable unless self.cacheable.nil?
    Severity: Minor
    Found in lib/odania/config/page.rb - About 45 mins 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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

                def load(data, group_name=nil)
                    self.group_name = data['group_name'] unless data['group_name'].nil?
                    self.group_name = group_name unless group_name.nil?
                    self.plugin_url = data['plugin_url']
                    self.cacheable = data['cacheable'] unless data['cacheable'].nil?
    Severity: Minor
    Found in lib/odania/config/page.rb - About 45 mins 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 get_layout_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

                def get_layout_name
                    # subdomain specific layouts
                    result = retrieve_hash_path @global_config, ['domains', @domain, @subdomain, 'config', 'layout']
                    return result unless result.nil?
    
    
    Severity: Minor
    Found in lib/odania/config/subdomain_config.rb - About 45 mins 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 build_config has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                def build_config(plugin_name, plugin_instance_name, ip, tags=[], port=80)
    Severity: Minor
    Found in lib/odania/consul.rb - About 35 mins to fix

      Method get_layout_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

                  def get_layout_config(layout)
                      # subdomain specific layouts
                      result = retrieve_hash_path @global_config, ['domains', @domain, @subdomain, 'layouts', layout]
                      return result unless result.nil?
      
      
      Severity: Minor
      Found in lib/odania/config/subdomain_config.rb - About 25 mins 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