tsg-ut/mnemo

View on GitHub

Showing 70 of 724 total issues

File board-component.jsx has 780 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const React = require('react');
const PropTypes = require('prop-types');
const {default: Hammer} = require('react-hammerjs');
const {INPUT_MOVE, INPUT_END} = (typeof window === 'undefined') ? {} : require('hammerjs');
const {default: Measure} = require('react-measure');
Severity: Major
Found in lib/board-component.jsx - About 1 day to fix

    Function step has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

        step() {
            this.inputExists = false;
    
            switch (this.config.type) {
                case 'empty': {
    Severity: Minor
    Found in lib/block.js - About 1 day 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

    File block-configs.js has 549 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const util = require('./util');
    
    module.exports = {
        empty: {
            type: 'empty',
    Severity: Major
    Found in lib/block-configs.js - About 1 day to fix

      File stages.js has 509 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-env node, mocha */
      /* eslint no-unused-expressions: 'off' */
      
      const chai = require('chai');
      const chaiHttp = require('chai-http');
      Severity: Major
      Found in api/test/routes/stages.js - About 1 day to fix

        File stage.js has 469 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* global ga */
        
        const $ = require('jquery');
        const assert = require('assert');
        const React = require('react');
        Severity: Minor
        Found in lib/stage.js - About 7 hrs to fix

          BoardComponent has 48 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class BoardComponent extends React.Component {
              static propTypes = {
                  status: PropTypes.string.isRequired,
                  width: PropTypes.number.isRequired,
                  height: PropTypes.number.isRequired,
          Severity: Minor
          Found in lib/board-component.jsx - About 6 hrs to fix

            Function render has 153 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                render() {
                    return (
                        <Hammer
                            onPan={this.handlePan}
                            onPanStart={this.handlePan}
            Severity: Major
            Found in lib/board-component.jsx - About 6 hrs to fix

              Function step has 151 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  step() {
                      this.inputExists = false;
              
                      switch (this.config.type) {
                          case 'empty': {
              Severity: Major
              Found in lib/block.js - About 6 hrs to fix

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

                    constructor({config, onClickExit}) {
                        this.config = Object.assign({}, config);
                        this.onClickExit = onClickExit;
                
                        this.caseIndex = 0;
                Severity: Major
                Found in lib/stage.js - About 4 hrs to fix

                  Function validateSubmission has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports.validateSubmission = (submission) => {
                      if (typeof submission.stage !== 'string') {
                          return {pass: false, message: 'stage data is missing'};
                      }
                  
                  
                  Severity: Major
                  Found in lib/validator.js - About 4 hrs to fix

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

                        constructor(props, state) {
                            super(props, state);
                    
                            this.dataAnimationResolvers = new WeakMap();
                    
                    
                    Severity: Major
                    Found in lib/block-component.jsx - About 4 hrs to fix

                      Function ioGenerator has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          ioGenerator: (random) => {
                              const iterations = (n) => (
                                  10000 % (n - 1) === 0 ? n - 1 : 10000 % (n - 1)
                              );
                      
                      
                      Severity: Major
                      Found in stages/10000th-digit.js - About 3 hrs to fix

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

                        class Stage {
                            constructor({config, onClickExit}) {
                                this.config = Object.assign({}, config);
                                this.onClickExit = onClickExit;
                        
                        
                        Severity: Minor
                        Found in lib/stage.js - About 2 hrs to fix

                          Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = (config) => {
                              config.set({
                                  basePath: '',
                                  frameworks: ['mocha'],
                                  files: [
                          Severity: Major
                          Found in karma.conf.js - About 2 hrs to fix

                            Function render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                render() {
                                    return (
                                        <g transform={`translate(${this.props.x}, ${this.props.y})`}>
                                            <rect
                                                width="150"
                            Severity: Major
                            Found in lib/io-component.jsx - About 2 hrs to fix

                              Function render has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  render() {
                                      return (
                                          <g>
                                              {/* click event capture */}
                                              <rect
                              Severity: Major
                              Found in lib/block-component.jsx - About 2 hrs to fix

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

                                    constructor(configs) {
                                        this.configs = configs;
                                        this.$stage = $('.stage');
                                        this.stageIndex = 0;
                                        this.stagePrototype = this.$stage.clone();
                                Severity: Major
                                Found in lib/game.js - About 2 hrs to fix

                                  File board.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  const Block = require('./block');
                                  const Data = require('./data');
                                  const blockConfigs = require('./block-configs');
                                  const {nop} = require('./util');
                                  const EventEmitter = require('events');
                                  Severity: Minor
                                  Found in lib/board.js - About 2 hrs to fix

                                    Board has 21 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class Board extends EventEmitter {
                                        constructor(config) {
                                            super();
                                    
                                            this.height = config.height;
                                    Severity: Minor
                                    Found in lib/board.js - About 2 hrs to fix

                                      Function run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          run(inputValue) {
                                              this.input(inputValue);
                                      
                                              const clockUp = () => {
                                                  while (true) {
                                      Severity: Minor
                                      Found in lib/board.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language