whitef0x0/tellform

View on GitHub

Showing 58 of 608 total issues

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

                        controller:  function($uibModalInstance, $scope) {

                            /*
                             **  startPage Button Methods
                             */
Severity: Minor
Found in public/modules/forms/admin/directives/edit-form.client.directive.js - About 1 hr to fix

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

                            controller:  function($uibModalInstance, $scope) {
    
                                /*
                                 **  startPage Button Methods
                                 */
    Severity: Minor
    Found in public/modules/forms/admin/directives/edit-form.client.directive.js - About 1 hr to fix

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

      module.exports = function timestamp (schema, options) {
        options || (options = {})
      
        // Options
        var fields = {}
      Severity: Minor
      Found in app/libs/timestamp.server.plugin.js - About 1 hr to fix

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

        exports.formByIDFast = function(req, res, next, id) {
            if (!mongoose.Types.ObjectId.isValid(id)) {
                return res.status(400).send({
                    message: 'Form is invalid'
                });
        Severity: Minor
        Found in app/controllers/forms.server.controller.js - About 1 hr to fix

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

              var saveVisitorData = function (data, socket, cb){
                  Form.findById(data.formId, function(err, form) {
                      if (err) {
                          console.error(err);
                          throw new Error(errorHandler.getErrorMessage(err));
          Severity: Minor
          Found in app/sockets/analytics_service.js - About 1 hr to fix

            Function addMenuItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemType, menuItemUIRoute, isPublic, roles, position) {
            Severity: Major
            Found in public/modules/core/services/menus.client.service.js - About 1 hr to fix

              Function addSubMenuItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles, position) {
              Severity: Major
              Found in public/modules/core/services/menus.client.service.js - About 1 hr to fix

                Function timestamp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function timestamp (schema, options) {
                  options || (options = {})
                
                  // Options
                  var fields = {}
                Severity: Minor
                Found in app/libs/timestamp.server.plugin.js - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                        if (passwordDetails.newPassword === passwordDetails.verifyPassword) {
                                            user.password = passwordDetails.newPassword;
                
                                            user.save(function(err) {
                                                if (err) {
                Severity: Major
                Found in app/controllers/users/users.password.server.controller.js - About 45 mins to fix

                  Function exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function (app, db) {
                      var server = http.createServer(app);
                      var io;
                  
                      // make it possible to only expose one domain
                  Severity: Minor
                  Found in config/socket.io.js - About 45 mins 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 read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.read = function(req, res) {
                      if(!req.user || (req.form.admin.id !== req.user.id) ){
                          readForRender(req, res);
                      } else {
                              var newForm = req.form.toJSON();
                  Severity: Minor
                  Found in app/controllers/forms.server.controller.js - About 45 mins 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 update has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $scope.update = $rootScope.update = function(updateImmediately, data, shouldDiff, refreshAfterUpdate, cb){
                  Severity: Minor
                  Found in public/modules/forms/admin/controllers/admin-form.client.controller.js - About 35 mins to fix

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

                                scope.update = function(updateImmediately, data, isDiffed, refreshAfterUpdate, cb){

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

                          var checkLoggedin = function($q, $timeout, $state, User, Auth) {
                      Severity: Minor
                      Found in public/modules/users/config/users.client.routes.js - About 35 mins to fix

                        Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = function(db) {
                            // Initialize express app
                            var app = express();
                            var url = require('url');
                        
                        
                        Severity: Minor
                        Found in config/express.js - About 35 mins 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

                        Avoid too many return statements within this function.
                        Open

                                    return next();
                        Severity: Major
                        Found in config/express.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return next();
                          Severity: Major
                          Found in config/express.js - About 30 mins to fix

                            Function getDeletedIndexes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getDeletedIndexes(needle, haystack){
                                var deletedIndexes = [];
                            
                                if(haystack.length > 0){
                                      for(var i = 0; i < needle.length; i++){
                            Severity: Minor
                            Found in app/models/form.server.model.js - About 25 mins 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