tools/jslint.js

Summary

Maintainability
F
1 yr
Test Coverage

Function JSLINT has a Cognitive Complexity of 2546 (exceeds 5 allowed). Consider refactoring.
Open

var JSLINT = (function () {
    var adsafe_id,      // The widget's ADsafe id.
        adsafe_may,     // The widget may load approved scripts.
        adsafe_went,    // ADSAFE.go has been called.
        anonname,       // The guessed name for anonymous functions.
Severity: Minor
Found in tools/jslint.js - About 1 mo 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 JSLINT has 5047 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var JSLINT = (function () {
    var adsafe_id,      // The widget's ADsafe id.
        adsafe_may,     // The widget may load approved scripts.
        adsafe_went,    // ADSAFE.go has been called.
        anonname,       // The guessed name for anonymous functions.
Severity: Major
Found in tools/jslint.js - About 3 wks to fix

    File jslint.js has 5086 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // jslint.js
    // 2010-11-18
    
    /*
    Copyright (c) 2002 Douglas Crockford  (www.JSLint.com)
    Severity: Major
    Found in tools/jslint.js - About 2 wks to fix

      Function lex has 689 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var lex = (function lex() {
              var character, from, line, s;
      
      // Private lex methods
      
      
      Severity: Major
      Found in tools/jslint.js - About 3 days to fix

        Function token has 583 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    token: function () {
                        var b, c, captures, d, depth, high, i, l, low, q, t;
        
                        function match(x) {
                            var r = x.exec(s), r1;
        Severity: Major
        Found in tools/jslint.js - About 2 days to fix

          Function html has 195 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function html() {
                  var a, attributes, e, n, q, t, v, w = option.white, wmode;
                  xmode = 'html';
                  xquote = '';
                  stack = null;
          Severity: Major
          Found in tools/jslint.js - About 7 hrs to fix

            Function itself has 141 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var itself = function (s, o) {
                    var a, i;
                    JSLINT.errors = [];
                    predefined = Object.create(standard);
                    if (o) {
            Severity: Major
            Found in tools/jslint.js - About 5 hrs to fix

              Function doTag has 118 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function doTag(n, a) {
                      var i, t = htmltag[n], x;
                      src = false;
                      if (!t) {
                          error("Unrecognized tag '<{a}>'.",
              Severity: Major
              Found in tools/jslint.js - About 4 hrs to fix

                Function styleSelector has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function styleSelector() {
                        if (nexttoken.identifier) {
                            if (!is_own(htmltag, option.cap ?
                                    nexttoken.value.toLowerCase() : nexttoken.value)) {
                                warning("Expected a tagName, and instead saw {a}.",
                Severity: Major
                Found in tools/jslint.js - About 4 hrs to fix

                  Function string has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  function string(x) {
                                      var c, j, r = '';
                  
                                      if (jsonmode && x !== '"') {
                                          warningAt("Strings must use doublequote.",
                  Severity: Major
                  Found in tools/jslint.js - About 4 hrs to fix

                    Function report has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        itself.report = function (option) {
                            var data = itself.data();
                    
                            var a = [], c, e, err, f, i, k, l, m = '', n, o = [], s;
                    
                    
                    Severity: Major
                    Found in tools/jslint.js - About 4 hrs to fix

                      Function doOption has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function doOption() {
                              var b, obj, filter, o = nexttoken.value, t, v;
                              switch (o) {
                              case '*/':
                                  error("Unbegun comment.");
                      Severity: Major
                      Found in tools/jslint.js - About 3 hrs to fix

                        Function labelled has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            blockstmt('switch', function () {
                                var t = nexttoken,
                                    g = false;
                                funct['(breakage)'] += 1;
                                advance('(');
                        Severity: Major
                        Found in tools/jslint.js - About 3 hrs to fix

                          Function jsonValue has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function jsonValue() {
                          
                                  function jsonObject() {
                                      var o = {}, t = nexttoken;
                                      advance('{');
                          Severity: Major
                          Found in tools/jslint.js - About 3 hrs to fix

                            Function nud has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    nud: function () {
                                        var v = this.value,
                                            s = scope[v],
                                            f;
                                        if (typeof s === 'function') {
                            Severity: Major
                            Found in tools/jslint.js - About 3 hrs to fix

                              Function labelled has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  blockstmt('for', function () {
                                      var f = option.forin, s, t = nexttoken;
                                      funct['(breakage)'] += 1;
                                      funct['(loopage)'] += 1;
                                      advance('(');
                              Severity: Major
                              Found in tools/jslint.js - About 3 hrs to fix

                                Function nud has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        x.nud = function () {
                                            var b, f, i, j, p, seen = {}, t;
                                            b = token.line !== nexttoken.line;
                                            if (b) {
                                                indent += option.indent;
                                Severity: Major
                                Found in tools/jslint.js - About 3 hrs to fix

                                  Function data has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      itself.data = function () {
                                  
                                          var data = {functions: []}, fu, globals, implieds = [], f, i, j,
                                              members = [], n, unused = [], v;
                                          if (itself.errors.length) {
                                  Severity: Major
                                  Found in tools/jslint.js - About 2 hrs to fix

                                    Function statements has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function statements(begin) {
                                            var a = [], f, p;
                                            if (begin && !use_strict() && option.strict) {
                                                warning('Missing "use strict" statement.', nexttoken);
                                            }
                                    Severity: Major
                                    Found in tools/jslint.js - About 2 hrs to fix

                                      Function exps has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          infix('(', function (left, that) {
                                              if (prevtoken.id !== '}' && prevtoken.id !== ')') {
                                                  nobreak(prevtoken, token);
                                              }
                                              nospace();
                                      Severity: Major
                                      Found in tools/jslint.js - About 2 hrs to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                                    if ((i.id === '(number)' && /[.+\-Ee]/.test(i.value)) ||
                                                                            (i.id === '-' && !i.right) ||
                                                                            i.id === '(string)' || i.id === '[' ||
                                                                            i.id === '{' || i.id === 'true' ||
                                                                            i.id === 'false' ||
                                        Severity: Critical
                                        Found in tools/jslint.js - About 2 hrs to fix

                                          Function styleValue has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              function styleValue(v) {
                                                  var i = 0,
                                                      n,
                                                      once,
                                                      match,
                                          Severity: Major
                                          Found in tools/jslint.js - About 2 hrs to fix

                                            Function doAttribute has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                function doAttribute(n, a, v) {
                                                    var u, x;
                                                    if (a === 'id') {
                                                        u = typeof v === 'string' ? v.toUpperCase() : '';
                                                        if (ids[u] === true) {
                                            Severity: Major
                                            Found in tools/jslint.js - About 2 hrs to fix

                                              Function cssColor has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  function cssColor() {
                                                      var i, number, value;
                                                      if (nexttoken.identifier) {
                                                          value = nexttoken.value;
                                                          if (value === 'rgb' || value === 'rgba') {
                                              Severity: Major
                                              Found in tools/jslint.js - About 2 hrs to fix

                                                Function advance has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    function advance(id, t) {
                                                        switch (token.id) {
                                                        case '(number)':
                                                            if (nexttoken.id === '.') {
                                                                warning(
                                                Severity: Major
                                                Found in tools/jslint.js - About 2 hrs to fix

                                                  Function statement has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      function statement(noindent) {
                                                          var i = indent, r, s = scope, t = nexttoken;
                                                  
                                                  // We don't like the empty statement.
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in tools/jslint.js - About 1 hr to fix

                                                    Function cssCounter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        function cssCounter() {
                                                            if (nexttoken.identifier && nexttoken.value === 'counter') {
                                                                advance();
                                                                advance('(');
                                                                advance();
                                                    Severity: Minor
                                                    Found in tools/jslint.js - About 1 hr to fix

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

                                                          function parse(rbp, initial) {
                                                              var left;
                                                              if (nexttoken.id === '(end)') {
                                                                  error("Unexpected early end of program.", token);
                                                              }
                                                      Severity: Minor
                                                      Found in tools/jslint.js - About 1 hr to fix

                                                        Function styles has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            function styles() {
                                                                var i;
                                                                while (nexttoken.id === '@') {
                                                                    i = peek();
                                                                    advance('@');
                                                        Severity: Minor
                                                        Found in tools/jslint.js - About 1 hr to fix

                                                          Function assignop has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                              function assignop(s, f) {
                                                                  symbol(s, 20).exps = true;
                                                                  return infix(s, function (left, that) {
                                                                      var l;
                                                                      that.left = left;
                                                          Severity: Minor
                                                          Found in tools/jslint.js - About 1 hr to fix

                                                            Function varstatement has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                                var varstatement = function varstatement(prefix) {
                                                            
                                                            // JavaScript does not have block scope. It only has function scope. So,
                                                            // declaring a variable in a block can have unexpected consequences.
                                                            
                                                            
                                                            Severity: Minor
                                                            Found in tools/jslint.js - About 1 hr to fix

                                                              Function it has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                      function it(type, value) {
                                                                          var i, t;
                                                                          if (type === '(color)' || type === '(range)') {
                                                                              t = {type: type};
                                                                          } else if (type === '(punctuator)' ||
                                                              Severity: Minor
                                                              Found in tools/jslint.js - About 1 hr to fix

                                                                Function styleAttribute has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                    function styleAttribute() {
                                                                        var v;
                                                                        while (nexttoken.id === '*' || nexttoken.id === '#' ||
                                                                                nexttoken.value === '_') {
                                                                            if (!option.css) {
                                                                Severity: Minor
                                                                Found in tools/jslint.js - About 1 hr to fix

                                                                  Function substyle has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                      function substyle() {
                                                                          var v;
                                                                          for (;;) {
                                                                              if (nexttoken.id === '}' || nexttoken.id === '(end)' ||
                                                                                      xquote && nexttoken.id === xquote) {
                                                                  Severity: Minor
                                                                  Found in tools/jslint.js - About 1 hr to fix

                                                                    Function block has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                        function block(f) {
                                                                            var a, b = inblock, old_indent = indent, s = scope, t;
                                                                            inblock = f;
                                                                            scope = Object.create(scope);
                                                                            nonadjacent(token, nexttoken);
                                                                    Severity: Minor
                                                                    Found in tools/jslint.js - About 1 hr to fix

                                                                      Function jsonObject has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                              function jsonObject() {
                                                                                  var o = {}, t = nexttoken;
                                                                                  advance('{');
                                                                                  if (nexttoken.id !== '}') {
                                                                                      for (;;) {
                                                                      Severity: Minor
                                                                      Found in tools/jslint.js - About 1 hr to fix

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

                                                                            function warning(m, t, a, b, c, d) {
                                                                                var ch, l, w;
                                                                                t = t || nexttoken;
                                                                                if (t.id === '(end)') {  // `~
                                                                                    t = token;
                                                                        Severity: Minor
                                                                        Found in tools/jslint.js - About 1 hr to fix

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

                                                                              function cssUrl() {
                                                                                  var c, url;
                                                                                  if (nexttoken.identifier && nexttoken.value === 'url') {
                                                                                      nexttoken = lex.range('(', ')');
                                                                                      url = nexttoken.value;
                                                                          Severity: Minor
                                                                          Found in tools/jslint.js - About 1 hr to fix

                                                                            Consider simplifying this complex logical expression.
                                                                            Open

                                                                                        if (!left.identifier && left.id !== '.' && left.id !== '[' &&
                                                                                                left.id !== '(' && left.id !== '&&' && left.id !== '||' &&
                                                                                                left.id !== '?') {
                                                                                            warning("Bad invocation.", left);
                                                                                        }
                                                                            Severity: Major
                                                                            Found in tools/jslint.js - About 1 hr to fix

                                                                              Function warningAt has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                              Open

                                                                                  function warningAt(m, l, ch, a, b, c, d) {
                                                                              Severity: Major
                                                                              Found in tools/jslint.js - About 50 mins to fix

                                                                                Function errorAt has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                Open

                                                                                    function errorAt(m, l, ch, a, b, c, d) {
                                                                                Severity: Major
                                                                                Found in tools/jslint.js - About 50 mins to fix

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

                                                                                              if (option.adsafe) {
                                                                                                  if (adsafe_id) {
                                                                                                      if (v.slice(0, adsafe_id.length) !== adsafe_id) {
                                                                                                          warning("ADsafe violation: An id must have a '{a}' prefix",
                                                                                                                  nexttoken, adsafe_id);
                                                                                  Severity: Major
                                                                                  Found in tools/jslint.js - About 45 mins to fix

                                                                                    Avoid deeply nested control flow statements.
                                                                                    Open

                                                                                                            if (nexttoken.id === ')') {
                                                                                                                warning("Use the array literal notation [].", token);
                                                                                                            } else {
                                                                                                                i = parse(0);
                                                                                                                c.dimension = i;
                                                                                    Severity: Major
                                                                                    Found in tools/jslint.js - About 45 mins to fix

                                                                                      Avoid deeply nested control flow statements.
                                                                                      Open

                                                                                                              if (!nexttoken.identifier || cssMedia[nexttoken.value] === true) {
                                                                                                                  error("Expected a CSS media type, and instead saw '{a}'.", nexttoken, nexttoken.id);
                                                                                                              }
                                                                                      Severity: Major
                                                                                      Found in tools/jslint.js - About 45 mins to fix

                                                                                        Avoid deeply nested control flow statements.
                                                                                        Open

                                                                                                                        if (!nextLine()) {
                                                                                                                            errorAt("Unclosed comment.", line, character);
                                                                                                                        } else {
                                                                                                                            if (option.safe && ax.test(s)) {
                                                                                                                                warningAt("ADsafe comment violation.",
                                                                                        Severity: Major
                                                                                        Found in tools/jslint.js - About 45 mins to fix

                                                                                          Avoid deeply nested control flow statements.
                                                                                          Open

                                                                                                                  if (i < a.length - 1) {
                                                                                                                      n += ', ';
                                                                                                                  }
                                                                                          Severity: Major
                                                                                          Found in tools/jslint.js - About 45 mins to fix

                                                                                            Avoid deeply nested control flow statements.
                                                                                            Open

                                                                                                                    if (nexttoken.id === '(end)' || nexttoken.id === '(error)') {
                                                                                                                        error("Missing '>'.", nexttoken);
                                                                                                                    }
                                                                                            Severity: Major
                                                                                            Found in tools/jslint.js - About 45 mins to fix

                                                                                              Avoid deeply nested control flow statements.
                                                                                              Open

                                                                                                      } else if (a === 'name') {
                                                                                                          if (option.adsafe && v.indexOf('_') >= 0) {
                                                                                                              warning("ADsafe name violation.");
                                                                                                          }
                                                                                                      }
                                                                                              Severity: Major
                                                                                              Found in tools/jslint.js - About 45 mins to fix

                                                                                                Avoid deeply nested control flow statements.
                                                                                                Open

                                                                                                                        if (v === 'unused') {
                                                                                                                            unused.push({
                                                                                                                                name: n,
                                                                                                                                line: f['(line)'],
                                                                                                                                'function': f['(name)']
                                                                                                Severity: Major
                                                                                                Found in tools/jslint.js - About 45 mins to fix

                                                                                                  Avoid deeply nested control flow statements.
                                                                                                  Open

                                                                                                                          if (!option.on) {
                                                                                                                              warning("Avoid HTML event handlers.");
                                                                                                                          }
                                                                                                  Severity: Major
                                                                                                  Found in tools/jslint.js - About 45 mins to fix

                                                                                                    Avoid deeply nested control flow statements.
                                                                                                    Open

                                                                                                                                    if (d.isDigit()) {
                                                                                                                                        if (token.id !== '.' && xmode !== 'styleproperty') {
                                                                                                                                            warningAt("Don't use extra leading zeros '{a}'.",
                                                                                                                                                line, character, t);
                                                                                                                                        }
                                                                                                    Severity: Major
                                                                                                    Found in tools/jslint.js - About 45 mins to fix

                                                                                                      Avoid deeply nested control flow statements.
                                                                                                      Open

                                                                                                                                      if (t.length !== 4 && t.length !== 7) {
                                                                                                                                          warningAt("Bad hex color '{a}'.", line,
                                                                                                                                              from + l, t);
                                                                                                                                      }
                                                                                                      Severity: Major
                                                                                                      Found in tools/jslint.js - About 45 mins to fix

                                                                                                        Avoid deeply nested control flow statements.
                                                                                                        Open

                                                                                                                                if (nexttoken.id !== q) {
                                                                                                                                    error("Missing close quote on script attribute.");
                                                                                                                                }
                                                                                                        Severity: Major
                                                                                                        Found in tools/jslint.js - About 45 mins to fix

                                                                                                          Avoid deeply nested control flow statements.
                                                                                                          Open

                                                                                                                                          if (!nextLine()) {
                                                                                                                                              errorAt("Unclosed HTML comment.", l, c);
                                                                                                                                          }
                                                                                                          Severity: Major
                                                                                                          Found in tools/jslint.js - About 45 mins to fix

                                                                                                            Avoid deeply nested control flow statements.
                                                                                                            Open

                                                                                                                                    if (nexttoken.id !== '>') {
                                                                                                                                        warning("Expected '{a}' and instead saw '{b}'.",
                                                                                                                                                nexttoken, '>', nexttoken.value);
                                                                                                                                    }
                                                                                                            Severity: Major
                                                                                                            Found in tools/jslint.js - About 45 mins to fix

                                                                                                              Avoid deeply nested control flow statements.
                                                                                                              Open

                                                                                                                                              for (;;) {
                                                                                                                                                  b = true;
                                                                                                                                                  c = s.charAt(l);
                                                                                                                                                  l += 1;
                                                                                                                                                  switch (c) {
                                                                                                              Severity: Major
                                                                                                              Found in tools/jslint.js - About 45 mins to fix

                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                Open

                                                                                                                                        switch (s[v]) {
                                                                                                                                        case 'function':
                                                                                                                                        case 'unction':
                                                                                                                                            this['function'] = true;
                                                                                                                                            s[v] = 'closure';
                                                                                                                Severity: Major
                                                                                                                Found in tools/jslint.js - About 45 mins to fix

                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                  Open

                                                                                                                                                  for (;;) {
                                                                                                                                                      c = s.charAt(0);
                                                                                                                                                      character += 1;
                                                                                                                                                      s = s.substr(1);
                                                                                                                                                      if (c === ';') {
                                                                                                                  Severity: Major
                                                                                                                  Found in tools/jslint.js - About 45 mins to fix

                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                    Open

                                                                                                                                        if (i <= 0) {
                                                                                                                                            error("A '<{a}>' must be within '<{b}>'.",
                                                                                                                                                    token, n, 'body');
                                                                                                                                        }
                                                                                                                    Severity: Major
                                                                                                                    Found in tools/jslint.js - About 45 mins to fix

                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                      Open

                                                                                                                                              if (option.newcap && (i < 'A' || i > 'Z')) {
                                                                                                                                                  warning(
                                                                                                                                          "A constructor name should start with an uppercase letter.",
                                                                                                                                                      token);
                                                                                                                                              }
                                                                                                                      Severity: Major
                                                                                                                      Found in tools/jslint.js - About 45 mins to fix

                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                        Open

                                                                                                                                                if (data.member[k] === 1) {
                                                                                                                                                    n = '<i>' + n + '</i>';
                                                                                                                                                }
                                                                                                                        Severity: Major
                                                                                                                        Found in tools/jslint.js - About 45 mins to fix

                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                          Open

                                                                                                                                                  if (nexttoken.id !== ',') {
                                                                                                                                                      break;
                                                                                                                                                  }
                                                                                                                          Severity: Major
                                                                                                                          Found in tools/jslint.js - About 45 mins to fix

                                                                                                                            Function warning has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                            Open

                                                                                                                                function warning(m, t, a, b, c, d) {
                                                                                                                            Severity: Minor
                                                                                                                            Found in tools/jslint.js - About 45 mins to fix

                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                              Open

                                                                                                                                                              if (i >= 0) {
                                                                                                                                                                  break;
                                                                                                                                                              }
                                                                                                                              Severity: Major
                                                                                                                              Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                Open

                                                                                                                                                                for (;;) {
                                                                                                                                                                    c = s.charAt(0);
                                                                                                                                                                    if ((c < '0' || c > '9') &&
                                                                                                                                                                            (c < 'a' || c > 'f') &&
                                                                                                                                                                            (c < 'A' || c > 'F')) {
                                                                                                                                Severity: Major
                                                                                                                                Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                  Open

                                                                                                                                                      } else if (a === 'style') {
                                                                                                                                                          xmode = 'scriptstring';
                                                                                                                                                          advance('=');
                                                                                                                                                          q = nexttoken.id;
                                                                                                                                                          if (q !== '"' && q !== "'") {
                                                                                                                                  Severity: Major
                                                                                                                                  Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                    Open

                                                                                                                                                            if (l + n.length > 72) {
                                                                                                                                                                o.push(m + '<br>');
                                                                                                                                                                m = '    ';
                                                                                                                                                                l = 1;
                                                                                                                                                            }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                      Open

                                                                                                                                                                  if (xmode === 'html') {
                                                                                                                                                                      if (option.safe) {
                                                                                                                                                                          warningAt("ADsafe string violation.",
                                                                                                                                                                                  line, character + j);
                                                                                                                                                                      }
                                                                                                                                      Severity: Major
                                                                                                                                      Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                        Open

                                                                                                                                                            if (typeof b !== 'number' || !isFinite(b) || b <= 0 ||
                                                                                                                                                                    Math.floor(b) !== b) {
                                                                                                                                                                error("Expected a small integer and instead saw '{a}'.",
                                                                                                                                                                        v, v.value);
                                                                                                                                                            }
                                                                                                                                        Severity: Major
                                                                                                                                        Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                          Open

                                                                                                                                                          } else if (t.value === 'maxlen' && o === '/*jslint') {
                                                                                                                                                              b = +v.value;
                                                                                                                                                              if (typeof b !== 'number' || !isFinite(b) || b <= 0 ||
                                                                                                                                                                      Math.floor(b) !== b) {
                                                                                                                                                                  error("Expected a small integer and instead saw '{a}'.",
                                                                                                                                          Severity: Major
                                                                                                                                          Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                            Open

                                                                                                                                                                    if (q !== '"' && q !== "'") {
                                                                                                                                                                        error("Missing quote.");
                                                                                                                                                                    }
                                                                                                                                            Severity: Major
                                                                                                                                            Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                              Function error has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                              Open

                                                                                                                                                  function error(m, t, a, b, c, d) {
                                                                                                                                              Severity: Minor
                                                                                                                                              Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                                Open

                                                                                                                                                                                if (i >= 0) {
                                                                                                                                                                                    break;
                                                                                                                                                                                }
                                                                                                                                                Severity: Major
                                                                                                                                                Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                                  Open

                                                                                                                                                                          if (nexttoken.id === '%') {
                                                                                                                                                                              advance('%');
                                                                                                                                                                              if (number > 100) {
                                                                                                                                                                                  warning("Expected a percentage and instead saw '{a}'",
                                                                                                                                                                                      token, number);
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                                    Open

                                                                                                                                                                            if (left.value === 'Math') {
                                                                                                                                                                                warning("Math is not a function.", left);
                                                                                                                                                                            } else if (option.newcap) {
                                                                                                                                                                                warning(
                                                                                                                                                    "Missing 'new' prefix when invoking a constructor.", left);
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                                      Open

                                                                                                                                                                                      if (i >= 0) {
                                                                                                                                                                                          errorAt("Nested HTML comment.",
                                                                                                                                                                                              line, character + i);
                                                                                                                                                                                      }
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                                        Open

                                                                                                                                                                                if (option.undef) {
                                                                                                                                                                                    warning("'{a}' is not defined.", token, v);
                                                                                                                                                                                } else {
                                                                                                                                                                                    funct[v] = true;
                                                                                                                                                                                }
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                                          Open

                                                                                                                                                                                  if (nexttoken.id !== ',') {
                                                                                                                                                                                      break;
                                                                                                                                                                                  }
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in tools/jslint.js - About 45 mins to fix

                                                                                                                                                            Consider simplifying this complex logical expression.
                                                                                                                                                            Open

                                                                                                                                                                    } else if (a === 'href' || a === 'background' ||
                                                                                                                                                                            a === 'content' || a === 'data' ||
                                                                                                                                                                            a.indexOf('src') >= 0 || a.indexOf('url') >= 0) {
                                                                                                                                                                        if (option.safe && ux.test(v)) {
                                                                                                                                                                            error("ADsafe URL violation.");
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in tools/jslint.js - About 40 mins to fix

                                                                                                                                                              Consider simplifying this complex logical expression.
                                                                                                                                                              Open

                                                                                                                                                                              if (nexttoken.id === '=' || nexttoken.value === '~=' ||
                                                                                                                                                                                      nexttoken.value === '$=' ||
                                                                                                                                                                                      nexttoken.value === '|=' ||
                                                                                                                                                                                      nexttoken.id === '*=' ||
                                                                                                                                                                                      nexttoken.id === '^=') {
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in tools/jslint.js - About 40 mins to fix

                                                                                                                                                                Consider simplifying this complex logical expression.
                                                                                                                                                                Open

                                                                                                                                                                                            if (!nexttoken.identifier &&
                                                                                                                                                                                                    nexttoken.id !== '"' &&
                                                                                                                                                                                                    nexttoken.id !== '\'' &&
                                                                                                                                                                                                    nexttoken.type !== '(string)' &&
                                                                                                                                                                                                    nexttoken.type !== '(number)' &&
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in tools/jslint.js - About 40 mins to fix

                                                                                                                                                                  Consider simplifying this complex logical expression.
                                                                                                                                                                  Open

                                                                                                                                                                                                      if ((c < '0' || c > '9') &&
                                                                                                                                                                                                              (c < 'a' || c > 'f') &&
                                                                                                                                                                                                              (c < 'A' || c > 'F')) {
                                                                                                                                                                                                          break;
                                                                                                                                                                                                      }
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in tools/jslint.js - About 40 mins to fix

                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                    Open

                                                                                                                                                                                                    return it('(color)', t);
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                      Open

                                                                                                                                                                                      return match;
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                        Open

                                                                                                                                                                                                                return;
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                          Open

                                                                                                                                                                                                      return it('(punctuator)', t);
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                            Open

                                                                                                                                                                                                        return it('(punctuator)', t);
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                              Open

                                                                                                                                                                                                          return it('(punctuator)', t);
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                Open

                                                                                                                                                                                                                return it('(regexp)', c);
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                  Open

                                                                                                                                                                                                                          return it('(regexp)', c);
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in tools/jslint.js - About 30 mins to fix

                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                    Open

                                                                                                                                                                                                                return it('(number)', t);
                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                    Found in tools/jslint.js - About 30 mins to fix

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

                                                                                                                                                                                      var JSLINT = (function () {
                                                                                                                                                                                          var adsafe_id,      // The widget's ADsafe id.
                                                                                                                                                                                              adsafe_may,     // The widget may load approved scripts.
                                                                                                                                                                                              adsafe_went,    // ADSAFE.go has been called.
                                                                                                                                                                                              anonname,       // The guessed name for anonymous functions.
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in tools/jslint.js and 1 other location - About 8 mos to fix
                                                                                                                                                                                      tools/jslint/fulljslint.js on lines 264..5786

                                                                                                                                                                                      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 38052.

                                                                                                                                                                                      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

                                                                                                                                                                                      (function(a) {
                                                                                                                                                                                          var input="";
                                                                                                                                                                                          var line="";
                                                                                                                                                                                          var blankcount="0";
                                                                                                                                                                                          while (blankcount < 10){
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in tools/jslint.js and 1 other location - About 1 day to fix
                                                                                                                                                                                      tools/jslint/spidermonkey.js on lines 1..38

                                                                                                                                                                                      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 321.

                                                                                                                                                                                      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