Maingron/MainOS

View on GitHub
system/iofsv2.js

Summary

Maintainability
D
2 days
Test Coverage

File iofsv2.js has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var ismainos = 1;

var iofs = {
    forbiddenCharsInPath: ['*', '?', '#', '$', '\'', '"', '`', '\\', 'ยง', ','],

Severity: Minor
Found in system/iofsv2.js - About 5 hrs to fix

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

        getInfos(path) {
            if(!this.isAllowedPath(path)) {
                return null;
            }
    
    
    Severity: Minor
    Found in system/iofsv2.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 listdir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        listdir: function(path, recurseDepth = 0) {
            path = this.sanitizePath(path);
            if(path == "/") {
                path = "";
            }
    Severity: Minor
    Found in system/iofsv2.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 save has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        save: function(path, content, attributes = false, override = false, recursive = false, isRaw = true) {
            path = this.sanitizePath(path);
    
            if(!this.isAllowedPath(path)) {
                return false;
    Severity: Minor
    Found in system/iofsv2.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 delete has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        delete: function(path, recursive = false) {
            path = this.sanitizePath(path);
    
            if(!this.exists(path)) {
                return false;
    Severity: Minor
    Found in system/iofsv2.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 load has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        load: function(path, raw = 1) {
            if(!this.isAllowedPath(path)) {
                return null;
            }
    
    
    Severity: Minor
    Found in system/iofsv2.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 copy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        copy: function(source, destination, override = false) {
            if(!this.isAllowedPath(source) || !this.isAllowedPath(destination)) {
                return false;
            }
    
    
    Severity: Minor
    Found in system/iofsv2.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

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

        save: function(path, content, attributes = false, override = false, recursive = false, isRaw = true) {
    Severity: Minor
    Found in system/iofsv2.js - About 45 mins to fix

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

          getPath: function(path) {
              path = this.sanitizePath(path);
              var goUpCount = 0;
      
              let pathArray = path.split("/");
      Severity: Minor
      Found in system/iofsv2.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

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

          sanitizePath: function(path) {
              path = path.replaceAll("//", "/");
              if(path.indexOf("//") >= 0) {
                  path = this.sanitizePath(path);
              }
      Severity: Minor
      Found in system/iofsv2.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 result;
      Severity: Major
      Found in system/iofsv2.js - About 30 mins to fix

        TODO found
        Open

                // TODO: Add time / change time
        Severity: Minor
        Found in system/iofsv2.js by fixme

        There are no issues that match your filters.

        Category
        Status