src/ui/DisplayedInspector.js
File DisplayedInspector.js
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DisplayedInspector
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class DisplayedInspector {
/**
* @param {!Rect} drawArea
* @param {!DisplayedCircuit} circuitWidget
* @param {!DisplayedToolbox} displayedToolboxTop
Function _drawHint_useControls
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_drawHint_useControls(painter) {
let visibilityFactor = this._hintVisibility();
if (visibilityFactor <= 0) {
return;
}
Function _drawHint_watchOutputsChange
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_drawHint_watchOutputsChange(painter) {
let visibilityFactor = this._hintVisibility();
if (visibilityFactor <= 0) {
return;
}
Function _drawHint_dragGatesOntoCircuit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_drawHint_dragGatesOntoCircuit(painter) {
let visibilityFactor = this._hintVisibility();
if (visibilityFactor <= 0) {
return;
}
Function _hintVisibility
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
_hintVisibility() {
if (this.displayedCircuit.circuitDefinition.columns.length > 0) {
return 0;
}
return this.hand.pos === undefined || !this.hand.isBusy() ? 1.0 :
- 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"