rsercano/mongoclient

View on GitHub

Showing 331 of 698 total issues

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

  populateTableData(indexInfo, stats, indexStats) {
    const result = [];
    indexInfo.result.forEach((obj) => {
      const index = {
        name: obj.name,
Severity: Minor
Found in client/imports/ui/index_management/index.js - About 1 hr to fix

    Function drawSeriesPoints has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function drawSeriesPoints(series) {
                function plotPoints(datapoints, radius, fillStyle, offset, shadow, axisx, axisy, symbol) {
                    var points = datapoints.points, ps = datapoints.pointsize;
    
                    for (var i = 0; i < points.length; i += ps) {
    Severity: Minor
    Found in client/plugins/flot/jquery.flot.js - About 1 hr to fix

      Function gatherOptions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        gatherOptions() {
          const options = this.getOptions();
          if (options.ERROR) {
            Notification.error(options.ERROR);
            return;
      Severity: Minor
      Found in client/imports/ui/collection/add.js - About 1 hr to fix

        Function migrateConnectionsIfExist has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          migrateConnectionsIfExist() {
            Logger.info({ message: 'migrate-connections' });
        
            const settings = Database.readOne({ type: Database.types.Settings, query: {} });
            if (settings.isMigrationDone) return;
        Severity: Minor
        Found in server/imports/core/connection/index.js - About 1 hr to fix

          Function addStageElement has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            addStageElement(query, val) {
              const cmb = $('#cmbStageQueries');
              query = query || cmb.val();
              if (query) {
                query = (query.indexOf('$') !== -1 ? query : `$${query}`);
          Severity: Minor
          Found in client/imports/ui/querying/aggregate.js - About 1 hr to fix

            Function initUsers has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              initUsers() {
                Notification.start('#btnCloseUMDB');
            
                const command = {
                  usersInfo: 1,
            Severity: Minor
            Found in client/imports/ui/user_management/users.js - About 1 hr to fix

              Function saveFindEditor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                saveFindEditor() {
                  const activeTab = $('#resultTabs').find('li.active').find('a').attr('href');
                  const findData = $(activeTab).data('findData');
                  if (!findData) {
                    Notification.error('no-result-found-to-save');
              Severity: Minor
              Found in client/imports/ui/querying/save_editor.js - About 1 hr 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 respond has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                respond() {
                  const txt = $('#inputQueryWizardResponse');
                  const txtDiv = $('#divQueryWizardTxt');
                  const cmbDiv = $('#divQueryWizardCombo');
                  const cmb = $('#cmbQueryWizardResponses');
              Severity: Minor
              Found in client/imports/ui/querying/wizard.js - About 1 hr 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 result_select has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Chosen.prototype.result_select = function(evt) {
                    var high, item;
                    if (this.result_highlight) {
                      high = this.result_highlight;
                      if (high.hasClass("create-option")) {
              Severity: Minor
              Found in client/plugins/chosen_fork/chosen.jquery.js - About 1 hr to fix

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

                  analyzeSchema({ connectionId, username, password, collection, sessionId }) {
                    const connection = Database.readOne({ type: Database.types.Connections, query: { _id: connectionId } });
                    const connectionUrl = Connection.getConnectionUrl(connection, username, password, true, true);
                    const args = [connectionUrl, '--quiet', '--eval', `var collection =\"${collection}\", outputFormat=\"json\"`, `${MongoDBHelper.getMongoExternalsPath()}/variety/variety.js_`];
                    const metadataToLog = { sessionId, args, collection };
                Severity: Minor
                Found in server/imports/core/mongodb/index.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                                  if (opts.mode == "time") {
                                      axis.tickGenerator = function(axis) {
                  
                                          var ticks = [];
                                          var d = dateGenerator(axis.min, opts);
                  Severity: Critical
                  Found in client/plugins/flot/jquery.flot.time.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                        if (isNaN(v) || v < axis.min || v > axis.max
                                            // skip those lying on the axes if we got a border
                                            || (t == "full"
                                                && ((typeof bw == "object" && bw[axis.position] > 0) || bw > 0)
                                                && (v == axis.min || v == axis.max)))
                    Severity: Critical
                    Found in client/plugins/flot/jquery.flot.js - About 1 hr to fix

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

                          Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) {
                      
                              var textStyle, layerCache, styleCache, info;
                      
                              // Cast the value to a string, in case we were given a number or such
                      Severity: Minor
                      Found in client/plugins/flot/jquery.flot.js - About 1 hr to fix

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

                                            axis.tickFormatter = function (v, axis) {
                        
                                                var d = dateGenerator(v, axis.options);
                        
                                                // first check global format
                        Severity: Minor
                        Found in client/plugins/flot/jquery.flot.time.js - About 1 hr to fix

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

                            extractIndexOptions() {
                              let partialFilterExpression = UIComponents.Editor.getCodeMirrorValue($('#divPartial'));
                              if (partialFilterExpression) {
                                partialFilterExpression = ExtendedJSON.convertAndCheckJSON(partialFilterExpression);
                                if (partialFilterExpression.ERROR) {
                          Severity: Minor
                          Found in client/imports/ui/index_management/index.js - About 1 hr to fix

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

                              saveUser() {
                                const usernameSelector = $('#inputUsernameUM');
                                const passwordSelector = $('#inputPasswordUM');
                                const titleSelector = $('#addEditUserModalTitle');
                            
                            
                            Severity: Minor
                            Found in client/imports/ui/user_management/users.js - About 1 hr to fix

                              Function fetchStatus has 40 lines of code (exceeds 25 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 1 hr to fix

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

                                    Chosen.prototype.result_select = function(evt) {
                                      var high, item;
                                      if (this.result_highlight) {
                                        high = this.result_highlight;
                                        if (high.hasClassName("create-option")) {
                                Severity: Minor
                                Found in client/plugins/chosen_fork/chosen.proto.js - About 1 hr to fix

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

                                      Chosen.prototype.set_up_html = function() {
                                        var container_classes, container_props;
                                        container_classes = ["chosen-container"];
                                        container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
                                        if (this.inherit_select_classes && this.form_field.className) {
                                  Severity: Minor
                                  Found in client/plugins/chosen_fork/chosen.proto.js - About 1 hr to fix

                                    Function checkSSHOfConnection has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const checkSSHOfConnection = function (connection) {
                                      if (connection.ssh) {
                                        if (!connection.ssh.enabled) delete connection.ssh;
                                        if (!connection.ssh.destinationPort) Error.create({ type: Error.types.MissingParameter, formatters: ['destination-port', 'ssh'], metadataToLog: connection });
                                        if (!connection.ssh.username) Error.create({ type: Error.types.MissingParameter, formatters: ['username', 'ssh'], metadataToLog: connection });
                                    Severity: Minor
                                    Found in server/imports/core/connection/index.js - About 1 hr 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language