CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/builder/data/camshaft-reference.js

Summary

Maintainability
C
1 day
Test Coverage

Function validate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  validate: function (formAttrs) {
    var errors = {};

    var parsedAttrs = this.parse(formAttrs);
    var params = this.paramsForType(formAttrs.type);
Severity: Minor
Found in lib/assets/javascripts/builder/data/camshaft-reference.js - About 3 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 parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  parse: function (formAttrs) {
    var parsedAttrs = _.extend({}, formAttrs);
    var params = this.paramsForType(formAttrs.type);

    for (var name in params) {
Severity: Minor
Found in lib/assets/javascripts/builder/data/camshaft-reference.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

Function validate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  validate: function (formAttrs) {
    var errors = {};

    var parsedAttrs = this.parse(formAttrs);
    var params = this.paramsForType(formAttrs.type);
Severity: Minor
Found in lib/assets/javascripts/builder/data/camshaft-reference.js - About 1 hr to fix

    Function parse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      parse: function (formAttrs) {
        var parsedAttrs = _.extend({}, formAttrs);
        var params = this.paramsForType(formAttrs.type);
    
        for (var name in params) {
    Severity: Minor
    Found in lib/assets/javascripts/builder/data/camshaft-reference.js - About 1 hr to fix

      Function getDefaultCartoCSSForType has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getDefaultCartoCSSForType: function () {
          return _.template([
            "#layer['mapnik::geometry_type'=1] {",
            '  marker-width: <%= point.fill.size.fixed %>;',
            '  marker-fill: <%= point.fill.color.fixed %>;',
      Severity: Minor
      Found in lib/assets/javascripts/builder/data/camshaft-reference.js - About 1 hr to fix

        Function getSourceNamesForAnalysisType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          getSourceNamesForAnalysisType: function (type) {
            if (!SOURCE_NAMES_MAP[type]) {
              var sourceNames = [];
              var params = this.paramsForType(type);
        
        
        Severity: Minor
        Found in lib/assets/javascripts/builder/data/camshaft-reference.js - 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