Strider-CD/strider

View on GitHub

Showing 367 of 1,006 total issues

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

function validateVal(val, schema) {
  if (schema === String) return `${val}`;
  if (schema === Number) {
    val = parseFloat(schema);
    return isNaN(val) ? 0 : val;
Severity: Minor
Found in apps/strider/lib/utils/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 authenticate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

UserSchema.statics.authenticate = function (email, password, callback) {
    // Has ad config
    if (config_1.default.ldap) {
        this.loginByActiveDirectory(email, password, (err, adUser) => {
            console.log(`Active directory login msg: ${err},  User info`, adUser);
Severity: Major
Found in apps/strider/dist-lib/models/user.js - About 2 hrs to fix

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

    exports.humaneDate = function humaneDate(date, compareTo) {
        if (!date) {
            return;
        }
        const lang = {
    Severity: Major
    Found in apps/strider/dist-lib/utils/humane.js - About 2 hrs to fix

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

      exports.humaneDate = function humaneDate(date, compareTo) {
        if (!date) {
          return;
        }
      
      
      Severity: Major
      Found in apps/strider/lib/utils/humane.js - About 2 hrs to fix

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

        function projectPlugin(req, res, next) {
          let pluginid;
          // if only 3 args, then get pluginid from params ":plugin"
          if (arguments.length === 4) {
            pluginid = req;
        Severity: Major
        Found in apps/strider/lib/middleware.js - About 2 hrs to fix

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

          module.exports = function ($http, $timeout) {
            this.idle = true;
            this.status = 'idle';
          
            this.loadPlugin = function (id) {
          Severity: Major
          Found in clients/classic-ui/client/plugin-manager/controllers/plugin.js - About 2 hrs to fix

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

            module.exports = function () {
              this.busy = false;
            
              this.hasUpgrades = (function () {
                for (var name in plugins) {
            Severity: Major
            Found in clients/classic-ui/client/plugin-manager/controllers/plugin-table.js - About 2 hrs to fix

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

              'use strict';
              
              define("strider-ui/tests/in-run-loop.d", [], function () {
                "use strict";
              });
              Severity: Minor
              Found in apps/strider/dist/ember/assets/tests.js - About 2 hrs to fix

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

                function prepareJob(emitter, job) {
                    Project.findOne({ name: job.project })
                        .populate('creator')
                        .exec(function (err, project) {
                        if (err || !project)
                Severity: Major
                Found in apps/strider/dist-lib/backchannel.js - About 2 hrs to fix

                  File repo.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*
                   * Repo-specific actions - such as deactivation, deletion etc.
                   * routes/api/repo.js
                   */
                  
                  
                  Severity: Minor
                  Found in apps/strider/lib/routes/api/repo.js - About 2 hrs to fix

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

                    function CollaboratorsController($scope) {
                      $scope.new_email = '';
                      $scope.new_access = 0;
                      $scope.collaborators = global.collaborators || [];
                      $scope.remove = function (item) {
                    Severity: Minor
                    Found in clients/classic-ui/client/config/controllers/collaborators.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 _copyAndTrimNpmrcFile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _copyAndTrimNpmrcFile(sourceNpmrcPath, targetNpmrcPath) {
                        console.log(`Copying ${sourceNpmrcPath} --> ${targetNpmrcPath}`); // Verbose
                        let npmrcFileLines = fs.readFileSync(sourceNpmrcPath).toString().split('\n');
                        npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim());
                        const resultLines = [];
                    Severity: Minor
                    Found in common/scripts/install-run.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 exports has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function ($scope, $sce) {
                      $scope.message = null;
                    
                      $scope.error = function (text, digest) {
                        $scope.message = {
                    Severity: Major
                    Found in clients/classic-ui/client/alerts/controllers/alerts.js - About 2 hrs to fix

                      File backchannel.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       * Backchannel server allows workers to stream messages back to the Node server
                       * in a line-buffered way. Uses SSL.
                       */
                      const _ = require('lodash');
                      Severity: Minor
                      Found in apps/strider/dist-lib/backchannel.js - About 2 hrs to fix

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

                        function projectPlugin(req, res, next) {
                            let pluginid;
                            // if only 3 args, then get pluginid from params ":plugin"
                            if (arguments.length === 4) {
                                pluginid = req;
                        Severity: Major
                        Found in apps/strider/dist-lib/middleware.js - About 2 hrs to fix

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

                          UserSchema.statics.registerWithInvite = function (
                            inviteCode: string,
                            email: string,
                            password: string,
                            cb: Function
                          Severity: Major
                          Found in apps/strider/lib/models/user.ts - About 2 hrs to fix

                            Function CollaboratorsController has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function CollaboratorsController($scope) {
                              $scope.new_email = '';
                              $scope.new_access = 0;
                              $scope.collaborators = global.collaborators || [];
                              $scope.remove = function (item) {
                            Severity: Major
                            Found in clients/classic-ui/client/config/controllers/collaborators.js - About 2 hrs to fix

                              Function exports has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = function (pluginsPath) {
                                const localPlugins = require('./local_plugins')(pluginsPath);
                                var pluginsPath = localPlugins.path();
                                prompt.message = 'plugin';
                                prompt.start();
                              Severity: Major
                              Found in apps/strider/lib/cli/lib/plugin_manager/create_new_plugin.js - About 2 hrs to fix

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

                                    }, function processAndRender(err, resultsDetail, results) {
                                        if (err)
                                            throw err;
                                        results.forEach(function (job) {
                                            job.duration = Math.round((job.finished_timestamp - job.created_timestamp) / 1000);
                                Severity: Major
                                Found in apps/strider/dist-lib/routes/admin/index.js - About 2 hrs to fix

                                  Function DeactivateController has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function DeactivateController($scope) {
                                    var message = 'This will remove all configuration and history for this project. You can always re-add it on the /projects page';
                                    $scope.active = $scope.panelData.deactivate;
                                    $scope.loading = false;
                                    $scope.toggleActive = function () {
                                  Severity: Minor
                                  Found in clients/classic-ui/client/config/controllers/deactivate.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language