betajs/mock-file-server

View on GitHub

Showing 6 of 10 total issues

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

module.exports = function (fileSystem, options) {
    
    var result = function (status, data) {
        return {
            status: status,
Severity: Minor
Found in src/file_service.js - About 3 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 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (fileSystem, options) {
    
    var result = function (status, data) {
        return {
            status: status,
Severity: Major
Found in src/file_service.js - About 2 hrs to fix

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

        init: function (Config) {
            var upload = Multer({ storage: Multer.memoryStorage() });
    
            var express = Express();
            express.use(BodyParser());
    Severity: Major
    Found in src/server_service.js - About 2 hrs to fix

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

      module.exports = function(options) {
          
          var fileSystem = {
      
              files : {},
      Severity: Minor
      Found in src/file_system.js - About 1 hr to fix

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

                assembleFileChunks: function (filename, requestTotalSize) {
                    console.log("Assembling", filename, "total size", requestTotalSize);
                    var chunkNumber = 1;
                    var totalSize = 0;
                    while (true) {
        Severity: Minor
        Found in src/file_service.js - About 1 hr to fix

          Function init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              init: function (Config) {
                  var upload = Multer({ storage: Multer.memoryStorage() });
          
                  var express = Express();
                  express.use(BodyParser());
          Severity: Minor
          Found in src/server_service.js - About 55 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