NoHomey/react-material-ui-keyboard

View on GitHub
src/Keyboard.tsx

Summary

Maintainability
F
4 days
Test Coverage

Function render has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public render(): JSX.Element {
        const { props, state, context } = this;
        const { textField, layouts, keyboardKeyHeight, keyboardKeyWidth, keyboardKeySymbolSize, automatic, correctorName, disableEffects } = props;
        const { value, layout: stateLayout, capsLock } = state;
        const { muiTheme } = context;
Severity: Minor
Found in src/Keyboard.tsx - 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 Keyboard.tsx has 442 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as React from 'react';
import * as PropTypes from 'prop-types';
import bind from 'bind-decorator';
import Dialog from 'material-ui/Dialog';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
Severity: Minor
Found in src/Keyboard.tsx - About 6 hrs to fix

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

        public render(): JSX.Element {
            const { props, state, context } = this;
            const { textField, layouts, keyboardKeyHeight, keyboardKeyWidth, keyboardKeySymbolSize, automatic, correctorName, disableEffects } = props;
            const { value, layout: stateLayout, capsLock } = state;
            const { muiTheme } = context;
    Severity: Major
    Found in src/Keyboard.tsx - About 5 hrs to fix

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

          public shouldComponentUpdate(props: KeyboardProps, state: KeyboardState): boolean {
              const { textField } = props;
              const { textField: thisTextField } = this.props;
              if(this.state.value !== state.value) {
                  return constants.boolTrue;
      Severity: Minor
      Found in src/Keyboard.tsx - 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 shouldComponentUpdate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public shouldComponentUpdate(props: KeyboardProps, state: KeyboardState): boolean {
              const { textField } = props;
              const { textField: thisTextField } = this.props;
              if(this.state.value !== state.value) {
                  return constants.boolTrue;
      Severity: Major
      Found in src/Keyboard.tsx - About 2 hrs to fix

        Function componentDidUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public componentDidUpdate(props: KeyboardProps, state: KeyboardState): void {
                const { automatic } = this.props;
                const open: boolean = automatic ? this.state.open! : this.props.open!;
                const prev: boolean = automatic ? state.open! : props.open!;
                if(open !== prev) {
        Severity: Minor
        Found in src/Keyboard.tsx - About 55 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

        Avoid too many return statements within this function.
        Open

                    return constants.boolTrue;
        Severity: Major
        Found in src/Keyboard.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return constants.boolTrue;
          Severity: Major
          Found in src/Keyboard.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return constants.boolTrue;
            Severity: Major
            Found in src/Keyboard.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return constants.boolTrue;
              Severity: Major
              Found in src/Keyboard.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return constants.boolTrue;
                Severity: Major
                Found in src/Keyboard.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return constants.boolTrue;
                  Severity: Major
                  Found in src/Keyboard.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return constants.boolTrue;
                    Severity: Major
                    Found in src/Keyboard.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return constants.boolTrue;
                      Severity: Major
                      Found in src/Keyboard.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return constants.boolTrue;
                        Severity: Major
                        Found in src/Keyboard.tsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return constants.boolTrue;
                          Severity: Major
                          Found in src/Keyboard.tsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return constants.boolTrue;
                            Severity: Major
                            Found in src/Keyboard.tsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return constants.boolFalse;
                              Severity: Major
                              Found in src/Keyboard.tsx - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return constants.boolTrue;
                                Severity: Major
                                Found in src/Keyboard.tsx - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return constants.boolTrue;
                                  Severity: Major
                                  Found in src/Keyboard.tsx - About 30 mins to fix

                                    There are no issues that match your filters.

                                    Category
                                    Status