Ikagaka/NanikaStorage

View on GitHub

Showing 36 of 36 total issues

Similar blocks of code found in 5 locations. Consider refactoring.
Open

  async calendarSkinNames() {
    return Promise.all((await this.calendarSkins()).map((child) => child.name()));
  }
Severity: Major
Found in lib/nanika-storage.ts and 4 other locations - About 50 mins to fix
lib/nanika-storage.ts on lines 251..253
lib/nanika-storage.ts on lines 264..266
lib/nanika-storage.ts on lines 269..271
lib/nanika-storage.ts on lines 279..281

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

  async balloonNames() {
    return Promise.all((await this.balloons()).map((child) => child.name()));
  }
Severity: Major
Found in lib/nanika-storage.ts and 4 other locations - About 50 mins to fix
lib/nanika-storage.ts on lines 264..266
lib/nanika-storage.ts on lines 269..271
lib/nanika-storage.ts on lines 274..276
lib/nanika-storage.ts on lines 279..281

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

  async pluginNames() {
    return Promise.all((await this.plugins()).map((child) => child.name()));
  }
Severity: Major
Found in lib/nanika-storage.ts and 4 other locations - About 50 mins to fix
lib/nanika-storage.ts on lines 251..253
lib/nanika-storage.ts on lines 269..271
lib/nanika-storage.ts on lines 274..276
lib/nanika-storage.ts on lines 279..281

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

  async headlineNames() {
    return Promise.all((await this.headlines()).map((child) => child.name()));
  }
Severity: Major
Found in lib/nanika-storage.ts and 4 other locations - About 50 mins to fix
lib/nanika-storage.ts on lines 251..253
lib/nanika-storage.ts on lines 264..266
lib/nanika-storage.ts on lines 274..276
lib/nanika-storage.ts on lines 279..281

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  private async _installBalloon(nar: HasNanikaContainerInfoDirectory, install: UkagakaInstallInfo) {
    return await this._installSingleContainer(nar, install, "balloon", this.balloon(install.directory));
  }
Severity: Major
Found in lib/nanika-storage.ts and 5 other locations - About 45 mins to fix
lib/nanika-storage.ts on lines 468..470
lib/nanika-storage.ts on lines 472..474
lib/nanika-storage.ts on lines 476..478
lib/nanika-storage.ts on lines 480..482
lib/nanika-storage.ts on lines 484..486

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  private async _installCalendarPlugin(nar: HasNanikaContainerInfoDirectory, install: UkagakaInstallInfo) {
    return await this._installSingleContainer(nar, install, "calendar.plugin", this.calendarPlugin(install.directory));
  }
Severity: Major
Found in lib/nanika-storage.ts and 5 other locations - About 45 mins to fix
lib/nanika-storage.ts on lines 464..466
lib/nanika-storage.ts on lines 468..470
lib/nanika-storage.ts on lines 472..474
lib/nanika-storage.ts on lines 476..478
lib/nanika-storage.ts on lines 484..486

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  private async _installPlugin(nar: HasNanikaContainerInfoDirectory, install: UkagakaInstallInfo) {
    return await this._installSingleContainer(nar, install, "plugin", this.plugin(install.directory));
  }
Severity: Major
Found in lib/nanika-storage.ts and 5 other locations - About 45 mins to fix
lib/nanika-storage.ts on lines 464..466
lib/nanika-storage.ts on lines 472..474
lib/nanika-storage.ts on lines 476..478
lib/nanika-storage.ts on lines 480..482
lib/nanika-storage.ts on lines 484..486

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  private async _installSupplement(nar: HasNanikaContainerInfoDirectory, install: UkagakaInstallInfo) {
    return await this._installSingleContainer(nar, install, "supplement", this.ghost(install.directory));
  }
Severity: Major
Found in lib/nanika-storage.ts and 5 other locations - About 45 mins to fix
lib/nanika-storage.ts on lines 464..466
lib/nanika-storage.ts on lines 468..470
lib/nanika-storage.ts on lines 472..474
lib/nanika-storage.ts on lines 476..478
lib/nanika-storage.ts on lines 480..482

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  private async _installHeadline(nar: HasNanikaContainerInfoDirectory, install: UkagakaInstallInfo) {
    return await this._installSingleContainer(nar, install, "headline", this.headline(install.directory));
  }
Severity: Major
Found in lib/nanika-storage.ts and 5 other locations - About 45 mins to fix
lib/nanika-storage.ts on lines 464..466
lib/nanika-storage.ts on lines 468..470
lib/nanika-storage.ts on lines 476..478
lib/nanika-storage.ts on lines 480..482
lib/nanika-storage.ts on lines 484..486

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

  private async _installCalendarSkin(nar: HasNanikaContainerInfoDirectory, install: UkagakaInstallInfo) {
    return await this._installSingleContainer(nar, install, "calendar.skin", this.calendarSkin(install.directory));
  }
Severity: Major
Found in lib/nanika-storage.ts and 5 other locations - About 45 mins to fix
lib/nanika-storage.ts on lines 464..466
lib/nanika-storage.ts on lines 468..470
lib/nanika-storage.ts on lines 472..474
lib/nanika-storage.ts on lines 480..482
lib/nanika-storage.ts on lines 484..486

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

  resolve(...paths: Array<string | FileSystemObject>) {
Severity: Minor
Found in lib/nanika-container-directory.ts by tslint

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

  private _childrenCache: Array<NanikaContainerSyncDirectory | NanikaContainerSyncFile>;
Severity: Minor
Found in lib/nanika-container-directory.ts by tslint

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

  childrenAll(): Promise<Array<FileSystemObject | NanikaContainerSyncDirectory | NanikaContainerSyncFile>>;
Severity: Minor
Found in lib/nanika-container-directory.ts by tslint

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

  children(): Promise<Array<FileSystemObject | NanikaContainerSyncDirectory | NanikaContainerSyncFile>>;
Severity: Minor
Found in lib/nanika-container-directory.ts by tslint

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

Severity
Category
Status
Source
Language