rsercano/mongoclient

View on GitHub

Showing 331 of 698 total issues

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

const Communicator = function () {
  this.methods = {
    count: { selectedCollection: '', selector: {}, options: {} },
    find: { selectedCollection: '', selector: {}, cursorOptions: {}, executeExplain: false },
    dropAllCollections: { },
Severity: Major
Found in client/imports/facades/communicator/index.js - About 3 hrs to fix

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

            function findNearbyItem(mouseX, mouseY, seriesFilter) {
                var maxDistance = options.grid.mouseActiveRadius,
                    smallestDistance = maxDistance * maxDistance + 1,
                    item = null, foundPoint = false, i, j, ps;
    
    
    Severity: Major
    Found in client/plugins/flot/jquery.flot.js - About 2 hrs to fix

      Function respond has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        respond() {
          const txt = $('#inputQueryWizardResponse');
          const txtDiv = $('#divQueryWizardTxt');
          const cmbDiv = $('#divQueryWizardCombo');
          const cmb = $('#cmbQueryWizardResponses');
      Severity: Major
      Found in client/imports/ui/querying/wizard.js - About 2 hrs to fix

        Function getErrorMessage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          getErrorMessage(err, result, translateOptions) {
            let errorMessage = Helper.translate({ key: 'unknown-error' });
            if (err) {
              if (err.details && err.details.message) {
                // external error comes with directly throwing (err.error = code)
        Severity: Minor
        Found in client/imports/modules/error_handler/index.js - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

          populateFieldsTable(data) {
            this.ensureFieldsDataForDatatable(data);
            UIComponents.DataTable.setupDatatable({
              selectorString: '#tblFieldsDetails',
              data,
        Severity: Major
        Found in client/imports/ui/schema_analyzer/index.js - About 2 hrs to fix

          prototype has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          QueryRender.prototype = {
            executeQuery() {
              const queryTemplate = SessionManager.get(SessionManager.strSessionSelectedQuery);
              // Since user can call here by CTRL-ENTER combination, it's a must to check URL.
              if (FlowRouter.current().route.path === '/browseCollection' || FlowRouter.current().route.path === '/adminQueries') {
          Severity: Minor
          Found in client/imports/ui/querying/render.js - About 2 hrs to fix

            prototype has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            ConnectionHelper.prototype = {
              isCredentialPromptNeeded(connection) {
                return connection.authenticationType && connection.authenticationType !== 'mongodb_x509'
                  && (!connection[connection.authenticationType].username || !connection[connection.authenticationType].password);
              },
            Severity: Minor
            Found in client/imports/ui/connection/helper.js - About 2 hrs to fix

              Function ensureFieldsDataForDatatable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                ensureFieldsDataForDatatable(data) {
                  for (let i = 0; i < data.length; i += 1) {
                    if (!data[i].value.types.String) data[i].value.types.String = '';
                    if (!data[i].value.types.Number) data[i].value.types.Number = '';
                    if (!data[i].value.types.Array) data[i].value.types.Array = '';
              Severity: Minor
              Found in client/imports/ui/schema_analyzer/index.js - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                          function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {
                              var points = datapoints.points,
                                  ps = datapoints.pointsize,
                                  prevx = null, prevy = null;
              
              
              Severity: Major
              Found in client/plugins/flot/jquery.flot.js - About 2 hrs to fix

                File users.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Communicator, ReactivityProvider } from '/client/imports/facades';
                import { Notification, ErrorHandler, SessionManager, UIComponents, ExtendedJSON } from '/client/imports/modules';
                import Helper from '/client/imports/helpers/helper';
                import UsermanagementHelper from './helper';
                import $ from 'jquery';
                Severity: Minor
                Found in client/imports/ui/user_management/users.js - About 2 hrs to fix

                  Function allocateAxisBoxFirstPhase has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function allocateAxisBoxFirstPhase(axis) {
                              // find the bounding box of the axis by looking at label
                              // widths/heights and ticks, make room by diminishing the
                              // plotOffset; this first phase only looks at one
                              // dimension per axis, the other dimension depends on the
                  Severity: Major
                  Found in client/plugins/flot/jquery.flot.js - About 2 hrs to fix

                    Function winnow_results has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        AbstractChosen.prototype.winnow_results = function() {
                          var eregex, escapedSearchText, exact_result, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
                          this.no_results_clear();
                          results = 0;
                          exact_result = false;
                    Severity: Major
                    Found in client/plugins/chosen_fork/chosen.proto.js - About 2 hrs to fix

                      Function winnow_results has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          AbstractChosen.prototype.winnow_results = function() {
                            var eregex, escapedSearchText, exact_result, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
                            this.no_results_clear();
                            results = 0;
                            exact_result = false;
                      Severity: Major
                      Found in client/plugins/chosen_fork/chosen.jquery.js - About 2 hrs to fix

                        Function gatherCommandAutoCompletions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          gatherCommandAutoCompletions(editorValue, curWord) {
                            if (curWord) return this.lastRegex;
                            let matched = editorValue.match(/[^\s"']+|"([^"]*)"|'([^']*)'/gm);
                            matched = matched ? matched.join('') : '';
                            editorValue = !editorValue ? editorValue : matched;
                        Severity: Major
                        Found in client/imports/ui/shell/index.js - About 2 hrs to fix

                          Function fetchStatus has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                            fetchStatus() {
                              if (SessionManager.get(SessionManager.strSessionCollectionNames)) {
                                const settings = ReactivityProvider.findOne(ReactivityProvider.types.Settings);
                                if (settings) {
                                  Communicator.call({
                          Severity: Minor
                          Found in client/imports/ui/db_stats/index.js - About 2 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

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

                              function formatDate(d, fmt, monthNames, dayNames) {
                          
                                  if (typeof d.strftime == "function") {
                                      return d.strftime(fmt);
                                  }
                          Severity: Major
                          Found in client/plugins/flot/jquery.flot.time.js - About 2 hrs to fix

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

                                    function combine(data) {
                            
                                        var total = 0,
                                            combined = 0,
                                            numCombined = 0,
                            Severity: Major
                            Found in client/plugins/flot/jquery.flot.pie.js - About 2 hrs to fix

                              File add.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { SessionManager, UIComponents, Enums, ExtendedJSON, ErrorHandler, Notification } from '/client/imports/modules';
                              import { Communicator, ReactivityProvider } from '/client/imports/facades';
                              import { Connection } from '/client/imports/ui';
                              import $ from 'jquery';
                              
                              
                              Severity: Minor
                              Found in client/imports/ui/collection/add.js - About 2 hrs to fix

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

                                const setEventsToShell = function (connectionId, sessionId) {
                                  Logger.info({ message: 'shell-event-bind', metadataToLog: { connectionId, sessionId } });
                                
                                  this.spawnedShellsBySessionId[sessionId].on('error', Meteor.bindEnvironment((error) => {
                                    Logger.error({ message: 'shell-event-bind', metadataToLog: { error, sessionId } });
                                Severity: Major
                                Found in server/imports/core/mongodb/shell.js - About 2 hrs to fix

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

                                    populateConnectionsTable() {
                                      UIComponents.DataTable.setupDatatable({
                                        selectorString: '#tblConnection',
                                        extraOptions: {
                                          createdRow(row, data) {
                                  Severity: Major
                                  Found in client/imports/ui/connection/index.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language