CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/utils/carto.codemirror.js

Summary

Maintainability
F
1 wk
Test Coverage

Function tokenBase has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function tokenBase(stream, state) {
    var ch = stream.next();

    if (ch == "@") {stream.eatWhile(/[\w\-]/); return ret("meta", stream.current());}
    else if (ch == "/" && stream.eat("*")) {
Severity: Major
Found in lib/assets/javascripts/utils/carto.codemirror.js - About 5 hrs to fix

    Avoid deeply nested control flow statements.
    Open

          if(stream.peek() == ")")return ret("number", "unit");//rgba(0,0,0,.25);
    Severity: Major
    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

            if(type == "(" || type == "string")return ret("string", "string"); // allow url(../image.png)
      Severity: Major
      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

              }else if(ch == "~"){
                if(type == "r")return ret("string", "string");
              }else{
                return ret(null, ch);
              }
        Severity: Major
        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                if(stream.peek() == " ")stream.eatSpace();
          Severity: Major
          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    if( selectors.test(stream.current()) ){
                      return ret("tag", "tag");
                    }else if(stream.peek() == ":"){//::-webkit-search-decoration
                      stream.next();
                      stream.eatWhile(/[a-z\\\-]/);
            Severity: Major
            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                  else if (ch == "#") {
                    //we don't eat white-space, we want the hex color and or id only
                    stream.eatWhile(/[A-Za-z0-9]/);
                    //check if there is a proper hex color length e.g. #eee || #eeeEEE
                    if(stream.current().length == 4 || stream.current().length == 7){
              Severity: Major
              Found in lib/assets/javascripts/utils/carto.codemirror.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                          return ret("tag", "tag");
                Severity: Major
                Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          if(t_v)return ret("tag", "tag"); else return ret("variable", "variable");
                  Severity: Major
                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                           return ret('color', 'unit');
                    Severity: Major
                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                if(stream.current().match(/\:\:\-(o|ms|moz|webkit)\-/))return ret("string", "string");
                      Severity: Major
                      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return ret(null, ch);
                        Severity: Major
                        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  if(type == "string" || type == "(")return ret("string", "string");
                          Severity: Major
                          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return ret("string", "string");
                            Severity: Major
                            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return ret("number", "unit");
                              Severity: Major
                              Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                          if( selectors.test(stream.current().substring(1)) )return ret("tag", "tag");
                                Severity: Major
                                Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          if(state.stack[state.stack.length-1] != undefined)return ret(null, ch);
                                  Severity: Major
                                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                          return ret(null, "select-op");
                                    Severity: Major
                                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                return ret(null, ch);
                                      Severity: Major
                                      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return ret("string", "string");
                                        Severity: Major
                                        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return ret("variable", "variable");
                                          Severity: Major
                                          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                      if(stream.current().substring(1) != stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false))return ret("atom", "tag");
                                            Severity: Major
                                            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                        else return ret("color", "unit");
                                              Severity: Major
                                              Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        if(type == "r")return ret("string", "string");
                                                Severity: Major
                                                Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                        return ret("tag", "tag");
                                                  Severity: Major
                                                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                            return ret("string", "string");
                                                    Severity: Major
                                                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                            return ret("keyword", "important");
                                                      Severity: Major
                                                      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                              if(stream.peek() == ")")return ret("number", "unit");//rgba(0,0,0,.25);
                                                        Severity: Major
                                                        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                    else if(stream.peek() == "}" )return ret("color", "unit");
                                                          Severity: Major
                                                          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                  if(type == "(" || type == "string")return ret("string", "string"); // allow url(../image.png)
                                                            Severity: Major
                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                        if( /[\/<>.(){!$%^&*_\-\\?=+\|#'~`]/.test(stream.peek()) )return ret("atom", "tag");
                                                              Severity: Major
                                                              Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
                                                                Severity: Major
                                                                Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                        if(stream.peek() == "=" || type == "a")return ret("string", "string");
                                                                  Severity: Major
                                                                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                            return ret(null, ch);
                                                                    Severity: Major
                                                                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return ret(null, ch);
                                                                      Severity: Major
                                                                      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                return tokenSComment(stream, state);
                                                                        Severity: Major
                                                                        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return ret("tag", "tag");
                                                                          Severity: Major
                                                                          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                      return ret("tag", "tag");
                                                                            Severity: Major
                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      if( /[{<>.a-zA-Z\/]/.test(stream.peek())  || stream.eol() )return ret("tag", "tag"); // e.g. button.icon-plus
                                                                              Severity: Major
                                                                              Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                        if(t_v)return ret("tag", "tag"); else return ret("variable", "variable");
                                                                                Severity: Major
                                                                                Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                        return ret(null, ch);
                                                                                  Severity: Major
                                                                                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                              return ret("tag", "tag");
                                                                                    Severity: Major
                                                                                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                              return ret("atom", "tag");
                                                                                      Severity: Major
                                                                                      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return ret("tag", "tag");
                                                                                        Severity: Major
                                                                                        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return ret(null, ch);
                                                                                          Severity: Major
                                                                                          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                    return ret("number", "unit");
                                                                                            Severity: Major
                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                        else if( /[a-zA-Z\\]/.test(stream.peek()) )return ret("color", "unit");
                                                                                              Severity: Major
                                                                                              Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                        return ret("string", "string");
                                                                                                Severity: Major
                                                                                                Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                        return state.tokenize(stream, state);
                                                                                                  Severity: Major
                                                                                                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                            if( /\/|\)|#/.test(stream.peek() || (stream.eatSpace() && stream.peek() == ")"))  || stream.eol() )return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
                                                                                                    Severity: Major
                                                                                                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                                else if(stream.eol())return ret("color", "unit");
                                                                                                      Severity: Major
                                                                                                      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                  return ret("atom", "tag");
                                                                                                        Severity: Major
                                                                                                        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                  return ret("tag", "tag");
                                                                                                          Severity: Major
                                                                                                          Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                    if(!t_v){
                                                                                                                      var old_pos = stream.pos;
                                                                                                                      var sc = stream.current().length;
                                                                                                                      stream.eatWhile(/[a-z\\\-]/);
                                                                                                                      var new_pos = stream.pos;
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 6 hrs to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 189..200

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 160.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                  }else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){
                                                                                                                    if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){
                                                                                                                      stream.backUp(1);
                                                                                                                      return ret("tag", "tag");
                                                                                                                    }//end if
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 5 hrs to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 171..209

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 142.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                  if (type == "{") {
                                                                                                                    if (context == "@media") state.stack[state.stack.length-1] = "@media{";
                                                                                                                    else state.stack.push("{");
                                                                                                                  }
                                                                                                                  else if (type == "}") state.stack.pop();
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 5 hrs to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 293..298

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 141.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                  if (type == "hash" && context == "rule") style = "atom";
                                                                                                                  else if (style == "variable") {
                                                                                                                    if (context == "rule") style = null; //"tag"
                                                                                                                    else if (!context || context == "@media{") {
                                                                                                                      style = stream.current() == "when"  ? "variable" :
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 4 hrs to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 282..288

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 117.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                while ((ch = stream.next()) != null) {
                                                                                                                  if (dashes >= 2 && ch == ">") {
                                                                                                                    state.tokenize = tokenBase;
                                                                                                                    break;
                                                                                                                  }
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 1 hr to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 243..249

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 74.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                  }else if( stream.eol() || stream.peek() == "[" || stream.peek() == "#" || type == "tag" ){
                                                                                                                    if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1);
                                                                                                                    return ret("tag", "tag");
                                                                                                                  }else if(type == "compare" || type == "a" || type == "("){
                                                                                                                    return ret("string", "string");
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 1 hr to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 179..209

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 73.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                              function keySet(array) {
                                                                                                                var keys = {};
                                                                                                                for (var i = 0; i < array.length; ++i) {
                                                                                                                  keys[array[i]] = true;
                                                                                                                }
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 1 hr to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 213..219

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 62.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                while ((ch = stream.next()) != null) {
                                                                                                                  if (maybeEnd && ch == "/") {
                                                                                                                    state.tokenize = tokenBase;
                                                                                                                    break;
                                                                                                                  }
                                                                                                            Severity: Major
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 1 hr to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 230..236

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 60.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                            Open

                                                                                                                    if( /\/|\)|#/.test(stream.peek() || (stream.eatSpace() && stream.peek() == ")"))  || stream.eol() )return ret("string", "string"); // let url(/images/logo.png) without quotes return as string
                                                                                                            Severity: Minor
                                                                                                            Found in lib/assets/javascripts/utils/carto.codemirror.js and 1 other location - About 55 mins to fix
                                                                                                            lib/assets/javascripts/builder/components/code-mirror/cartocss.code-mirror.js on lines 59..61

                                                                                                            Duplicated Code

                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                            Tuning

                                                                                                            This issue has a mass of 54.

                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                            Refactorings

                                                                                                            Further Reading

                                                                                                            There are no issues that match your filters.

                                                                                                            Category
                                                                                                            Status