wikimedia/wikimedia-fundraising-dash

View on GitHub

Showing 47 of 93 total issues

Function NumberFilterViewModel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function NumberFilterViewModel( params ) {
        var self = this;

        this.operators = [
            ops.eq,
Severity: Minor
Found in src/components/filters/number-filter/number-filter.js - About 1 hr to fix

    Function addBoard has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            self.addBoard = function () {
                var board, name = self.newBoardName();
                self.boardError( '' );
                if ( name === '' ) {
                    self.boardError( 'Enter new board name' );
    Severity: Minor
    Found in src/components/nav-bar/nav-bar.js - About 1 hr to fix

      Function reloadData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              self.reloadData = function ( automatic ) {
                  // FIXME: use some common filter logic
                  var qs = '$filter=' + self.campaign().getDateFilter() + ' and ' +
                          'Amount lt \'' + self.majorDonationCutoff() + '\'',
                      interval = 500000,
      Severity: Minor
      Found in src/components/widgets/totals-earned-chart/totals-earned-chart.js - About 1 hr to fix

        Function addJoin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function addJoin( table, widget, joins ) {
            var i;
            if ( table !== widget.mainTableAlias && joins.indexOf( table ) === -1 ) {
                if ( widget.optionalJoins[ table ].requires ) {
                    for ( i = 0; i < widget.optionalJoins[ table ].requires.length; i++ ) {
        Severity: Minor
        Found in routes/data.js - About 35 mins 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 saveBoard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            saveBoard: function ( board ) {
                var connection = getConnection(),
                    insert = 'INSERT INTO dash_board ( owner_id, display_name, description, is_shared ) VALUES ( ?, ?, ?, ? )',
                    addWidget = 'INSERT INTO dash_widget_instance_board ( instance_id, board_id, widget_position ) SELECT ?, b.id, COALESCE( MAX( widget_position ), 0 ) + 1 FROM dash_board b LEFT JOIN dash_widget_instance_board i ON b.id = i.board_id WHERE b.id = ? AND b.owner_id = ?',
                    addWidgetParams = [ board.addWidget, board.id, board.ownerId ],
        Severity: Minor
        Found in persistence.js - About 35 mins 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

        Avoid too many return statements within this function.
        Open

            return '';
        Severity: Major
        Found in routes/data.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return 0;
          Severity: Major
          Found in src/components/filters/filters.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language