Showing 57 of 57 total issues

Function exports has 241 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function() {
  var sankey = {},
    nodeWidth = 24,
    nodePadding = 8,
    size = [1, 1],
Severity: Major
Found in src/extjs/sankeyfunctionality.js - About 1 day to fix

Function gameState has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

var gameState = function($q, notificationService, $filter, UPGRADES, ACHIEVEMENTS, GainCalculator, localStorage, AnimatedFlyTip) {

  var getNewState = function() {
    return {
      upgrades: {},
Severity: Minor
Found in src/js/gamestate.js - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function gameState has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var gameState = function($q, notificationService, $filter, UPGRADES, ACHIEVEMENTS, GainCalculator, localStorage, AnimatedFlyTip) {

  var getNewState = function() {
    return {
      upgrades: {},
Severity: Major
Found in src/js/gamestate.js - About 6 hrs to fix

Function gameController has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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];
Severity: Major
Found in src/js/gamecontroller.js - About 5 hrs to fix

Function chartConfigs has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var chartConfigs = function($q, GameState) {
  var defer = $q.defer();

  Highcharts.setOptions({
    global: {
Severity: Major
Found in src/js/chartconfigs.js - About 3 hrs to fix

Function sankey has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var sankey = function(UpgradePath) {
  return {
    restrict: 'E',
    scope: {},
    link: function(scope, element) {
Severity: Major
Found in src/js/sankey.js - About 3 hrs to fix

Function link has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    link: function(scope, element) {

      const constants = {
        OPACITY_LOW: 0.2,
        OPACITY_HIGH: 0.6
Severity: Major
Found in src/js/sankey.js - About 3 hrs to fix

Function computeNodeDepths has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function computeNodeDepths(iterations) {
    var nodesByBreadth = d3.nest()
      .key(function(d) { return d.x; })
      .sortKeys(d3.ascending)
      .entries(nodes)
Severity: Major
Found in src/extjs/sankeyfunctionality.js - About 3 hrs to fix

Function gameController has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

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];
Severity: Minor
Found in src/js/gamecontroller.js - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

      nodesByBreadth.slice().reverse().forEach(function(nodes) {
        nodes.forEach(function(node) {
          if (node.sourceLinks.length) {
            var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value);
            node.y += (y - center(node)) * alpha;
Severity: Major
Found in src/extjs/sankeyfunctionality.js and 1 other location - About 3 hrs to fix
src/extjs/sankeyfunctionality.js on lines 192..199

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

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

      nodesByBreadth.forEach(function(nodes, breadth) {
        nodes.forEach(function(node) {
          if (node.targetLinks.length) {
            var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value);
            node.y += (y - center(node)) * alpha;
Severity: Major
Found in src/extjs/sankeyfunctionality.js and 1 other location - About 3 hrs to fix
src/extjs/sankeyfunctionality.js on lines 207..214

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

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 3 locations. Consider refactoring.
Open

gulp.task('bump:major', function() {
  gulp.src(['./bower.json', './package.json'])
    .pipe(bump({type: 'major'}))
    .pipe(gulp.dest('./'))
    .pipe(filter('package.json'))
Severity: Major
Found in gulpfile.js and 2 other locations - About 3 hrs to fix
gulpfile.js on lines 222..228
gulpfile.js on lines 230..236

Duplicated Code

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

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

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

Tuning

This issue has a mass of 95.

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 3 locations. Consider refactoring.
Open

gulp.task('bump:minor', function() {
  gulp.src(['./bower.json', './package.json'])
    .pipe(bump({type: 'minor'}))
    .pipe(gulp.dest('./'))
    .pipe(filter('package.json'))
Severity: Major
Found in gulpfile.js and 2 other locations - About 3 hrs to fix
gulpfile.js on lines 222..228
gulpfile.js on lines 238..244

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

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 3 locations. Consider refactoring.
Open

gulp.task('bump:patch', function() {
  gulp.src(['./bower.json', './package.json'])
    .pipe(bump({type: 'patch'}))
    .pipe(gulp.dest('./'))
    .pipe(filter('package.json'))
Severity: Major
Found in gulpfile.js and 2 other locations - About 3 hrs to fix
gulpfile.js on lines 230..236
gulpfile.js on lines 238..244

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

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

File upgrades.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open


module.exports = {
  Scoreboard: {
    category: 'Visual',
    levels: [{cost: 5, description: 'Visualize your score!'}]
Severity: Minor
Found in src/js/upgrades.js - About 2 hrs to fix

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

var upgradeManager = function(GameState, UPGRADES, favico) {

  var hasUpgrade = function(key, level = 0) {
    return GameState.upgrade.has(key, level);
  };
Severity: Major
Found in src/js/upgrademanager.js - About 2 hrs to fix

Function functionBuilder has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var functionBuilder = function(GameState, GainCalculator, $window) {
  return {
    build: function() {

      var upgrade = GameState.upgrade;
Severity: Major
Found in src/js/functionbuilder.js - About 2 hrs to fix

Function build has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    build: function() {

      var upgrade = GameState.upgrade;

      var unitText = `${_.camelCase(GameState.currencySet.get())}s`;
Severity: Major
Found in src/js/functionbuilder.js - About 2 hrs to fix

Function functionBuilder has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

var functionBuilder = function(GameState, GainCalculator, $window) {
  return {
    build: function() {

      var upgrade = GameState.upgrade;
Severity: Minor
Found in src/js/functionbuilder.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function exports has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function() {
  var sankey = {},
    nodeWidth = 24,
    nodePadding = 8,
    size = [1, 1],
Severity: Minor
Found in src/extjs/sankeyfunctionality.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language