wikimedia/wikimedia-fundraising-dash

View on GitHub

Showing 47 of 93 total issues

Function TotalsEarnedChartViewModel has 354 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function TotalsEarnedChartViewModel( params ) {

        var self = this,
            timeFormat = 'dddd, MMMM Do YYYY, h:mm:ss a',
            localUtcOffset = moment().utcOffset();
Severity: Major
Found in src/components/widgets/totals-earned-chart/totals-earned-chart.js - About 1 day to fix

    Function WidgetBase has 305 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function WidgetBase( params ) {
    
            var self = this,
                MAX_RETRIES = 3;
    
    
    Severity: Major
    Found in src/app/widgetBase.js - About 1 day to fix

      Function FraudGaugeViewModel has 187 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function FraudGaugeViewModel( params ) {
      
              WidgetBase.call( this, params );
      
              var self = this,
      Severity: Major
      Found in src/components/widgets/fraud-gauge/fraud-gauge.js - About 7 hrs to fix

        Function XByYChartViewModel has 180 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function XByYChartViewModel( params ) {
        
                WidgetBase.call( this, params );
                var self = this,
                    wasSaved = self.chartSaved(); // populateChoices() may overwrite
        Severity: Major
        Found in src/components/widgets/x-by-y/x-by-y.js - About 7 hrs to fix

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

          module.exports = function ( req, res ) {
              var widget = widgets[ req.params.widget ],
                  qs = urlParser.parse( req.url ).query,
                  parsedQs = querystringParser.parse( qs ),
                  substitutedQuery,
          Severity: Minor
          Found in routes/data.js - About 5 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

          File totals-earned-chart.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          define( [
              'knockout',
              'text!components/widgets/totals-earned-chart/totals-earned-chart.html',
              'c3',
              'numeraljs',
          Severity: Minor
          Found in src/components/widgets/totals-earned-chart/totals-earned-chart.js - About 5 hrs to fix

            Function buildWhere has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

            function buildWhere( filterNode, widget, values, joins ) {
                var col, colText, op, rightClause, leftClause, val, i, pattern, partial, ops = {
                        and: 'AND',
                        or: 'OR',
                        eq: '=',
            Severity: Minor
            Found in routes/data.js - About 4 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 processData has 117 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    self.processData = function ( rawdata, timescale, grouping, timestamp ) {
            
                        var timeWord = ( timescale === 'Day' ? 'Dai' : timescale ) + 'ly',
                            totals,
                            counts,
            Severity: Major
            Found in src/app/widgetBase.js - About 4 hrs to fix

              Function ABTestingViewModel has 117 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var ABTestingViewModel = function ( params ) {
              
                      var self = this;
                      self.title = 'A/B Test Results';
              
              
              Severity: Major
              Found in src/components/widgets/ab-testing/ab-testing.js - About 4 hrs to fix

                Function AppContent has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function AppContent() {
                        var self = this,
                            pages = [ 'Library', 'Profile', 'Home' ];
                
                        hasher.prependHash = '';
                Severity: Major
                Found in src/components/app-content/app-content.js - About 4 hrs to fix

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

                  module.exports = function ( req, res ) {
                      var widget = widgets[ req.params.widget ],
                          qs = urlParser.parse( req.url ).query,
                          parsedQs = querystringParser.parse( qs ),
                          substitutedQuery,
                  Severity: Major
                  Found in routes/data.js - About 4 hrs to fix

                    Function AmtPerSecondChartViewModel has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function AmtPerSecondChartViewModel( params ) {
                    
                            var self = this;
                            WidgetBase.call( this, params );
                            self.hasData = ko.observable( false );
                    Severity: Major
                    Found in src/components/widgets/amt-per-second-chart/amt-per-second-chart.js - About 3 hrs to fix

                      File widgetBase.js has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      define( [
                          'jquery',
                          'knockout',
                          'operators'
                      ], function ( $, ko, ops ) {
                      Severity: Minor
                      Found in src/app/widgetBase.js - About 3 hrs to fix

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

                        function buildWhere( filterNode, widget, values, joins ) {
                            var col, colText, op, rightClause, leftClause, val, i, pattern, partial, ops = {
                                    and: 'AND',
                                    or: 'OR',
                                    eq: '=',
                        Severity: Major
                        Found in routes/data.js - About 3 hrs to fix

                          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

                                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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language