monsij/StudentPortal

View on GitHub
pro1/staticfiles/blog/bootstrap/js/addons/datatables.js

Summary

Maintainability
F
1 yr
Test Coverage

File datatables.js has 6488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * MDBootstrap integration with Datatables
 * Learn more: https://mdbootstrap.com/content/bootstrap-datatables/
 * About MDBootstrap: https://mdbootstrap.com/
 *
Severity: Major
Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 wks to fix

    Function DataTable has 495 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var DataTable = function ( options )
        {
            /**
             * Perform a jQuery selector action on the table's TR elements (from the tbody) and
             * return the resulting jQuery object.
    Severity: Major
    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 days to fix

      Function _fnScrollDraw has 169 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _fnScrollDraw ( settings )
          {
              // Given that this is such a monster function, a lot of variables are use
              // to try and keep the minimised size as small as possible
              var
      Severity: Major
      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 6 hrs to fix

        Function _fnCalculateColumnWidths has 136 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function _fnCalculateColumnWidths ( oSettings )
            {
                var
                    table = oSettings.nTable,
                    columns = oSettings.aoColumns,
        Severity: Major
        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 5 hrs to fix

          Function _fnAddOptionsHtml has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _fnAddOptionsHtml ( oSettings )
              {
                  var classes = oSettings.oClasses;
                  var table = $(oSettings.nTable);
                  var holding = $('<div/>').insertBefore( table ); // Holding element for speed
          Severity: Major
          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 4 hrs to fix

            Function _fnFeatureHtmlTable has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function _fnFeatureHtmlTable ( settings )
                {
                    var table = $(settings.nTable);
                
                    // Add the ARIA grid role to the table
            Severity: Major
            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 4 hrs to fix

              Function _fnDraw has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function _fnDraw( oSettings )
                  {
                      /* Provide a pre-callback function which can be used to cancel the draw is false is returned */
                      var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
                      if ( $.inArray( false, aPreDraw ) !== -1 )
              Severity: Major
              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                Function _fnBuildAjax has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function _fnBuildAjax( oSettings, data, fn )
                    {
                        // Compatibility with 1.9-, allow fnServerData and event to manipulate
                        _fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] );
                    
                Severity: Major
                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                  Function bootstrap has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
                      var api     = new DataTable.Api( settings );
                      var classes = settings.oClasses;
                      var lang    = settings.oLanguage.oPaginate;
                      var aria = settings.oLanguage.oAria.paginate || {};
                  Severity: Major
                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                    Function _fnColumnOptions has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function _fnColumnOptions( oSettings, iCol, oOptions )
                        {
                            var oCol = oSettings.aoColumns[ iCol ];
                            var oClasses = oSettings.oClasses;
                            var th = $(oCol.nTh);
                    Severity: Major
                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                      Function _fnGetObjectDataFn has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function _fnGetObjectDataFn( mSource )
                          {
                              if ( $.isPlainObject( mSource ) )
                              {
                                  /* Build an object of get functions, and wrap them in a single call */
                      Severity: Major
                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                        Function _ has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    _: function ( settings, host, idx, buttons, page, pages ) {
                                        var classes = settings.oClasses;
                                        var lang = settings.oLanguage.oPaginate;
                                        var aria = settings.oLanguage.oAria.paginate || {};
                                        var btnDisplay, btnClass, counter=0;
                        Severity: Major
                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                          Function _fnSetObjectDataFn has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function _fnSetObjectDataFn( mSource )
                              {
                                  if ( $.isPlainObject( mSource ) )
                                  {
                                      /* Unlike get, only the underscore (global) option is used for for
                          Severity: Major
                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 3 hrs to fix

                            Function _fnGetRowElements has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function _fnGetRowElements( settings, row, colIdx, d )
                                {
                                    var
                                        tds = [],
                                        td = row.firstChild,
                            Severity: Major
                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                              Function _fnAjaxParameters has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function _fnAjaxParameters( settings )
                                  {
                                      var
                                          columns = settings.aoColumns,
                                          columnCount = columns.length,
                              Severity: Major
                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                Function _fnSort has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function _fnSort ( oSettings )
                                    {
                                        var
                                            i, ien, iLen, j, jLen, k, kLen,
                                            sDataType, nTh,
                                Severity: Major
                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                  Function attach has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      var attach = function( container, buttons ) {
                                          var i, ien, node, button;
                                          var clickHandler = function ( e ) {
                                              e.preventDefault();
                                              if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
                                  Severity: Major
                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                    Function __column_selector has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        var __column_selector = function ( settings, selector, opts )
                                        {
                                            var
                                                columns = settings.aoColumns,
                                                names = _pluck( columns, 'sName' ),
                                    Severity: Major
                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                      Function _fnDrawHead has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          function _fnDrawHead( oSettings, aoSource, bIncludeHidden )
                                          {
                                              var i, iLen, j, jLen, k, kLen, n, nLocalTr;
                                              var aoLocal = [];
                                              var aApplied = [];
                                      Severity: Major
                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                        Function attach has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                        var attach = function( container, buttons ) {
                                                            var i, ien, node, button;
                                                            var clickHandler = function ( e ) {
                                                                _fnPageChange( settings, e.data.action, true );
                                                            };
                                        Severity: Major
                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                          Function _fnLoadState has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              function _fnLoadState ( settings, oInit, callback )
                                              {
                                                  var i, ien;
                                                  var columns = settings.aoColumns;
                                                  var loaded = function ( s ) {
                                          Severity: Major
                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                            Function loadedInit has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                        var loadedInit = function () {
                                                            /*
                                                             * Sorting
                                                             * @todo For modularisation (1.11) this needs to do into a sort start up handler
                                                             */
                                            Severity: Major
                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                              Function _fnFeatureHtmlFilter has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  function _fnFeatureHtmlFilter ( settings )
                                                  {
                                                      var classes = settings.oClasses;
                                                      var tableId = settings.sTableId;
                                                      var language = settings.oLanguage;
                                              Severity: Major
                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                Function __row_selector has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    var __row_selector = function ( settings, selector, opts )
                                                    {
                                                        var rows;
                                                        var run = function ( sel ) {
                                                            var selInt = _intVal( sel );
                                                Severity: Major
                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                  Function run has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                          var run = function ( s ) {
                                                              var selInt = _intVal( s );
                                                      
                                                              // Selector - all
                                                              if ( s === '' ) {
                                                  Severity: Major
                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                    Function __cell_selector has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        var __cell_selector = function ( settings, selector, opts )
                                                        {
                                                            var data = settings.aoData;
                                                            var rows = _selector_row_indexes( settings, opts );
                                                            var cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) );
                                                    Severity: Major
                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                      Function run has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                              var run = function ( sel ) {
                                                                  var selInt = _intVal( sel );
                                                                  var i, ien;
                                                                  var aoData = settings.aoData;
                                                          
                                                      Severity: Major
                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                        Function _fnPageChange has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            function _fnPageChange ( settings, action, redraw )
                                                            {
                                                                var
                                                                    start     = settings._iDisplayStart,
                                                                    len       = settings._iDisplayLength,
                                                        Severity: Major
                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                          Function iterator has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                  iterator: function ( flatten, type, fn, alwaysNew ) {
                                                                      var
                                                                          a = [], ret,
                                                                          i, ien, j, jen,
                                                                          context = this.context,
                                                          Severity: Major
                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

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

                                                                function _fnSortListener ( settings, colIdx, append, callback )
                                                                {
                                                                    var col = settings.aoColumns[ colIdx ];
                                                                    var sorting = settings.aaSorting;
                                                                    var asSorting = col.asSorting;
                                                            Severity: Major
                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

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

                                                                  var _selector_row_indexes = function ( settings, opts )
                                                                  {
                                                                      var
                                                                          i, ien, tmp, a=[],
                                                                          displayFiltered = settings.aiDisplay,
                                                              Severity: Major
                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                                Function loaded has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                        var loaded = function ( s ) {
                                                                            if ( ! s || ! s.time ) {
                                                                                callback();
                                                                                return;
                                                                            }
                                                                Severity: Major
                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 2 hrs to fix

                                                                  Function _fnApplyColumnDefs has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                      function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )
                                                                      {
                                                                          var i, iLen, j, jLen, k, kLen, def;
                                                                          var columns = oSettings.aoColumns;
                                                                      
                                                                  Severity: Minor
                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                    Function _fnSortFlatten has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                        function _fnSortFlatten ( settings )
                                                                        {
                                                                            var
                                                                                i, iLen, k, kLen,
                                                                                aSort = [],
                                                                    Severity: Minor
                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                      Function _fnCreateTr has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                          function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
                                                                          {
                                                                              var
                                                                                  row = oSettings.aoData[iRow],
                                                                                  rowData = row._aData,
                                                                      Severity: Minor
                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                        Function setData has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                                    var setData = function (data, val, src) {
                                                                                        var a = _fnSplitObjNotation( src ), b;
                                                                                        var aLast = a[a.length-1];
                                                                                        var arrayNotation, funcNotation, o, innerSrc;
                                                                            
                                                                        Severity: Minor
                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                          Function _fnBuildHead has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                          Open

                                                                              function _fnBuildHead( oSettings )
                                                                              {
                                                                                  var i, ien, cell, row, column;
                                                                                  var thead = oSettings.nTHead;
                                                                                  var tfoot = oSettings.nTFoot;
                                                                          Severity: Minor
                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                            Function run has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                            Open

                                                                                    var run = function ( s ) {
                                                                                        var fnSelector = typeof s === 'function';
                                                                                
                                                                                        if ( s === null || s === undefined || fnSelector ) {
                                                                                            // All cells and function selectors
                                                                            Severity: Minor
                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                              Function _fnDetectHeader has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                              Open

                                                                                  function _fnDetectHeader ( aLayout, nThead )
                                                                                  {
                                                                                      var nTrs = $(nThead).children('tr');
                                                                                      var nTr, nCell;
                                                                                      var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;
                                                                              Severity: Minor
                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                Function _fnFilterData has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                Open

                                                                                    function _fnFilterData ( settings )
                                                                                    {
                                                                                        var columns = settings.aoColumns;
                                                                                        var column;
                                                                                        var i, j, ien, jen, filterData, cellData, row;
                                                                                Severity: Minor
                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                  Function _fnInitialise has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                  Open

                                                                                      function _fnInitialise ( settings )
                                                                                      {
                                                                                          var i, iLen, iAjaxStart=settings.iInitDisplayStart;
                                                                                          var columns = settings.aoColumns, column;
                                                                                          var features = settings.oFeatures;
                                                                                  Severity: Minor
                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                    Function __details_events has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                    Open

                                                                                        var __details_events = function ( settings )
                                                                                        {
                                                                                            var api = new _Api( settings );
                                                                                            var namespace = '.dt.DT_details';
                                                                                            var drawEvent = 'draw'+namespace;
                                                                                    Severity: Minor
                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                      Function _fnFeatureHtmlPaginate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                      Open

                                                                                          function _fnFeatureHtmlPaginate ( settings )
                                                                                          {
                                                                                              var
                                                                                                  type   = settings.sPaginationType,
                                                                                                  plugin = DataTable.ext.pager[ type ],
                                                                                      Severity: Minor
                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                        Function fetchData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                        Open

                                                                                                    var fetchData = function (data, type, src) {
                                                                                                        var arrayNotation, funcNotation, out, innerSrc;
                                                                                            
                                                                                                        if ( src !== "" )
                                                                                                        {
                                                                                        Severity: Minor
                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                          Function _fnBrowserDetect has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                          Open

                                                                                              function _fnBrowserDetect( settings )
                                                                                              {
                                                                                                  // We don't need to do this every time DataTables is constructed, the values
                                                                                                  // calculated are specific to the browser and OS configuration which we
                                                                                                  // don't expect to change between initialisations
                                                                                          Severity: Minor
                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                            Function _fnFeatureHtmlLength has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                            Open

                                                                                                function _fnFeatureHtmlLength ( settings )
                                                                                                {
                                                                                                    var
                                                                                                        classes  = settings.oClasses,
                                                                                                        tableId  = settings.sTableId,
                                                                                            Severity: Minor
                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                              Function _fnInvalidate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  function _fnInvalidate( settings, rowIdx, src, colIdx )
                                                                                                  {
                                                                                                      var row = settings.aoData[ rowIdx ];
                                                                                                      var i, ien;
                                                                                                      var cellWrite = function ( cell, col ) {
                                                                                              Severity: Minor
                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                Function _fnColumnTypes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                Open

                                                                                                    function _fnColumnTypes ( settings )
                                                                                                    {
                                                                                                        var columns = settings.aoColumns;
                                                                                                        var data = settings.aoData;
                                                                                                        var types = DataTable.ext.type.detect;
                                                                                                Severity: Minor
                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                  Function jqueryui has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                              jqueryui: function ( settings, cell, column, classes ) {
                                                                                                                  $('<div/>')
                                                                                                                      .addClass( classes.sSortJUIWrapper )
                                                                                                                      .append( cell.contents() )
                                                                                                                      .append( $('<span/>')
                                                                                                  Severity: Minor
                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                    Consider simplifying this complex logical expression.
                                                                                                    Open

                                                                                                            if ( ie67 || ! userInputs && ! scrollX && ! scrollY &&
                                                                                                                 columnCount == _fnVisbleColumns( oSettings ) &&
                                                                                                                 columnCount == headerCells.length
                                                                                                            ) {
                                                                                                                for ( i=0 ; i<columnCount ; i++ ) {
                                                                                                    Severity: Critical
                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                      Function __setColumnVis has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                          var __setColumnVis = function ( settings, column, vis ) {
                                                                                                              var
                                                                                                                  cols = settings.aoColumns,
                                                                                                                  col  = cols[ column ],
                                                                                                                  data = settings.aoData,
                                                                                                      Severity: Minor
                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                        Function _fnSortAria has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            function _fnSortAria ( settings )
                                                                                                            {
                                                                                                                var label;
                                                                                                                var nextSort;
                                                                                                                var columns = settings.aoColumns;
                                                                                                        Severity: Minor
                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                          Function _toSettings has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                              var _toSettings = function ( mixed )
                                                                                                              {
                                                                                                                  var idx, jq;
                                                                                                                  var settings = DataTable.settings;
                                                                                                                  var tables = $.map( settings, function (el, i) {
                                                                                                          Severity: Minor
                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

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

                                                                                                                function _fnFilter( settings, input, force, regex, smart, caseInsensitive )
                                                                                                                {
                                                                                                                    var rpSearch = _fnFilterCreateSearch( input, regex, smart, caseInsensitive );
                                                                                                                    var prevSearch = settings.oPreviousSearch.sSearch;
                                                                                                                    var displayMaster = settings.aiDisplayMaster;
                                                                                                            Severity: Minor
                                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

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

                                                                                                                  function _fnFilterComplete ( oSettings, oInput, iForce )
                                                                                                                  {
                                                                                                                      var oPrevSearch = oSettings.oPreviousSearch;
                                                                                                                      var aoPrevSearch = oSettings.aoPreSearchCols;
                                                                                                                      var fnSaveFilter = function ( oFilter ) {
                                                                                                              Severity: Minor
                                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                                Function __details_add has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                                Open

                                                                                                                    var __details_add = function ( ctx, row, data, klass )
                                                                                                                    {
                                                                                                                        // Convert to array of TR elements
                                                                                                                        var rows = [];
                                                                                                                        var addRow = function ( r, k ) {
                                                                                                                Severity: Minor
                                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                                  Function _fnGetCellData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                                  Open

                                                                                                                      function _fnGetCellData( settings, rowIdx, colIdx, type )
                                                                                                                      {
                                                                                                                          var draw           = settings.iDraw;
                                                                                                                          var col            = settings.aoColumns[colIdx];
                                                                                                                          var rowData        = settings.aoData[rowIdx]._aData;
                                                                                                                  Severity: Minor
                                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

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

                                                                                                                        function _fnAjaxUpdateDraw ( settings, json )
                                                                                                                        {
                                                                                                                            // v1.10 uses camelCase variables, while 1.9 uses Hungarian notation.
                                                                                                                            // Support both
                                                                                                                            var compat = function ( old, modern ) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

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

                                                                                                                          function _numbers ( page, pages ) {
                                                                                                                              var
                                                                                                                                  numbers = [],
                                                                                                                                  buttons = extPagination.numbers_length,
                                                                                                                                  half = Math.floor( buttons / 2 ),
                                                                                                                      Severity: Minor
                                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 1 hr to fix

                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                        Open

                                                                                                                                                if ( cache[k] === undefined ) {
                                                                                                                                                    cache[k] = _fnGetCellData( settings, k, i, 'type' );
                                                                                                                                                }
                                                                                                                        Severity: Major
                                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                          Open

                                                                                                                                                  if ( ! detectedType && j !== types.length-1 ) {
                                                                                                                                                      break;
                                                                                                                                                  }
                                                                                                                          Severity: Major
                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                            Open

                                                                                                                                                        if ( s( o, _fnGetCellData(settings, row, j), host.anCells ? host.anCells[j] : null ) ) {
                                                                                                                                                            a.push( o );
                                                                                                                                                        }
                                                                                                                            Severity: Major
                                                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                              Open

                                                                                                                                                          for ( var j=0, jLen=val.length ; j<jLen ; j++ )
                                                                                                                                                          {
                                                                                                                                                              o = {};
                                                                                                                                                              setData( o, val[j], innerSrc );
                                                                                                                                                              data[ a[i] ].push( o );
                                                                                                                              Severity: Major
                                                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                Open

                                                                                                                                                        if ( typeof cellData !== 'string' && cellData.toString ) {
                                                                                                                                                            cellData = cellData.toString();
                                                                                                                                                        }
                                                                                                                                Severity: Major
                                                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                  Open

                                                                                                                                                      if ( cOption == aoFeatures[k].cFeature )
                                                                                                                                                      {
                                                                                                                                                          featureNode = aoFeatures[k].fnInit( oSettings );
                                                                                                                                                          break;
                                                                                                                                                      }
                                                                                                                                  Severity: Major
                                                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                    Function _fnFilter has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        function _fnFilter( settings, input, force, regex, smart, caseInsensitive )
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                      Open

                                                                                                                                                          else if ( typeof aTargets[j] === 'number' && aTargets[j] < 0 )
                                                                                                                                                          {
                                                                                                                                                              /* Negative integer, right to left column counting */
                                                                                                                                                              fn( columns.length+aTargets[j], def );
                                                                                                                                                          }
                                                                                                                                      Severity: Major
                                                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                        Open

                                                                                                                                                                if ( detectedType === 'html' ) {
                                                                                                                                                                    break;
                                                                                                                                                                }
                                                                                                                                        Severity: Major
                                                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                          Open

                                                                                                                                                              for ( j=0, jen=items.length ; j<jen ; j++ ) {
                                                                                                                                                                  item = items[j];
                                                                                                                                              
                                                                                                                                                                  if ( type === 'cell' ) {
                                                                                                                                                                      ret = fn.call( apiInst, context[i], item.row, item.column, i, j );
                                                                                                                                          Severity: Major
                                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                            Open

                                                                                                                                                                    if ( fomatters[ column.sType ] ) {
                                                                                                                                                                        cellData = fomatters[ column.sType ]( cellData );
                                                                                                                                                                    }
                                                                                                                                            Severity: Major
                                                                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                                              Open

                                                                                                                                                                      if ( cellData === null ) {
                                                                                                                                                                          cellData = '';
                                                                                                                                                                      }
                                                                                                                                              Severity: Major
                                                                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                Function _fnFilterColumn has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                    function _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive )
                                                                                                                                                Severity: Minor
                                                                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                  Function fnFilter has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                  Open

                                                                                                                                                          this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive )
                                                                                                                                                  Severity: Minor
                                                                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                                    Open

                                                                                                                                                                            for ( k=0 ; k<iRowspan ; k++ )
                                                                                                                                                                            {
                                                                                                                                                                                aApplied[i+k][j+iColspan] = 1;
                                                                                                                                                                            }
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                                      Open

                                                                                                                                                                              for ( k=0 ; k<iRowspan ; k++ )
                                                                                                                                                                              {
                                                                                                                                                                                  aLayout[i+k][iColShifted+l] = {
                                                                                                                                                                                      "cell": nCell,
                                                                                                                                                                                      "unique": bUnique
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                                        Open

                                                                                                                                                                            if ( type === 'column-rows' ) {
                                                                                                                                                                                rows = _selector_row_indexes( context[i], selector.opts );
                                                                                                                                                                            }
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                                          Open

                                                                                                                                                                                  while( columns.length <= aTargets[j] )
                                                                                                                                                                                  {
                                                                                                                                                                                      _fnAddColumn( oSettings );
                                                                                                                                                                                  }
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                                            Open

                                                                                                                                                                                    if ( arrayNotation )
                                                                                                                                                                                    {
                                                                                                                                                                                        // Array notation
                                                                                                                                                                                        a[i] = a[i].replace(__reArray, '');
                                                                                                                                                                
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                                                              Open

                                                                                                                                                                                      if ( data === null || data[ a[i] ] === undefined )
                                                                                                                                                                                      {
                                                                                                                                                                                          return undefined;
                                                                                                                                                                                      }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                                Function _ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                Open

                                                                                                                                                                            _: function ( settings, host, idx, buttons, page, pages ) {
                                                                                                                                                                Severity: Minor
                                                                                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                                                  Open

                                                                                                                                                                                  if ( search == 'none' ) {
                                                                                                                                                                                      a.push( i );
                                                                                                                                                                                  }
                                                                                                                                                                                  else { // applied | removed
                                                                                                                                                                                      tmp = $.inArray( i, displayFiltered );
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                                    Function _fnReduce has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                    Open

                                                                                                                                                                        function _fnReduce ( that, fn, init, start, end, inc )
                                                                                                                                                                    Severity: Minor
                                                                                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                                      Function bootstrap has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                      DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 45 mins to fix

                                                                                                                                                                        Consider simplifying this complex logical expression.
                                                                                                                                                                        Open

                                                                                                                                                                                        if ( nCell.nodeName.toUpperCase() == "TD" ||
                                                                                                                                                                                             nCell.nodeName.toUpperCase() == "TH" )
                                                                                                                                                                                        {
                                                                                                                                                                                            /* Get the col and rowspan attributes from the DOM and sanitise them */
                                                                                                                                                                                            iColspan = nCell.getAttribute('colspan') * 1;
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 40 mins to fix

                                                                                                                                                                          Function fnUpdate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                          Open

                                                                                                                                                                                  this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
                                                                                                                                                                          Severity: Minor
                                                                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 35 mins to fix

                                                                                                                                                                            Function _selector_run has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                            Open

                                                                                                                                                                                var _selector_run = function ( type, selector, selectFn, settings, opts )
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 35 mins to fix

                                                                                                                                                                              Function number has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                              Open

                                                                                                                                                                                      number: function ( thousands, decimal, precision, prefix, postfix ) {
                                                                                                                                                                              Severity: Minor
                                                                                                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 35 mins to fix

                                                                                                                                                                                Function __columnData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                                                Open

                                                                                                                                                                                    var __columnData = function ( settings, column, r1, r2, rows ) {
                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 35 mins to fix

                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                  Open

                                                                                                                                                                                              return host.length ?
                                                                                                                                                                                                  [ host.data('dt-column') ] :
                                                                                                                                                                                                  [];
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                    Open

                                                                                                                                                                                                return function (data, type) { // row and meta also passed, but not used
                                                                                                                                                                                                    return data[mSource];
                                                                                                                                                                                                };
                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                      Open

                                                                                                                                                                                                  return function (data, val) { // meta is also passed in, but not used
                                                                                                                                                                                                      data[mSource] = val;
                                                                                                                                                                                                  };
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                        Open

                                                                                                                                                                                                            return aoData[ rowIdx ] && aoData[ rowIdx ].nTr === sel ?
                                                                                                                                                                                                                [ rowIdx ] :
                                                                                                                                                                                                                [];
                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                          Open

                                                                                                                                                                                                              return aoData[ cellIdx.row ] && aoData[ cellIdx.row ].nTr === sel ?
                                                                                                                                                                                                                  [ cellIdx.row ] :
                                                                                                                                                                                                                  [];
                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                            Open

                                                                                                                                                                                                                    return [ _fnVisibleToColumnIndex( settings, idx ) ];
                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                            Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                              Open

                                                                                                                                                                                                          return jq.map( function(i) {
                                                                                                                                                                                                              idx = $.inArray( this, tables );
                                                                                                                                                                                                              return idx !== -1 ? settings[idx] : null;
                                                                                                                                                                                                          } ).toArray();
                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                              Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                Open

                                                                                                                                                                                                                return [ s._DT_CellIndex.column ];
                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                  Open

                                                                                                                                                                                                                      return host.length ?
                                                                                                                                                                                                                          [ host.data('dt-row') ] :
                                                                                                                                                                                                                          [];
                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                                        return [ rowObj.idx ];
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                      Open

                                                                                                                                                                                                                      return jqResult;
                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                        Open

                                                                                                                                                                                                                    return $(nodes)
                                                                                                                                                                                                                        .filter( sel )
                                                                                                                                                                                                                        .map( function () {
                                                                                                                                                                                                                            return this._DT_RowIndex;
                                                                                                                                                                                                                        } )
                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js - About 30 mins to fix

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

                                                                                                                                                                                                          (function( factory ) {
                                                                                                                                                                                                              "use strict";
                                                                                                                                                                                                          
                                                                                                                                                                                                              if ( typeof define === 'function' && define.amd ) {
                                                                                                                                                                                                                  // AMD
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js and 1 other location - About 1 yr to fix
                                                                                                                                                                                                          pro1/staticfiles/bootstrap/js/addons/datatables.js on lines 43..15312

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

                                                                                                                                                                                                          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

                                                                                                                                                                                                          (function( factory ){
                                                                                                                                                                                                              if ( typeof define === 'function' && define.amd ) {
                                                                                                                                                                                                                  // AMD
                                                                                                                                                                                                                  define( ['jquery', 'datatables.net'], function ( $ ) {
                                                                                                                                                                                                                      return factory( $, window, document );
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/addons/datatables.js and 1 other location - About 6 days to fix
                                                                                                                                                                                                          pro1/staticfiles/bootstrap/js/addons/datatables.js on lines 15327..15498

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

                                                                                                                                                                                                          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

                                                                                                                                                                                                          There are no issues that match your filters.

                                                                                                                                                                                                          Category
                                                                                                                                                                                                          Status