whitef0x0/tellform

View on GitHub

Showing 58 of 608 total issues

Function submitForm has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                $rootScope.submitForm = $scope.submitForm = function() {
                    if($scope.forms.myForm.$invalid){
                        $scope.goToInvalid();
                        return;
                    }

    Function isAuthenticated has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next) {
        if (req.isAuthenticated()) {
            return next();
        }
        // Try authenticate with API KEY
    Severity: Minor
    Found in config/passport_helpers.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 link has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                link: function(scope, element) {
    
                    $rootScope.chooseDefaultOption = scope.chooseDefaultOption = function(type) {
                        if(type === 'yes_no'){
                            scope.field.fieldValue = 'true';
    Severity: Minor
    Found in public/form_modules/forms/base/directives/field.client.directive.js - About 1 hr to fix

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

          function Socket($timeout, $window) {
      
              var service = {
                  socket: null
              };
      Severity: Minor
      Found in public/form_modules/forms/base/services/socket.io.client.service.js - About 1 hr to fix

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

        exports.update = function(req, res) {
        
            var form = req.form;
            var updatedForm = req.body.form;
            if(form.form_fields === undefined){
        Severity: Minor
        Found in app/controllers/forms.server.controller.js - About 1 hr to fix

          Function setActiveField has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          $scope.setActiveField = $rootScope.setActiveField = function(field_id, field_index, animateScroll) {
                              if($scope.selected === null || (!field_id && field_index === null) )  {
                                  return;
                              }
                              

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

            exports.update = function(req, res) {
            
                var form = req.form;
                var updatedForm = req.body.form;
                if(form.form_fields === undefined){
            Severity: Minor
            Found in app/controllers/forms.server.controller.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 SendVisitorData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function SendVisitorData(Socket, $state) {
            
                    // Create a controller method for sending visitor data
                    function send(form, lastActiveIndex, timeElapsed) {
            
            

              Function openEditEndPageModal has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              $scope.openEditEndPageModal = function(){
                                  $scope.editEndPageModal = $uibModal.open({
                                      animation: true,
                                      templateUrl: 'editEndPageModal.html',
                                      windowClass: 'edit-modal-window',
              Severity: Minor
              Found in public/modules/forms/admin/directives/edit-form.client.directive.js - About 1 hr to fix

                Function openEditStartPageModal has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                $scope.openEditStartPageModal = function(){
                                    $scope.editStartPageModal = $uibModal.open({
                                        animation: true,
                                        templateUrl: 'editStartPageModal.html',
                                        windowClass: 'edit-modal-window',
                Severity: Minor
                Found in public/modules/forms/admin/directives/edit-form.client.directive.js - About 1 hr to fix

                  Function onscroll has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  $window.onscroll = function(){
                                      if(!NOSCROLL){
                  
                                          var scrollTop = $(window).scrollTop();
                                          var elemBox = document.getElementsByClassName('activeField')[0].getBoundingClientRect();

                    Function DeviceStatistics has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                    $scope.DeviceStatistics = (function(){
                                        var newStatItem = function(){
                                            return {
                                                visits: 0,
                                                responses: 0,

                      Function addNewField has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                      $scope.addNewField = function(fieldType){
                                          // increment lastAddedID counter
                                          $scope.addField.lastAddedID++;
                                          var fieldTitle = fieldType;
                      
                      
                      Severity: Minor
                      Found in public/modules/forms/admin/directives/edit-form.client.directive.js - About 1 hr to fix

                        Function signup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.signup = function(req, res) {
                            // For security measures we remove the roles from the req.body object
                            delete req.body.roles;
                        
                            // Init Variables
                        Severity: Minor
                        Found in app/controllers/users/users.authentication.server.controller.js - About 1 hr to fix

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

                          exports.getErrorMessage = function(err) {
                              var message = '';
                          
                              if(!err) {
                                  return '';
                          Severity: Minor
                          Found in app/controllers/errors.server.controller.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 exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function(app) {
                              // Form Routes
                              if(!config.subdomainsDisabled) {
                                  app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/')
                                   .get(core.form);
                          Severity: Minor
                          Found in app/routes/forms.server.routes.js - About 1 hr to fix

                            Function generateAPIKey has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            exports.generateAPIKey = function(req, res) {
                                if (!req.isAuthenticated()){
                                    return res.status(400).send({
                                        message: 'User is not Authorized'
                                    });
                            Severity: Minor
                            Found in app/controllers/users/users.authentication.server.controller.js - About 1 hr to fix

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

                              var config_nev = function () {
                              
                                  nev.configure({
                              
                                      verifyMailOptions: {
                              Severity: Minor
                              Found in app/controllers/users/users.authentication.server.controller.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 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language