Narazaka/fso

View on GitHub

Showing 8 of 13 total issues

File fso.js has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const fs = require("fs");
const path = require("path");

const singlePathMethods = [
  "access",
Severity: Major
Found in src/lib/fso.js - About 1 day to fix

    FileSystemObject has 54 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FileSystemObject {
      constructor(...paths) {
        this.path = path.join(...paths);
      }
    
    
    Severity: Major
    Found in src/lib/fso.js - About 7 hrs to fix

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

        static async _filterChildren(children, excepts, hasCallback) {
          if (!excepts) {
            return children;
          } else if (excepts instanceof Array) {
            return FileSystemObject._filterChildrenByPaths(children, excepts);
      Severity: Minor
      Found in src/lib/fso.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 _method has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        FileSystemObject.prototype[_method] = (function(method) {
          return function(...args) {
            if (args[args.length - 1] instanceof Function) {
              fs[method](this.path, ...args);
            } else {
      Severity: Minor
      Found in src/lib/fso.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 _method has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        FileSystemObject.prototype[_method] = (function(method) {
          return function(...args) {
            if (args[args.length - 1] instanceof Function) {
              fs[method](this.fd, ...args);
            } else {
      Severity: Minor
      Found in src/lib/fso.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 _method has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        FileSystemObject.prototype[_method] = (function(method) {
          return function(...args) {
            if (args[args.length - 1] instanceof Function) {
              fs[method](this.fd, ...args);
            } else {
      Severity: Minor
      Found in src/lib/fso.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 rmAll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        async rmAll(callback) {
          try {
            for (const child of (await this.childrenAll()).reverse()) {
              if (await child.isDirectory()) {
                await child.rmdir();
      Severity: Minor
      Found in src/lib/fso.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 filteredMergeDirectory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        async filteredMergeDirectory(source, excepts, callback) {
          try {
            for (const child of await source.filteredChildrenAll(excepts)) {
              const relativePath = source.relative(child.toString());
              const childTarget = this.new(relativePath.toString());
      Severity: Minor
      Found in src/lib/fso.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

      Severity
      Category
      Status
      Source
      Language