wikimedia/wikimedia-fundraising-dash

View on GitHub

Showing 93 of 93 total issues

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

        self.makeChart = function () {
            if ( params.sharedContext.dayObj.length < 2 ) {
                return;
            }
            self.hasData( true );
Severity: Major
Found in src/components/widgets/amt-per-second-chart/amt-per-second-chart.js - About 3 hrs to fix

    Function makeChart has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            self.makeChart = function ( data ) {
                var colors = {},
                    axes = {},
                    settings,
                    columns = [],
    Severity: Major
    Found in src/components/widgets/x-by-y/x-by-y.js - About 3 hrs to fix

      File data.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable no-console */
      var widgets = require( '../widgets' ),
          odataParser = require( 'odata-parser' ),
          mysqlPromise = require( 'mysql-promise' )(),
          config = require( '../config.js' ),
      Severity: Minor
      Found in routes/data.js - About 3 hrs to fix

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

                right: {
                    type: 'and',
                    left: {
                        type: 'eq',
                        left: { type: 'property', name: 'Month' },
        Severity: Major
        Found in widgets/totals-earned-chart.js and 1 other location - About 3 hrs to fix
        widgets/totals-earned-chart.js on lines 20..32

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

        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

                left: {
                    type: 'and',
                    left: {
                        type: 'eq',
                        left: { type: 'property', name: 'Year' },
        Severity: Major
        Found in widgets/totals-earned-chart.js and 1 other location - About 3 hrs to fix
        widgets/totals-earned-chart.js on lines 33..45

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

        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

            getInstance: function ( req, res ) {
                persistence.getWidgetInstance( req.params.id, req.session.passport.user.localId ).then( function ( instance ) {
                    res.json( instance );
                }, function ( error ) {
                    res.json( { error: error } );
        Severity: Major
        Found in routes/widget.js and 1 other location - About 3 hrs to fix
        routes/board.js on lines 21..27

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

        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

            get: function ( req, res ) {
                persistence.getBoard( req.params.id, req.session.passport.user.localId ).then( function ( board ) {
                    res.json( board );
                }, function ( error ) {
                    res.json( { error: error } );
        Severity: Major
        Found in routes/board.js and 1 other location - About 3 hrs to fix
        routes/widget.js on lines 27..33

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

        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 makeHourlyChart has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                self.makeHourlyChart = function ( d /* , i */ ) {
                    var hourlyData = params.sharedContext.dayObj[ d.x + 1 ],
                        hourlyCountArray = [ 'Hourly Count' ],
                        hourlyTotalArray = [ 'Hourly Total' ],
                        j;
        Severity: Major
        Found in src/components/widgets/totals-earned-chart/totals-earned-chart.js - About 3 hrs to fix

          Function NavBarViewModel has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function NavBarViewModel( params ) {
                  var self = this;
          
                  self.loggedIn = params.loggedIn;
                  self.welcome = params.welcome;
          Severity: Major
          Found in src/components/nav-bar/nav-bar.js - About 3 hrs to fix

            File common-filters.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * Use these to extend() your widget's filters.  Note that some filters are
             * defined for multiple tables.  Extend with the filter set of your primary
             * table last to make sure you get the correct version.
             */
            Severity: Minor
            Found in widgets/common-filters.js - About 3 hrs to fix

              File persistence.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              var config = require( './config.js' ),
                  promiseDbLib = require( 'mysql-promise' );
              
              function getConnection() {
                  var promiseDb = promiseDbLib();
              Severity: Minor
              Found in persistence.js - About 2 hrs to fix

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

                    function FiltersViewModel( params ) {
                        var self = this;
                
                        this.filters = ko.observableArray( [] );
                        this.setChoices = function () {
                Severity: Major
                Found in src/components/filters/filters.js - About 2 hrs to fix

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

                      boards: function ( req, res ) {
                          persistence.listBoards( req.session.passport.user.localId ).then( function ( boards ) {
                              res.json( boards );
                          }, function ( error ) {
                              res.json( { error: error } );
                  Severity: Major
                  Found in routes/user.js and 1 other location - About 2 hrs to fix
                  routes/user.js on lines 23..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 88.

                  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

                      widgetInstances: function ( req, res ) {
                          persistence.listWidgetInstances( req.session.passport.user.localId ).then( function ( instances ) {
                              res.json( instances );
                          }, function ( error ) {
                              res.json( { error: error } );
                  Severity: Major
                  Found in routes/user.js and 1 other location - About 2 hrs to fix
                  routes/user.js on lines 16..22

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

                  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 makeDailyChart has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          self.makeDailyChart = function ( /* d, i */ ) {
                              return {
                                  size: {
                                      height: 450,
                                      width: window.width
                  Severity: Major
                  Found in src/components/widgets/totals-earned-chart/totals-earned-chart.js - About 2 hrs to fix

                    Function loadData has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            self.loadData = function ( data, timestamp ) {
                                var runningTotal = 0,
                                    currentDate = new Date(),
                                    lastData,
                                    days = self.campaign().getLengthInDays(),
                    Severity: Major
                    Found in src/components/widgets/totals-earned-chart/totals-earned-chart.js - About 2 hrs to fix

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

                                  {
                                      name: 'leafy.green',
                                      donations: 147,
                                      impressions: '502,813',
                                      'don/K bi': 0.29,
                      Severity: Major
                      Found in src/components/widgets/ab-testing/ab-testing.js and 2 other locations - About 2 hrs to fix
                      src/components/widgets/ab-testing/ab-testing.js on lines 35..52
                      src/components/widgets/ab-testing/ab-testing.js on lines 53..70

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

                      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

                                  {
                                      name: 'Absolute change:',
                                      donations: 4,
                                      impressions: '-436',
                                      'don/K bi': 0.01,
                      Severity: Major
                      Found in src/components/widgets/ab-testing/ab-testing.js and 2 other locations - About 2 hrs to fix
                      src/components/widgets/ab-testing/ab-testing.js on lines 17..34
                      src/components/widgets/ab-testing/ab-testing.js on lines 35..52

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

                      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

                                  {
                                      name: 'green',
                                      donations: 143,
                                      impressions: '503,249',
                                      'don/K bi': 0.28,
                      Severity: Major
                      Found in src/components/widgets/ab-testing/ab-testing.js and 2 other locations - About 2 hrs to fix
                      src/components/widgets/ab-testing/ab-testing.js on lines 17..34
                      src/components/widgets/ab-testing/ab-testing.js on lines 53..70

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

                      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 DistanceToGoalChartViewModel has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function DistanceToGoalChartViewModel( params ) {
                      
                              var self = this;
                              WidgetBase.call( this, params );
                              self.hasData = ko.observable( false );
                        Severity
                        Category
                        Status
                        Source
                        Language