Ikagaka/ghost-kernel.js

View on GitHub
lib/components/KernelCloseOperation.ts

Summary

Maintainability
B
4 hrs
Test Coverage

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

  close(trigger: KernelCloseOperation.CloseTrigger) {
    const by = "close";
    this.closeBy = by;
    this.closeTrigger = trigger;
    this.emit("close", {by, trigger});
Severity: Major
Found in lib/components/KernelCloseOperation.ts and 1 other location - About 2 hrs to fix
lib/components/KernelCloseOperation.ts on lines 45..50

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 75.

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 2 locations. Consider refactoring.
Open

  closeAll(trigger: KernelCloseOperation.CloseTrigger) {
    const by = "closeAll";
    this.closeBy = by;
    this.closeTrigger = trigger;
    this.emit("close", {by, trigger});
Severity: Major
Found in lib/components/KernelCloseOperation.ts and 1 other location - About 2 hrs to fix
lib/components/KernelCloseOperation.ts on lines 34..39

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 75.

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 2 locations. Consider refactoring.
Open

  on(event: "close", listener: (by: KernelCloseOperation.AllEvent) => void) { return super.on(event, listener); }
Severity: Minor
Found in lib/components/KernelCloseOperation.ts and 1 other location - About 40 mins to fix
lib/components/KernelStartOperation.ts on lines 60..60

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 48.

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

Imports from this module are not allowed in this group. The expected groups (in order) are: libraries, parent directories, current directory.
Open

import { ChangeTransactionInfo } from "./ChangeTransactionInfo";

Rule: ordered-imports

Requires that import statements be alphabetized and grouped.

Enforce a consistent ordering for ES6 imports: - Named imports must be alphabetized (i.e. "import {A, B, C} from "foo";") - The exact ordering can be controlled by the named-imports-order option. - "longName as name" imports are ordered by "longName". - Import sources must be alphabetized within groups, i.e.: import * as foo from "a"; import * as bar from "b"; - Groups of imports are delineated by blank lines. You can use this rule to group imports however you like, e.g. by first- vs. third-party or thematically or you can define groups based upon patterns in import path names.

Notes
  • Has Fix

Config

You may set the "import-sources-order" option to control the ordering of source imports (the "foo" in import {A, B, C} from "foo").

Possible values for "import-sources-order" are:

  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • "any": Allow any order.

You may set the "grouped-imports" option to control the grouping of source imports (the "foo" in import {A, B, C} from "foo"). The grouping used is controlled by the "groups" option.

Possible values for "grouped-imports" are:

  • false: Do not enforce grouping. (This is the default.)
  • true: Group source imports using default grouping or groups setting.

The value of "groups" is a list of group rules of the form:

[{
    "name": "optional rule name",
    "match": "regex string",
    "order": 10
}, {
    "name": "pkga imports",
    "match": "^@pkga",
    "order": 20
}]

there is also a simplified form where you only pass a list of patterns and the order is given by the position in the list

["^@pkga", "^\.\."]

The first rule in the list to match a given import is the group that is used. If no rule in matched then the import will be put in an unmatched group at the end of all groups. The groups must be ordered based upon the sequential value of the order value. (ie. order 0 is first)

If no "groups" options is set, a default grouping is used of third-party, parent directories and the current directory. ("bar", "../baz", "./foo".)

You may set the "named-imports-order" option to control the ordering of named imports (the {A, B, C} in import {A, B, C} from "foo").

Possible values for "named-imports-order" are:

  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is {b, A, C}.
  • "lowercase-last": Correct order is {A, C, b}.
  • "any": Allow any order.

You may set the "module-source-path" option to control the ordering of imports based full path or just the module name

Possible values for "module-source-path" are:

  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
Examples
"ordered-imports": true
"ordered-imports": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "grouped-imports": {
      "type": "boolean"
    },
    "groups": {
      "type": "list",
      "listType": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "match": {
                "type": "string"
              },
              "order": {
                "type": "number"
              }
            },
            "required": [
              "match",
              "order"
            ]
          }
        ]
      }
    },
    "import-sources-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "named-imports-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "module-source-path": {
      "type": "string",
      "enum": [
        "full",
        "basename"
      ]
    }
  },
  "additionalProperties": false
}

For more information see this page.

File name must be camelCase
Open

import { EventEmitter } from "events";

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

There are no issues that match your filters.

Category
Status