jtblin/angular-chart.js

View on GitHub

Showing 29 of 29 total issues

File bubble.js has 784 lines of code (exceeds 250 allowed). Consider refactoring.
Open

angular.module('app', ['chart.js'])
  .config(['ChartJsProvider', function (ChartJsProvider) {
    'use strict';
    ChartJsProvider.setOptions({
      tooltips: { enabled: false }
Severity: Major
Found in test/fixtures/bubble.js - About 1 day to fix

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

        ['labels', 'colors', 'series', 'options'].forEach(function (attr) {
          it('does not re-create the chart on ' + attr + ' not changed', function () {
            var markup = '<div style="width: 250px; height:120px">' +
              '<canvas class="chart chart-line" chart-data="data" chart-labels="labels" chart-series="series" ' +
                'chart-colors="colors" chart-options="options"></canvas></div>';
    Severity: Major
    Found in test/test.unit.js and 1 other location - About 1 day to fix
    test/test.unit.js on lines 356..396

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

    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

        ['labels', 'colors', 'series', 'options'].forEach(function (attr) {
          it('re-creates the chart on ' + attr + ' changes', function () {
            var markup = '<div style="width: 250px; height:120px">' +
              '<canvas class="chart chart-line" chart-data="data" chart-labels="labels" chart-series="series" ' +
                'chart-colors="colors" chart-options="options"></canvas></div>';
    Severity: Major
    Found in test/test.unit.js and 1 other location - About 1 day to fix
    test/test.unit.js on lines 398..438

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

    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

    Function ChartJsFactory has 239 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function ChartJsFactory (ChartJs, $timeout) {
        return function chart (type) {
          return {
            restrict: 'CA',
            scope: {
    Severity: Major
    Found in angular-chart.js - About 1 day to fix

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

        app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
          $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
          $scope.series = ['Series A', 'Series B'];
          $scope.data = [
            [65, 59, 80, 81, 56, 55, 40],
      Severity: Major
      Found in test/fixtures/charts.js and 1 other location - About 6 hrs to fix
      test/fixtures/options-override.js on lines 14..29

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

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

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

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

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

      Refactorings

      Further Reading

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

        app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
          $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
          $scope.series = ['Series A', 'Series B'];
          $scope.data = [
            [65, 59, 80, 81, 56, 55, 40],
      Severity: Major
      Found in test/fixtures/options-override.js and 1 other location - About 6 hrs to fix
      test/fixtures/charts.js on lines 9..24

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

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

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

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

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

      Refactorings

      Further Reading

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

        app.controller('BarCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
          $scope.options = { scaleShowVerticalLines: false };
          $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
          $scope.series = ['Series A', 'Series B'];
          $scope.data = [
      Severity: Major
      Found in test/fixtures/charts.js and 1 other location - About 4 hrs to fix
      test/fixtures/options-override.js on lines 31..42

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

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

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

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

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

      Refactorings

      Further Reading

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

        app.controller('BarCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
          $scope.options = { scaleShowVerticalLines: false };
          $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
          $scope.series = ['Series A', 'Series B'];
          $scope.data = [
      Severity: Major
      Found in test/fixtures/options-override.js and 1 other location - About 4 hrs to fix
      test/fixtures/charts.js on lines 26..37

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

      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 test.unit.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*jshint mocha:true*/
      /*global module:true*/
      /*global inject:true*/
      /*global expect:true*/
      /*global sinon:true*/
      Severity: Minor
      Found in test/test.unit.js - About 4 hrs to fix

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

                  if (['line', 'bar', 'horizontalBar', 'radar'].indexOf(type) > - 1) {
                    scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
                    scope.data = [
                      [65, 59, 80, 81, 56, 55, 40],
                      [28, 48, 40, 19, 86, 27, 90]
        Severity: Major
        Found in test/test.unit.js and 1 other location - About 3 hrs to fix
        test/test.unit.js on lines 37..46

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

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

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

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

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

        Refactorings

        Further Reading

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

                  if (['line', 'bar', 'horizontalBar', 'radar'].indexOf(type) > - 1) {
                    scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
                    scope.data = [
                      [65, 59, 80, 81, 56, 55, 40],
                      [28, 48, 40, 19, 86, 27, 90]
        Severity: Major
        Found in test/test.unit.js and 1 other location - About 3 hrs to fix
        test/test.unit.js on lines 71..80

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

        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 angular-chart.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        (function (factory) {
          'use strict';
          if (typeof exports === 'object') {
            // Node/CommonJS
            module.exports = factory(
        Severity: Minor
        Found in angular-chart.js - About 3 hrs to fix

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

            app.controller('DoughnutCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
              $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales'];
              $scope.data = [0, 0, 0];
              // TODO: investigate why chart was not showing up without this hack
              $timeout(function () {
          Severity: Major
          Found in test/fixtures/options-override.js and 1 other location - About 2 hrs to fix
          test/fixtures/charts.js on lines 39..46

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

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

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

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

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

          Refactorings

          Further Reading

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

            app.controller('DoughnutCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
              $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales'];
              $scope.data = [0, 0, 0];
              // TODO: investigate why chart was not showing up without this hack
              $timeout(function () {
          Severity: Major
          Found in test/fixtures/charts.js and 1 other location - About 2 hrs to fix
          test/fixtures/options-override.js on lines 44..51

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

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

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

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

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

          Refactorings

          Further Reading

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

            app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
              $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales'];
              $scope.data = [0, 0, 0];
              $timeout(function () {
                $scope.data = [350, 450, 100];
          Severity: Major
          Found in test/fixtures/options-override.js and 1 other location - About 2 hrs to fix
          test/fixtures/charts.js on lines 48..54

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

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

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

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

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

          Refactorings

          Further Reading

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

            app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
              $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales'];
              $scope.data = [0, 0, 0];
              $timeout(function () {
                $scope.data = [350, 450, 100];
          Severity: Major
          Found in test/fixtures/charts.js and 1 other location - About 2 hrs to fix
          test/fixtures/options-override.js on lines 53..59

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

          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

            app.controller('TabsCtrl', function ($scope) {
              $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
              $scope.active = true;
              $scope.data = [
                [65, 59, 90, 81, 56, 55, 40],
          Severity: Major
          Found in test/fixtures/29-tabs.js and 1 other location - About 2 hrs to fix
          test/fixtures/horizontal-bar-chart.js on lines 9..16

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

          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

            app.controller('HorizontalBarCtrl', function ($scope) {
              $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
              $scope.active = true;
              $scope.data = [
                [65, 59, 90, 81, 56, 55, 40],
          Severity: Major
          Found in test/fixtures/horizontal-bar-chart.js and 1 other location - About 2 hrs to fix
          test/fixtures/29-tabs.js on lines 9..16

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

          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

          Function chart has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              return function chart (type) {
                return {
                  restrict: 'CA',
                  scope: {
                    chartGetColor: '=?',
          Severity: Major
          Found in angular-chart.js - About 2 hrs to fix

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

                      expect(spyChart).to.have.been.calledWithExactly(
                        sinon.match.any,
                        sinon.match({ type: type, data: sinon.match.object, options: sinon.match.object })
                      );
            Severity: Major
            Found in test/test.unit.js and 1 other location - About 2 hrs to fix
            test/test.unit.js on lines 58..61

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 76.

            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

            Severity
            Category
            Status
            Source
            Language