seiyria/c

Complex method in _initNodes

      var _initNodes = function() {
        var node = svg.append('g').selectAll('.node')
            .data(scope.data.nodes)
            .enter()
            .append('g')

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in visible

  var visible = function() {

    var current = GameState.unit.get();
    var allRet = [];

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in _initLinks

      var _initLinks = function() {
        var link = svg.append('g').selectAll('.link')
            .data(scope.data.links)
            .enter()
            .append('path')

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in load

  var load = function() {
    var state = localStorage.get('game');

    if(!state) { return; }

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in gameController

var gameController = function($scope, $window, $interval, $filter, $http, $modal, GameState, ChartConfigs, GameTimer, UpgradeManager, FunctionBuilder, UpgradePath, NgTableParams, ACHIEVEMENTS) {
  $scope.ACHIEVEMENTS = ACHIEVEMENTS;
  $scope._visibleUpgrades = [];
  $scope.groupVisibleHash = {};
  $scope.tabActive = [true, false, false, false];

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Expected '{' and instead saw 'return'.

    if (!arguments.length) return nodeWidth;

Why do I see this error?

This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

Expected '{' and instead saw 'return'.

    if (!arguments.length) return nodePadding;

Why do I see this error?

This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

Expected '{' and instead saw 'return'.

    if (!arguments.length) return nodes;

Why do I see this error?

This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

Expected '{' and instead saw 'return'.

    if (!arguments.length) return links;

Why do I see this error?

This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

Expected '{' and instead saw 'return'.

    if (!arguments.length) return size;

Why do I see this error?

This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

A leading decimal point can be confused with a dot: '.5'.

    var curvature = .5;

    Strings must use singlequote.

          return "M" + x0 + "," + y0

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Strings must use singlequote.

          return "M" + x0 + "," + y0

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Strings must use singlequote.

            + "C" + x2 + "," + y0

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Bad line breaking before '+'.

            + "C" + x2 + "," + y0

    The laxbreak option can turn this warning off. This option suppresses most of the warnings about possibly unsafe line breakings in your code. It doesn't suppress warnings about comma-first coding style. To suppress those you have to use laxcomma.

    If you don't intend to code in a style that relies on non-standard line breaks, this option will warn you if you are prone to issues with automatic semicolon insertion.

    Strings must use singlequote.

            + "C" + x2 + "," + y0

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Strings must use singlequote.

            + " " + x3 + "," + y1

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Bad line breaking before '+'.

            + " " + x3 + "," + y1

    The laxbreak option can turn this warning off. This option suppresses most of the warnings about possibly unsafe line breakings in your code. It doesn't suppress warnings about comma-first coding style. To suppress those you have to use laxcomma.

    If you don't intend to code in a style that relies on non-standard line breaks, this option will warn you if you are prone to issues with automatic semicolon insertion.

    Strings must use singlequote.

            + " " + x3 + "," + y1

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Strings must use singlequote.

            + " " + x1 + "," + y1;

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Bad line breaking before '+'.

            + " " + x1 + "," + y1;

    The laxbreak option can turn this warning off. This option suppresses most of the warnings about possibly unsafe line breakings in your code. It doesn't suppress warnings about comma-first coding style. To suppress those you have to use laxcomma.

    If you don't intend to code in a style that relies on non-standard line breaks, this option will warn you if you are prone to issues with automatic semicolon insertion.

    Strings must use singlequote.

            + " " + x1 + "," + y1;

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Expected '{' and instead saw 'return'.

          if (!arguments.length) return curvature;

    Why do I see this error?

    This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

    Strings must use singlequote.

          if (typeof source === "number") source = link.source = nodes[link.source];

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Expected '{' and instead saw 'source'.

          if (typeof source === "number") source = link.source = nodes[link.source];

    Why do I see this error?

    This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

    Strings must use singlequote.

          if (typeof target === "number") target = link.target = nodes[link.target];

    When do I get this error?

    JSHint (since version r09) will throw the "Mixed double and single quotes" error when it encounters a string literal delimited by double or single quote characters, when a string literal delimited by the other has already been encountered, but only when quotmark option is set to true.

    Why do I get this error?

    This error is raised to highlight a lack of consistency. There is no difference in JavaScript between single and double quotes. This is made clear by the grammar for string literals (ES5 §7.8.4).

    The only difference is that DoubleStringCharacters cannot contain another double quote, and SingleStringCharacters cannot contain a single quote (as that would terminate the string literal).

    However, it would usually be frowned upon to mix both types of quote within one program (there are obvious exceptions, such as nested quotes). You can easily resolve this issue by sticking to one type, and you should consider setting the quotmark option to either double or single to enforce your preference.

    In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W110. This means you can tell JSHint to not issue this warning with the /jshint -W110 / directive.

    Expected '{' and instead saw 'target'.

          if (typeof target === "number") target = link.target = nodes[link.target];

    Why do I see this error?

    This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

    Don't make functions within a loop.

          });

      A leading decimal point can be confused with a dot: '.99'.

            relaxRightToLeft(alpha *= .99);

        'initializeNodeDepth' was used before it was defined.

            function initializeNodeDepth() {

          'relaxLeftToRight' was used before it was defined.

              function relaxLeftToRight(alpha) {

            'relaxRightToLeft' was used before it was defined.

                function relaxRightToLeft(alpha) {

              'resolveCollisions' was used before it was defined.

                  function resolveCollisions() {

                Expected '{' and instead saw 'node'.

                          if (dy > 0) node.y += dy;

                Why do I see this error?

                This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

                Expected '{' and instead saw 'node'.

                            if (dy > 0) node.y -= dy;

                Why do I see this error?

                This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.

                'moveSourcesRight' is defined but never used.

                  function moveSourcesRight() {

                This warning is from the "unused" option in JSHint. From the documentation:

                This option warns when you define and never use your variables. It is very useful for general code cleanup, especially when used in addition to undef.

                /*jshint unused:true */
                
                function test(a, b) {
                  var c, d = 2;
                
                  return a + d;
                }
                
                test(1, 2);
                
                // Line 3: 'b' was defined but never used.
                // Line 4: 'c' was defined but never used.
                

                In addition to that, this option will warn you about unused global variables declared via /*global ... */ directive.

                This can be set to vars to only check for variables, not function parameters, or strict to check all variables and parameters. The default (true) behavior is to allow unused parameters that are followed by a used parameter.

                'breadth' is defined but never used.

                      nodesByBreadth.forEach(function(nodes, breadth) {

                This warning is from the "unused" option in JSHint. From the documentation:

                This option warns when you define and never use your variables. It is very useful for general code cleanup, especially when used in addition to undef.

                /*jshint unused:true */
                
                function test(a, b) {
                  var c, d = 2;
                
                  return a + d;
                }
                
                test(1, 2);
                
                // Line 3: 'b' was defined but never used.
                // Line 4: 'c' was defined but never used.
                

                In addition to that, this option will warn you about unused global variables declared via /*global ... */ directive.

                This can be set to vars to only check for variables, not function parameters, or strict to check all variables and parameters. The default (true) behavior is to allow unused parameters that are followed by a used parameter.

                Expected '{' and instead saw 'return'.

                      if(!UPGRADES[key].levels[nextLevel]) return;

                Why do I see this error?

                This is a bit of a catch-all JSHint error that needs to be explained on a case by case basis. In the case of equality operators, for example, you may see Expected '==' and instead saw '===' - please see this article for more details about JavaScript and equality.