File player-state.ts
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import PlayerStats from './player-stats'
import {
MISSED,
Function _judgeNote
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
_judgeNote(note: GameNote) {
let delta = this._gameTime - note.time
let judgment = judgeTime(this._gameTime, note.time, this._judge)
let result = this._noteResult.get(note)
const isDown = !result || result.status === 'unjudged'
- Read upRead up
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 _judgeColumn
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
_judgeColumn(buffer: NoteBuffer, control: Control, column: string) {
let judgedNote
let judgment
const notes = buffer.notes
let autoPlayed = false
- Read upRead up
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 _judgeNote
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
_judgeNote(note: GameNote) {
let delta = this._gameTime - note.time
let judgment = judgeTime(this._gameTime, note.time, this._judge)
let result = this._noteResult.get(note)
const isDown = !result || result.status === 'unjudged'
Function _shouldJudge
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_shouldJudge(note: GameNote, control: Control, buffer: NoteBuffer) {
const status = this.getNoteStatus(note)
if (status === 'unjudged') {
if (this._shouldAutoplay() && this._gameTime >= note.time) {
this.tainted = true
- Read upRead up
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 _judgeColumn
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_judgeColumn(buffer: NoteBuffer, control: Control, column: string) {
let judgedNote
let judgment
const notes = buffer.notes
let autoPlayed = false
Function _shouldJudge
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_shouldJudge(note: GameNote, control: Control, buffer: NoteBuffer) {
const status = this.getNoteStatus(note)
if (status === 'unjudged') {
if (this._shouldAutoplay() && this._gameTime >= note.time) {
this.tainted = true
Function _updateSpeed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_updateSpeed() {
if (this.getPlayerInput('speedup').justPressed) {
this._modifySpeed(+1)
}
if (this.getPlayerInput('speeddown').justPressed) {
- Read upRead up
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 false