CartoDB/cartodb20

View on GitHub
lib/carto/named_maps/template.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class Template has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Template
      NAMED_MAPS_VERSION = '0.0.1'.freeze
      MAP_CONFIG_VERSION = '1.5.0'.freeze
      NAME_PREFIX = 'tpl_'.freeze
      AUTH_TYPE_OPEN = 'open'.freeze
Severity: Minor
Found in lib/carto/named_maps/template.rb - About 2 hrs to fix

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

          def options_for_carto_and_torque_layers(layer, index, is_builder)
            layer_options = layer.options.with_indifferent_access
            tile_style = layer_options[:tile_style].strip if layer_options[:tile_style]
    
            options = {
    Severity: Minor
    Found in lib/carto/named_maps/template.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 layers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def layers
            layers = []
            layer_index = -1 # forgive me for I have sinned
    
            is_builder = @visualization.builder?
    Severity: Minor
    Found in lib/carto/named_maps/template.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

    There are no issues that match your filters.

    Category
    Status