dryade/map_layers

View on GitHub

Showing 5 of 5 total issues

Method map_layers_includes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def map_layers_includes(map_builder, options = {}, &block)
      ml_script = options[:map_layer_script] || nil

      layers_added = map_builder.map.layers

Severity: Minor
Found in lib/map_layers/helpers/view_helpers.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 map_layers_script has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def map_layers_script(map_builder, options = {}, &block)
      onload = options[:onload] || false

      img_path = options[:img_path] || '/assets/OpenLayers/'
      unless controller.nil?
Severity: Minor
Found in lib/map_layers/helpers/view_helpers.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 map_layers_container has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def map_layers_container(map_builder, options = {}, &block)
      include_loading = options[:include_loading] || false

      klass = %w(map_container)
      klass << options[:class] unless options[:class].nil?
Severity: Minor
Found in lib/map_layers/helpers/view_helpers.rb - About 35 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 declare_random has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def declare_random(init, options = {})
        s = init.clone
        6.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
        declare(s, options)
      end
Severity: Minor
Found in lib/map_layers/js_extension/js_wrapper.rb - About 35 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 to_js has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def to_js(js_code = nil, options = {})
        method_name = "map_layers_init_#{variable}"

        variables = []
        # map js variables
Severity: Minor
Found in lib/map_layers/js_extension/map_builder.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