Ikagaka/ghost-kernel.js

View on GitHub

Showing 118 of 118 total issues

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

  async installedballoonname() {
    const names = await this.kernel.component(NanikaStorage).balloonNames();
    await this.kernel.component(Shiorif).notify3("installedballoonname", names);
  }
Severity: Major
Found in lib/services/NotifyInformationService.ts and 1 other location - About 1 hr to fix
lib/services/NotifyInformationService.ts on lines 116..119

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

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

  async installedghostname() {
    const names = await this.kernel.component(NanikaStorage).ghostNames();
    await this.kernel.component(Shiorif).notify3("installedghostname", names);
  }
Severity: Major
Found in lib/services/NotifyInformationService.ts and 1 other location - About 1 hr to fix
lib/services/NotifyInformationService.ts on lines 121..124

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

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 _handle_view has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _handle_view(token: SakuraScriptToken) {
    const named = this.kernel.component(Named);
    const scope = named.scope();
    const surface = scope.surface();
    if (token instanceof SakuraScriptToken.Scope) {
Severity: Minor
Found in lib/controllers/SakuraScript.ts - About 1 hr to fix

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

        } else if (token instanceof SakuraScriptToken.Set) {
          const handler = SakuraScriptController._setHandler[token.id as "balloontimeout" | "choicetimeout"];
          if (handler) handler.bind(this)(token);
        } else if (token instanceof SakuraScriptToken.Open) {
          const handler = SakuraScriptController._openHandler[token.command as "communicatebox" | "inputbox"];
    Severity: Minor
    Found in lib/controllers/SakuraScript.ts and 1 other location - About 55 mins to fix
    lib/controllers/SakuraScript.ts on lines 299..309

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

    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

        } else if (token instanceof SakuraScriptToken.Open) {
          const handler = SakuraScriptController._openHandler[token.command as "communicatebox" | "inputbox"];
          if (handler) handler.bind(this)(token);
        } else if (token instanceof SakuraScriptToken.Close) {
          const handler = SakuraScriptController._closeHandler[token.command];
    Severity: Minor
    Found in lib/controllers/SakuraScript.ts and 1 other location - About 55 mins to fix
    lib/controllers/SakuraScript.ts on lines 296..309

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

    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

        r2.from(KernelPhase, (from, controller) => {
          from.on("initialNotifyFinished", controller.getInformations);
          from.on("halted", controller.halt);
        });
    Severity: Minor
    Found in lib/controllers/Information.ts and 1 other location - About 50 mins to fix
    lib/controllers/TimeEvent.ts on lines 14..17

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

        routes2.from(TimerEventSource, (from, controller) => {
          from.on("second_change", controller.secondChange);
          from.on("minute_change", controller.minuteChange);
        });
    Severity: Minor
    Found in lib/controllers/TimeEvent.ts and 1 other location - About 50 mins to fix
    lib/controllers/Information.ts on lines 10..13

    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

    Avoid deeply nested control flow statements.
    Open

          if (handler) handler.bind(this)(token);
    Severity: Major
    Found in lib/controllers/SakuraScript.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

          } else if (token instanceof SakuraScriptToken.NotImplemented) {
            return true;
          } else {
            return false;
          }
      Severity: Major
      Found in lib/controllers/SakuraScript.ts - About 45 mins to fix

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

          constructor(name: string, url: string, banner: string, script: string) {
            this._name = name;
            this._url = url;
            this._banner = banner;
            this._script = script;
        Severity: Minor
        Found in lib/components/ShioriResources.ts and 1 other location - About 40 mins to fix
        lib/components/ShioriVersionInfo.ts on lines 7..12

        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

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

          constructor(name: string, version: string, craftman: string, craftmanw: string) {
            this.name = name;
            this.version = version;
            this.craftman = craftman;
            this.craftmanw = craftmanw;
        Severity: Minor
        Found in lib/components/ShioriVersionInfo.ts and 1 other location - About 40 mins to fix
        lib/components/ShioriResources.ts on lines 53..58

        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

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

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

        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

        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

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

          _handle_state(token: SakuraScriptToken) {
            const shellState = this.kernel.component(ShellState);
            if (!shellState) return false;
            if (token instanceof SakuraScriptToken.ToggleSynchronize) {
              shellState.synchronized = shellState.synchronized ? false : token.scopes;
        Severity: Minor
        Found in lib/controllers/SakuraScript.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 _handle_wait has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          _handle_wait(token: SakuraScriptToken) {
            if (token instanceof SakuraScriptToken.SimpleWait) {
              return true;
            } else if (token instanceof SakuraScriptToken.PreciseWait) {
              return true;
        Severity: Minor
        Found in lib/controllers/SakuraScript.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

        Avoid too many return statements within this function.
        Open

              return true;
        Severity: Major
        Found in lib/controllers/SakuraScript.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return true;
          Severity: Major
          Found in lib/controllers/SakuraScript.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return false;
            Severity: Major
            Found in lib/controllers/SakuraScript.ts - About 30 mins to fix

              Function watchVisibility has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                watchVisibility() {
                  if (!this.document) return;
                  // hidden プロパティおよび可視性の変更イベントの名前を設定
                  // tslint:disable-next-line strict-type-predicates
                  if (typeof this.document.hidden !== "undefined") { // Opera 12.10 や Firefox 18 以降でサポート
              Severity: Minor
              Found in lib/components/Visibility.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

              Function perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                async perform() {
                  const kernelStartOperation = this.kernelStartOperation;
                  const nanikaGhostMasterDirectory = this.nanikaGhostMasterDirectory;
                  const profile = await nanikaGhostMasterDirectory.readProfile();
                  const bootCount = profile.bootCount as number || 0;
              Severity: Minor
              Found in lib/services/BootService.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