mike-goodwin/owasp-threat-dragon

View on GitHub

Showing 17 of 88 total issues

File threatmodelcontroller_spec.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'

require('jasmine');

describe('threat model controller tests', function () {
Severity: Minor
Found in td.tests/serverspec/threatmodelcontroller_spec.js - About 6 hrs to fix

    Function datacontext has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function datacontext($q, $http, common, threatmodellocator) {
    
        var threatModel = null;
        var threatModelLocation = null;
    
    
    Severity: Major
    Found in td/public/app/services/datacontext.js - About 5 hrs to fix

      Function getRoutes has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getRoutes() {
          return [
              {
                  url: '/',
                  config: {
      Severity: Major
      Found in td/public/app/config.route.js - About 4 hrs to fix

        Function github has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function github($q, $routeParams, $location, common, datacontext) {
            // Using 'Controller As' syntax, so we assign this to the vm variable (for viewmodel).
            /*jshint validthis: true */
            var vm = this;
            var controllerId = 'github';
        Severity: Major
        Found in td/public/app/threatmodels/github.js - About 3 hrs to fix

          File routes.config_spec.js has 319 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          var jasmine = require('jasmine');
          var mockery = require('mockery');
          var request = require('supertest');
          Severity: Minor
          Found in td.tests/serverspec/routes.config_spec.js - About 3 hrs to fix

            File github_spec.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            //require('angular-mocks');
            
            describe('github controller', function () {
            Severity: Minor
            Found in td.tests/clientspec/github_spec.js - About 3 hrs to fix

              File threatmodelrepository_spec.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              
              require('jasmine');
              var mockery = require('mockery');
              var moduleUnderTest = '../../td/repositories/threatmodelrepository';
              Severity: Minor
              Found in td.tests/serverspec/threatmodelrepository_spec.js - About 3 hrs to fix

                Function github has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function github($q, $routeParams, $location, common, datacontext) {
                    // Using 'Controller As' syntax, so we assign this to the vm variable (for viewmodel).
                    /*jshint validthis: true */
                    var vm = this;
                    var controllerId = 'github';
                Severity: Minor
                Found in td/public/app/threatmodels/github.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 webreport has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function webreport($timeout, $routeParams, common, datacontext, threatmodellocator) {
                    // Using 'Controller As' syntax, so we assign this to the vm variable (for viewmodel).
                    /*jshint validthis: true */
                    var vm = this;
                    var controllerId = 'webreport';
                Severity: Minor
                Found in td/public/app/threatmodels/webreport.js - About 1 hr to fix

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

                  module.exports = function (config) {
                      config.set({
                  
                          // base path that will be used to resolve all patterns (eg. files, exclude)
                          basePath: '',
                  Severity: Minor
                  Found in karma.conf.js - About 1 hr to fix

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

                    function datacontext($q, $http, common, threatmodellocator) {
                    
                        var threatModel = null;
                        var threatModelLocation = null;
                    
                    
                    Severity: Minor
                    Found in td/public/app/services/datacontext.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 threatmodellocator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function threatmodellocator() {
                    
                        var service = {
                            getModelLocation: getModelLocation,
                            getModelPath: getModelPath,
                    Severity: Minor
                    Found in td/public/app/services/threatmodellocator.js - About 1 hr to fix

                      Function updateContents has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                  updateContents: function (path, message, content, sha, branch, cb) {
                      Severity: Minor
                      Found in td.tests/serverspec/threatmodelrepository_spec.js - About 45 mins to fix

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

                        function webreport($timeout, $routeParams, common, datacontext, threatmodellocator) {
                        Severity: Minor
                        Found in td/public/app/threatmodels/webreport.js - About 35 mins to fix

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

                          function github($q, $routeParams, $location, common, datacontext) {
                          Severity: Minor
                          Found in td/public/app/threatmodels/github.js - About 35 mins to fix

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

                                        deleteContents: function (path, message, sha, branch, cb) {
                            Severity: Minor
                            Found in td.tests/serverspec/threatmodelrepository_spec.js - About 35 mins to fix

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

                                          createContents: function (path, message, content, branch, cb) {
                              Severity: Minor
                              Found in td.tests/serverspec/threatmodelrepository_spec.js - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language