Ikagaka/NanikaStorage

View on GitHub

Showing 8 of 36 total issues

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

export class NanikaStorage extends NanikaBaseDirectory {
  private static async _filterRemove(target: FileSystemObject, exceptPaths: string[]) {
    let toRemoveChildren: FileSystemObject[];
    try {
      toRemoveChildren = await target.filteredChildrenAll(exceptPaths);
Severity: Major
Found in lib/nanika-storage.ts - About 7 hrs to fix

    File nanika-storage.ts has 373 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** 伺かに必要なストレージ操作を扱うディレクトリオブジェクト */
    
    /** -- */ // doc comment が後にないとtypedocによってmoduleの情報が出力されないので
    
    import {FileSystemObject} from "fso";
    Severity: Minor
    Found in lib/nanika-storage.ts - About 4 hrs to fix

      File nanika-container-directory.ts has 311 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** 伺かのコンテナを扱うディレクトリオブジェクト */
      
      /** -- */ // doc comment が後にないとtypedocによってmoduleの情報が出力されないので
      
      import * as fs from "fs";
      Severity: Minor
      Found in lib/nanika-container-directory.ts - About 3 hrs to fix

        NanikaContainerSyncDirectory has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class NanikaContainerSyncDirectory extends NanikaContainerSyncEntry implements HasNanikaContainerInfoDirectory {
        
          private _childrenCache: Array<NanikaContainerSyncDirectory | NanikaContainerSyncFile>;
          private _childrenAllCache: NanikaContainerSyncFile[];
          private _indexes: {[path: string]: number} = {};
        Severity: Minor
        Found in lib/nanika-container-directory.ts - About 3 hrs to fix

          NanikaContainerSyncFile has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class NanikaContainerSyncFile extends NanikaContainerSyncEntry {
            path: string;
            private _content: Buffer | null;
            private _stats: fs.Stats | null;
          
          
          Severity: Minor
          Found in lib/nanika-container-directory.ts - About 2 hrs to fix

            Function _mergeInstallDirectory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              private static async _mergeInstallDirectory( // sourceをFileSystemObjectに変換するための苦肉の策
                source: HasNanikaContainerInfoDirectory | FileSystemObject, target: FileSystemObject, install: UkagakaInstallInfo,
              ) {
                if (install.refresh) {
                  if (install.refreshundeletemask) {
            Severity: Minor
            Found in lib/nanika-storage.ts - 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 _filterRemove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              private static async _filterRemove(target: FileSystemObject, exceptPaths: string[]) {
                let toRemoveChildren: FileSystemObject[];
                try {
                  toRemoveChildren = await target.filteredChildrenAll(exceptPaths);
                } catch (error) {
            Severity: Minor
            Found in lib/nanika-storage.ts - 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 readFileSync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              readFileSync(options?: any): string | Buffer {
                if (this._content == null) throw new Error("not found");
                const encoding = options == null ? undefined :
                  typeof options === "string" ? options :
                  options.encoding as string | undefined;
            Severity: Minor
            Found in lib/nanika-container-directory.ts - About 25 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