CartoDB/cartodb20

View on GitHub
app/controllers/carto/api/vizjson3_presenter.rb

Summary

Maintainability
C
7 hrs
Test Coverage

File vizjson3_presenter.rb has 360 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_dependency 'carto/api/layer_vizjson_adapter'
require_dependency 'carto/api/infowindow_migrator'
require_dependency 'cartodb/redis_vizjson_cache'
require_dependency 'carto/named_maps/template'
require_dependency 'carto/legend_migrator'
Severity: Minor
Found in app/controllers/carto/api/vizjson3_presenter.rb - About 4 hrs to fix

    Method data_for_carto_layer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def data_for_carto_layer(layer_vizjson)
            layer_options = layer_vizjson[:options]
            data = {
              id: layer_vizjson[:id],
              type: layer_vizjson[:type],
    Severity: Minor
    Found in app/controllers/carto/api/vizjson3_presenter.rb - About 1 hr to fix

      Method calculate_vizjson has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def calculate_vizjson(https_request: false, forced_privacy_version: nil)
              options = { https_request: https_request }
      
              user = @visualization.user
              map = @visualization.map
      Severity: Minor
      Found in app/controllers/carto/api/vizjson3_presenter.rb - About 1 hr to fix

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

              def data_for_carto_layer(layer_vizjson)
                layer_options = layer_vizjson[:options]
                data = {
                  id: layer_vizjson[:id],
                  type: layer_vizjson[:type],
        Severity: Minor
        Found in app/controllers/carto/api/vizjson3_presenter.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

        There are no issues that match your filters.

        Category
        Status