Strider-CD/strider

View on GitHub

Showing 367 of 1,006 total issues

Function link has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      link: function (scope, elm, attrs, ngModel) {
        var options, opts, onChange, deferCodeMirror, codeMirror;

        if (elm[0].type !== 'textarea') {
          throw new Error('uiCodemirror3 can only be applied to a textarea element');
Severity: Major
Found in clients/classic-ui/public/libs/ui-codemirror.js - About 2 hrs to fix

    Function link has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          link: function (scope, elm, attrs, ngModel) {
            var options, opts, onChange, deferCodeMirror, codeMirror;
    
            if (elm[0].type !== 'textarea') {
              throw new Error('uiCodemirror3 can only be applied to a textarea element');
    Severity: Major
    Found in apps/strider/public/libs/ui-codemirror.js - About 2 hrs to fix

      Function upgradeJob has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function upgradeJob(job, done) {
          Job.findById(job._id)
              .lean()
              .exec(function (err, mjob) {
              if (err)
      Severity: Major
      Found in apps/strider/dist-lib/models/upgrade/from0to1.js - About 2 hrs to fix

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

        module.exports = function (deps) {
            const saveUser = require('./save-user')(deps);
            function addUser(email, password, admin, force) {
                let level = admin ? 1 : 0;
                if (!email || !password) {
        Severity: Major
        Found in apps/strider/dist-lib/cli/lib/add-user.js - About 2 hrs to fix

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

          function upgradeJob(job, done) {
            Job.findById(job._id)
              .lean()
              .exec(function (err, mjob) {
                if (err) return done(err);
          Severity: Major
          Found in apps/strider/lib/models/upgrade/from0to1.js - About 2 hrs to fix

            Function job has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.job = function (req, res) {
                res.statusCode = 200;
                const org = req.params.org;
                const repo = req.params.repo;
                const jobId = req.params.job_id;
            Severity: Minor
            Found in apps/strider/dist-lib/routes/admin/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 job has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.job = function (req, res) {
              res.statusCode = 200;
              const org = req.params.org;
              const repo = req.params.repo;
              const jobId = req.params.job_id;
            Severity: Minor
            Found in apps/strider/lib/routes/admin/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 addUser has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function addUser(email, password, admin, force) {
                let level = admin ? 1 : 0;
            
                if (!email || !password) {
                  var rl = readline.createInterface({
            Severity: Major
            Found in apps/strider/lib/cli/lib/add-user.js - About 2 hrs to fix

              File auth.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              const crypto = require('crypto');
              const BluebirdPromise = require('bluebird');
              const passport = require('passport');
              const LocalStrategy = require('passport-local').Strategy;
              const utils = require('./utils');
              Severity: Minor
              Found in apps/strider/dist-lib/auth.js - About 2 hrs to fix

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

                    function addUser(email, password, admin, force) {
                        let level = admin ? 1 : 0;
                        if (!email || !password) {
                            var rl = readline.createInterface({
                                input: process.stdin,
                Severity: Major
                Found in apps/strider/dist-lib/cli/lib/add-user.js - About 2 hrs to fix

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

                  exports.config = function (req, res) {
                    User.collaborators(req.project.name, 0, function (err, users) {
                      if (err) {
                        throw err;
                      }
                  Severity: Major
                  Found in apps/strider/lib/routes/index.js - About 2 hrs to fix

                    Function projectPlugin has a Cognitive Complexity of 20 (exceeds 5 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: Minor
                    Found in apps/strider/dist-lib/middleware.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 projectPlugin has a Cognitive Complexity of 20 (exceeds 5 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: Minor
                    Found in apps/strider/lib/middleware.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

                    File job.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    'use strict';
                    
                    var _ = require('lodash');
                    var bootbox = require('bootbox');
                    var $ = require('jquery');
                    Severity: Minor
                    Found in clients/classic-ui/client/job-status/controllers/job.js - About 2 hrs to fix

                      Function link has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            link: function (scope, element, attrs, paginationCtrl) {
                      
                            // Setup configuration parameters
                              var maxSize,
                                boundaryLinks  = paginationCtrl.getAttributeValue(attrs.boundaryLinks,  config.boundaryLinks      ),
                      Severity: Major
                      Found in clients/classic-ui/public/libs/ui-bootstrap.js - About 2 hrs to fix

                        Function link has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              link: function (scope, element, attrs, paginationCtrl) {
                        
                              // Setup configuration parameters
                                var maxSize,
                                  boundaryLinks  = paginationCtrl.getAttributeValue(attrs.boundaryLinks,  config.boundaryLinks      ),
                        Severity: Major
                        Found in apps/strider/public/libs/ui-bootstrap.js - About 2 hrs to fix

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

                          exports.config = function (req, res) {
                              User.collaborators(req.project.name, 0, function (err, users) {
                                  if (err) {
                                      throw err;
                                  }
                          Severity: Major
                          Found in apps/strider/dist-lib/routes/index.js - About 2 hrs to fix

                            Function processAndRender has 66 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(
                            Severity: Major
                            Found in apps/strider/lib/routes/admin/index.js - About 2 hrs to fix

                              File index.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              const _ = require('lodash');
                              const common = require('../common');
                              const config = require('../config');
                              const debug = require('debug')('strider:routes');
                              const jobs = require('../jobs');
                              Severity: Minor
                              Found in apps/strider/dist-lib/routes/index.js - About 2 hrs to fix

                                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);
                                Severity: Minor
                                Found in apps/strider/dist-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

                                Severity
                                Category
                                Status
                                Source
                                Language