wikimedia/wikimedia-fundraising-dash

View on GitHub

Showing 93 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

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

            require( 'fs' ).readdirSync( __dirname )
                .filter( function ( file ) {
                    return ( ( file.indexOf( '.' ) !== 0 ) && ( file !== 'index.js' ) && ( file.slice( -3 ) === '.js' ) );
                } )
                .forEach( function ( file ) {
            Severity: Major
            Found in widgets/index.js and 1 other location - About 4 hrs to fix
            routes/index.js on lines 4..10

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

            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

            require( 'fs' ).readdirSync( __dirname )
                .filter( function ( file ) {
                    return ( ( file.indexOf( '.' ) !== 0 ) && ( file !== 'index.js' ) && ( file.slice( -3 ) === '.js' ) );
                } )
                .forEach( function ( file ) {
            Severity: Major
            Found in routes/index.js and 1 other location - About 4 hrs to fix
            widgets/index.js on lines 4..10

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

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

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

                        addWidget: function ( req, res ) {
                            var board = {
                                ownerId: req.session.passport.user.localId,
                                id: req.params.id,
                                addWidget: req.body.instanceId
                    Severity: Major
                    Found in routes/board.js and 1 other location - About 4 hrs to fix
                    routes/board.js on lines 38..47

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

                    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

                        deleteWidget: function ( req, res ) {
                            var board = {
                                ownerId: req.session.passport.user.localId,
                                id: req.params.id,
                                deleteWidget: req.params.instanceId
                    Severity: Major
                    Found in routes/board.js and 1 other location - About 4 hrs to fix
                    routes/board.js on lines 28..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 117.

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

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

                                Currency: {
                                    table: 'pi',
                                    column: 'currency_code',
                                    display: 'Currency',
                                    type: 'dropdown',
                        Severity: Major
                        Found in widgets/common-filters.js and 1 other location - About 3 hrs to fix
                        widgets/common-filters.js on lines 264..272

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

                        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

                                Currency: {
                                    table: 'cx',
                                    column: 'original_currency',
                                    display: 'Currency',
                                    type: 'dropdown',
                        Severity: Major
                        Found in widgets/common-filters.js and 1 other location - About 3 hrs to fix
                        widgets/common-filters.js on lines 137..145

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

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