Strilanc/Quirk

View on GitHub
src/ui/DisplayedInspector.js

Summary

Maintainability
C
1 day
Test Coverage

File DisplayedInspector.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
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.
Severity: Minor
Found in src/ui/DisplayedInspector.js - About 3 hrs to fix

    DisplayedInspector has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DisplayedInspector {
        /**
         * @param {!Rect} drawArea
         * @param {!DisplayedCircuit} circuitWidget
         * @param {!DisplayedToolbox} displayedToolboxTop
    Severity: Minor
    Found in src/ui/DisplayedInspector.js - About 2 hrs to fix

      Function _drawHint_useControls has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _drawHint_useControls(painter) {
              let visibilityFactor = this._hintVisibility();
              if (visibilityFactor <= 0) {
                  return;
              }
      Severity: Minor
      Found in src/ui/DisplayedInspector.js - About 1 hr to fix

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

            _drawHint_watchOutputsChange(painter) {
                let visibilityFactor = this._hintVisibility();
                if (visibilityFactor <= 0) {
                    return;
                }
        Severity: Minor
        Found in src/ui/DisplayedInspector.js - About 1 hr to fix

          Function _drawHint_dragGatesOntoCircuit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _drawHint_dragGatesOntoCircuit(painter) {
                  let visibilityFactor = this._hintVisibility();
                  if (visibilityFactor <= 0) {
                      return;
                  }
          Severity: Minor
          Found in src/ui/DisplayedInspector.js - About 1 hr to fix

            Function _hintVisibility has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                _hintVisibility() {
                    if (this.displayedCircuit.circuitDefinition.columns.length > 0) {
                        return 0;
                    }
                    return this.hand.pos === undefined || !this.hand.isBusy() ? 1.0 :
            Severity: Minor
            Found in src/ui/DisplayedInspector.js - About 25 mins 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

            There are no issues that match your filters.

            Category
            Status