galarant/domless

View on GitHub

Showing 122 of 124 total issues

Function setOptionsContainer has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  setOptionsContainer() {
    this.optionsContainer.y = this.height / 2 + 5
    this.optionsContainer.height = this.optionRowHeight * this.options.length
    _.forEach(
      this.optionElements,
Severity: Major
Found in src/components/input/dropdown_field.js - About 2 hrs to fix

File text_field.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Phaser from "phaser"
import _ from "lodash"

import TextDisplay from "../display/text_display"
import KeyboardDrawer from "./keyboard_drawer"
Severity: Minor
Found in src/components/input/text_field.js - About 2 hrs to fix

Function deactivate has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  deactivate() {
    if (this.active) {
      console.log("deactivating dropDown ", this.id)
      this.closeTween = this.scene.tweens.timeline(
        {
Severity: Major
Found in src/components/input/dropdown_field.js - About 2 hrs to fix

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

      this.activateTween = this.scene.add.tween(
        {
          targets: this.carat,
          ease: Phaser.Math.Easing.Cubic.InOut,
          duration: this.expandSpeed,
Severity: Major
Found in src/components/input/dropdown_field.js and 1 other location - About 2 hrs to fix
src/components/input/dropdown_field.js on lines 341..350

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

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.activateTween = this.scene.add.tween(
        {
          targets: this.carat,
          ease: Phaser.Math.Easing.Cubic.InOut,
          duration: this.expandSpeed,
Severity: Major
Found in src/components/input/dropdown_field.js and 1 other location - About 2 hrs to fix
src/components/input/dropdown_field.js on lines 432..441

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

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.pushCameraTween = this.scene.add.tween(
        {
          targets: camera,
          ease: Phaser.Math.Easing.Cubic.InOut,
          duration: 250,
Severity: Major
Found in src/components/input/keyboard_drawer.js and 1 other location - About 1 hr to fix
src/components/input/keyboard_drawer.js on lines 91..98

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

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.pushCameraTween = this.scene.add.tween(
      {
        targets: camera,
        ease: Phaser.Math.Easing.Cubic.InOut,
        duration: 100,
Severity: Major
Found in src/components/input/keyboard_drawer.js and 1 other location - About 1 hr to fix
src/components/input/keyboard_drawer.js on lines 120..127

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

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

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

Function initElementComponents has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  initElementComponents(diffObject) {
    
    // don't do anything if I'm not yet initialized
    if (!this.initialized) {
      return
Severity: Minor
Found in src/components/element.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 addPage has 43 lines of code (exceeds 25 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

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

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

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

  previousRow(row) {
    // given a row, gets the previous one in the form
    let rowIndex = _.findIndex(this.rows, f => f.id == row.id)
    let nextRow = this.rows[rowIndex - 1]
    return nextRow
Severity: Major
Found in src/components/input/form.js and 1 other location - About 1 hr to fix
src/components/input/form.js on lines 227..232

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

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

  previousField(field) {
    // given a field, gets the previous one in the form
    let fieldIndex = _.findIndex(this.fields, f => f.id == field.id)
    let nextField = this.fields[fieldIndex - 1]
    return nextField
Severity: Major
Found in src/components/input/form.js and 1 other location - About 1 hr to fix
src/components/input/form.js on lines 189..194

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

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

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

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

  constructor(
    calledFrom,
    {
      key="domlessModal",
      deactivateEvent=key + "Deactivate",
Severity: Minor
Found in src/components/input/input_modal.js - About 1 hr to fix

Function constructor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(
    scene,
    {
      x=scene.game.config.width/2,
      y=scene.game.config.height/2,
Severity: Minor
Found in src/components/input/keyboard.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 initializeKeys has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initializeKeys(keyModeConfig) {
    let keyContainer = this.scene.add.container(0, 0)
    let keyConfigRowCounter = 0
    let keyboard = this
    this.add(keyContainer)
Severity: Minor
Found in src/components/input/keyboard.js - About 1 hr to fix

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

      styles={
        fontSize: 24,
        fontFamily: "Helvetica",
        align: "left",
        padding: {top: 10, left: 10, right: 10, bottom: 10},
Severity: Major
Found in src/components/input/text_field.js and 1 other location - About 1 hr to fix
src/components/display/text_display.js on lines 26..32

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

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

      styles={
        fontSize: 24,
        fontFamily: "Helvetica",
        align: "left",
        padding: {top: 10, left: 10, right: 10, bottom: 10},
Severity: Major
Found in src/components/display/text_display.js and 1 other location - About 1 hr to fix
src/components/input/text_field.js on lines 25..31

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

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

Severity
Category
Status
Source
Language