Ikagaka/ghost-kernel.js

View on GitHub

Showing 118 of 118 total issues

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

  choiceselect(event: BalloonSelectEvent) {
    event.args.pop(); // FIXME: cuttlebone Balloon.jsがargsを1つ多く付けるバグの暫定回避 https://github.com/Ikagaka/Balloon.js/pull/14
    const shiorif = this.kernel.component(Shiorif);
    if (/^On/.test(event.id)) { // On
      shiorif.get3(event.id, event.args).then(this.kernel.executeSakuraScript);
Severity: Major
Found in lib/controllers/Shell.ts and 1 other location - About 2 days to fix
lib/controllers/Shell.ts on lines 74..94

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

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

  anchorselect(event: BalloonSelectEvent) {
    event.args.pop(); // FIXME: cuttlebone Balloon.jsがargsを1つ多く付けるバグの暫定回避 https://github.com/Ikagaka/Balloon.js/pull/14
    const shiorif = this.kernel.component(Shiorif);
    if (/^On/.test(event.id)) { // On
      shiorif.get3(event.id, event.args).then(this.kernel.executeSakuraScript);
Severity: Major
Found in lib/controllers/Shell.ts and 1 other location - About 2 days to fix
lib/controllers/Shell.ts on lines 52..72

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

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_other has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  _handle_other(token: SakuraScriptToken) {
    const named = this.kernel.component(Named);
    const scope = named.scope();
    const surface = scope.surface();
    const blimp = scope.blimp();
Severity: Minor
Found in lib/controllers/SakuraScript.ts - About 4 hrs 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_balloon has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  _handle_balloon(token: SakuraScriptToken) {
    const named = this.kernel.component(Named);
    const scope = named.scope();
    const blimp = scope.blimp();
    const shellState = this.kernel.component(ShellState);
Severity: Minor
Found in lib/controllers/SakuraScript.ts - About 4 hrs 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

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

  async secondChange() {
    if (!this.timerEventState.enabled) return;
    const shiorif = this.kernel.component(Shiorif);
    if (this._cantalk()) {
      await shiorif.get3("OnSecondChange", this._timeHeaders()).then(this.kernel.executeSakuraScript);
Severity: Major
Found in lib/controllers/TimeEvent.ts and 1 other location - About 4 hrs to fix
lib/controllers/TimeEvent.ts on lines 49..57

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

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 minuteChange() {
    if (!this.timerEventState.enabled) return;
    const shiorif = this.kernel.component(Shiorif);
    if (this._cantalk()) {
      await shiorif.get3("OnMinuteChange", this._timeHeaders()).then(this.kernel.executeSakuraScript);
Severity: Major
Found in lib/controllers/TimeEvent.ts and 1 other location - About 4 hrs to fix
lib/controllers/TimeEvent.ts on lines 39..47

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

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

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

    if (transaction.response.to("3.0").status_line.code === 200) {
      kernelPhase.materialized();
      await this.kernel.executeSakuraScript(transaction);
    } else {
      const transaction2 = await shiorif.get3("OnBoot", this.bootHeaders(profile.shellname));
Severity: Major
Found in lib/services/BootService.ts and 1 other location - About 4 hrs to fix
lib/services/BootService.ts on lines 44..51

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

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

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

    if (transaction.response.to("3.0").status_line.code === 200) {
      kernelPhase.materialized();
      await this.kernel.executeSakuraScript(transaction);
    } else {
      const transaction2 = await shiorif.get3("OnBoot", this.bootHeaders(profile.shellname));
Severity: Major
Found in lib/services/BootService.ts and 1 other location - About 4 hrs to fix
lib/services/BootService.ts on lines 96..103

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

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

  _handle_balloon(token: SakuraScriptToken) {
    const named = this.kernel.component(Named);
    const scope = named.scope();
    const blimp = scope.blimp();
    const shellState = this.kernel.component(ShellState);
Severity: Major
Found in lib/controllers/SakuraScript.ts - About 2 hrs to fix

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

        if (transaction.response.to("3.0").status_line.code === 200) {
          await this.kernel.executeSakuraScript(transaction);
        } else {
          await shiorif.get3("OnClose", [event.trigger]).then(this.kernel.executeSakuraScript);
        }
    Severity: Major
    Found in lib/services/CloseService.ts and 1 other location - About 2 hrs to fix
    lib/services/CloseService.ts on lines 30..34

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

    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

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

        if (transaction.response.to("3.0").status_line.code === 200) {
          await this.kernel.executeSakuraScript(transaction);
        } else {
          await shiorif.get3("OnClose", [event.trigger]).then(this.kernel.executeSakuraScript);
        }
    Severity: Major
    Found in lib/services/CloseService.ts and 1 other location - About 2 hrs to fix
    lib/services/CloseService.ts on lines 44..48

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

    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

    File SakuraScript.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Named } from "cuttlebone";
    import { EventRoutingDefiner } from "lazy-event-router";
    import { SakuraScriptToken } from "sakurascript";
    import { SakuraScriptExecuter } from "sakurascript-executer";
    import { Shiorif } from "shiorif";
    Severity: Minor
    Found in lib/controllers/SakuraScript.ts - About 2 hrs to fix

      Function _handle_other has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _handle_other(token: SakuraScriptToken) {
          const named = this.kernel.component(Named);
          const scope = named.scope();
          const surface = scope.surface();
          const blimp = scope.blimp();
      Severity: Major
      Found in lib/controllers/SakuraScript.ts - About 2 hrs to fix

        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

          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

            choicetimeout(this: SakuraScriptController, token: SakuraScriptToken.Set) {
              const shellState = this.kernel.component(ShellState);
              if (shellState) shellState.choiceTimeout = Number(token.args[0]);
            },
        Severity: Major
        Found in lib/controllers/SakuraScript.ts and 1 other location - About 1 hr to fix
        lib/controllers/SakuraScript.ts on lines 315..318

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

        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

            balloontimeout(this: SakuraScriptController, token: SakuraScriptToken.Set) {
              const shellState = this.kernel.component(ShellState);
              if (shellState) shellState.balloonTimeout = Number(token.args[0]);
            },
        Severity: Major
        Found in lib/controllers/SakuraScript.ts and 1 other location - About 1 hr to fix
        lib/controllers/SakuraScript.ts on lines 319..322

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

        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

          changed(from: ChangeTransactionInfo) {
            const by = "changed";
            this.startedBy = by;
            this.from = from;
            this.emit("start", {by, from});
        Severity: Major
        Found in lib/components/KernelStartOperation.ts and 1 other location - About 1 hr to fix
        lib/components/KernelStartOperation.ts on lines 42..47

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

        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

          called(from: ChangeTransactionInfo) {
            const by = "called";
            this.startedBy = by;
            this.from = from;
            this.emit("start", {by, from});
        Severity: Major
        Found in lib/components/KernelStartOperation.ts and 1 other location - About 1 hr to fix
        lib/components/KernelStartOperation.ts on lines 31..36

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

        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 a Cognitive Complexity of 13 (exceeds 5 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

        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