galarant/domless

View on GitHub

Showing 122 of 124 total issues

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

      this.scene.input.keyboard.on("keyup_SHIFT", function() {
        if (this.mode !== "desktoplowercase" && !this.capslock) {
          this.setMode("desktoplowercase")
        }
      }, this)
Severity: Major
Found in src/components/input/keyboard.js and 1 other location - About 1 hr to fix
src/components/input/keyboard.js on lines 339..343

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

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

  constructor(
    scene,
    form,
    {
      edge="right",
Severity: Minor
Found in src/components/input/form_drawer.js - About 1 hr to fix

Function addForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addForm() {
    let
      xPos = 0,
      yPos = this.formHeader.height,
      widestField = _.maxBy(this.form.fields, (field) => { return field.x + field.width }),
Severity: Minor
Found in src/components/input/form_drawer.js - About 1 hr to fix

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

  deactivate(force=false, to=null) {
    if (this.active || force) {
      console.log("deactivating textField " + this.id)
      // deactivate but don't disable interactive
      super.deactivate(false, false)
Severity: Minor
Found in src/components/input/text_field.js - 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 constructor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    scene,
    {
      x, y,
      rows=[],
Severity: Minor
Found in src/components/input/form.js - About 1 hr to fix

Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    calledFrom,
    {
      defaultDeactivate=true,
      key="domlessModal",
Severity: Minor
Found in src/components/display/modal.js - About 1 hr to fix

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

      this.cursorTween = this.scene.add.tween(
        {
          targets: [this.cursor],
          alpha: 0,
          duration: 250,
Severity: Major
Found in src/components/input/text_field.js and 1 other location - About 1 hr to fix
src/components/display/dialogue.js on lines 48..54

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

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

    this.promptNextPageTween = this.scene.add.tween({
      targets: [this.pageDownButton],
      alpha: 0,
      duration: 250,
      yoyo: true,
Severity: Major
Found in src/components/display/dialogue.js and 1 other location - About 1 hr to fix
src/components/input/text_field.js on lines 182..190

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

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

  initTextFieldComponents(diffObject, diffOld) {

    // don't do anything if I'm not yet initialized
    if (!this.initialized) {
      return
Severity: Minor
Found in src/components/input/text_field.js - About 1 hr to fix

Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    scene,
    {
      x, y,
      width=400, height=200,
Severity: Minor
Found in src/components/display/text_display.js - About 1 hr to fix

Function addPage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  addPage() {
    let thisPageText = this.pages.shift()

    // if this is not the last page, add line breaks to fill the page
    if (this.pages.length) {
Severity: Minor
Found in src/components/display/dialogue.js - 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 reFocus has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  reFocus(toElement) {
    // if element is above the screen, pull it down so it's visible
    // if element is below the keyboardDrawer, pull it up so it's visible
    // if element is visible, do nothing
    console.log("refocusing keyboardDrawer")
Severity: Minor
Found in src/components/input/keyboard_drawer.js - About 1 hr to fix

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

    if (this.selectedOptionElement) {
      this.selectedOptionElement.setStyle(this.styles)
      this.selectedOptionElement.setPosition(-this.width / 2, -this.height / 2)
    } else {
      this.selectedOptionElement = this.scene.add.text(-this.width / 2, -this.height / 2, "", this.styles)
Severity: Major
Found in src/components/input/dropdown_field.js and 3 other locations - About 1 hr to fix
src/components/display/text_display.js on lines 96..104
src/components/input/dropdown_field.js on lines 113..120
src/components/input/text_field.js on lines 132..139

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

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

    if (this.content) {
      this.content.setStyle(this.styles)
      this.content.setPosition(-this.width / 2, -this.height / 2)
    } else {
      this.content = this.scene.add.text(-this.width / 2, -this.height / 2, "", this.styles)
Severity: Major
Found in src/components/display/text_display.js and 3 other locations - About 1 hr to fix
src/components/input/dropdown_field.js on lines 113..120
src/components/input/dropdown_field.js on lines 123..129
src/components/input/text_field.js on lines 132..139

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

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

  pushCameraUp(toElement, maxPush=null) {
    let
      camera = this.scene.cameras.main,
      elementBottomPos = toElement.y + toElement.displayOriginY - camera.scrollY,
      distanceToBottom = this.scene.game.config.height - elementBottomPos,
Severity: Minor
Found in src/components/input/keyboard_drawer.js - About 1 hr to fix

Function constructor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    scene,
    {
      x, y,
      width=200,
Severity: Minor
Found in src/components/input/multiselect_field.js - About 1 hr to fix

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

  update() {
    if (this.load.progress >= 1) {
      this.scene.start("load")
      this.scene.stop()
    }
Severity: Major
Found in demo/scenes/boot.js and 1 other location - About 1 hr to fix
demo/scenes/load.js 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 58.

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

  update() {
    if (this.load.progress >= 1.0) {
      this.scene.start("run")
      this.scene.stop()
    }
Severity: Major
Found in demo/scenes/load.js and 1 other location - About 1 hr to fix
demo/scenes/boot.js on lines 32..37

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

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

  constructor(scene,
    { 
      x, y,
      width=60,
      height=60,
Severity: Minor
Found in src/components/element.js - About 1 hr to fix

Function selectOption has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  selectOption(optionElement, deactivate=true) {
    this.helpText.setAlpha(0)
    this.selectedOptions.push(optionElement.option)
    let
      testText = this.scene.add.text(0, 0, optionElement.option.value, this.selectedOptionStyles),
Severity: Minor
Found in src/components/input/multiselect_field.js - About 1 hr to fix
Severity
Category
Status
Source
Language