galarant/domless

View on GitHub

Showing 52 of 124 total issues

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

  constructor(
    scene,
    {
      x=scene.game.config.width/2,
      y=scene.game.config.height/2,
Severity: Major
Found in src/components/input/keyboard.js - About 1 day to fix

File dropdown_field.js has 400 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from "lodash"

import Element from "src/components/element"
import Button from "src/components/input/button"

Severity: Minor
Found in src/components/input/dropdown_field.js - About 5 hrs to fix

File keyboard.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Phaser from "phaser"
import Button from "./button"
import _ from "lodash"

/**
Severity: Minor
Found in src/components/input/keyboard.js - About 4 hrs to fix

Function create has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  create() {

    //set up cursor keys
    this.cursors = this.input.keyboard.createCursorKeys()

Severity: Major
Found in demo/scenes/run.js - About 3 hrs to fix

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

  constructor(
    scene,
    {
      edge="bottom",
      size=300,
Severity: Major
Found in src/components/display/drawer.js - About 3 hrs to fix

Function initTextDisplayComponents has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initTextDisplayComponents(diffObject, diffOld) {

    // don't do anything if I'm not yet initialized
    if (!this.initialized) {
      return
Severity: Major
Found in src/components/display/text_display.js - About 3 hrs to fix

Function initDropDownComponents has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initDropDownComponents(diffObject, diffOld) {

    // don't do anything if I'm not yet initialized
    if (!this.initialized) {
      return
Severity: Major
Found in src/components/input/dropdown_field.js - About 2 hrs to fix

Function initDropDownComponents has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  initDropDownComponents(diffObject, diffOld) {

    // don't do anything if I'm not yet initialized
    if (!this.initialized) {
      return
Severity: Minor
Found in src/components/input/dropdown_field.js - About 2 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 activate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  activate() {
    if (!this.active) {
      console.log("activating dropDown ", this.id)
      this.scene.children.bringToTop(this)
      if (this.formRow) {
Severity: Major
Found in src/components/input/dropdown_field.js - About 2 hrs to fix

Function initTextDisplayComponents has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  initTextDisplayComponents(diffObject, diffOld) {

    // don't do anything if I'm not yet initialized
    if (!this.initialized) {
      return
Severity: Minor
Found in src/components/display/text_display.js - About 2 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 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

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

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

Severity
Category
Status
Source
Language