MitrophD/tl-react-numeric-input

View on GitHub

Showing 7 of 22 total issues

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

module.exports = env => {
  const devMode = 'development';
  const mode = env.NODE_ENV || devMode;
  const isDevMode = mode === devMode;
  const entryPath = path.resolve(__dirname, isDevMode ? 'demo' : 'src');
Severity: Major
Found in webpack.config.js - About 5 hrs to fix

    Function Main has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Main = () => {
      const [
        disabledDecimal,
        setDecimalDisabled,
      ] = useState(false);
    Severity: Major
    Found in demo/Main.jsx - About 4 hrs to fix

      File index.jsx has 360 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @flow
      import React from 'react';
      
      type NumVal = string | number;
      type ParseFunc = (NumVal) => number;
      Severity: Minor
      Found in src/index.jsx - About 4 hrs to fix

        Function shouldComponentUpdate has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          shouldComponentUpdate(nextProps: Props) {
            const propsCopy: Object = { ...this.props };
        
            const {
              className,
        Severity: Major
        Found in src/index.jsx - About 3 hrs to fix

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

            shouldComponentUpdate(nextProps: Props) {
              const propsCopy: Object = { ...this.props };
          
              const {
                className,
          Severity: Minor
          Found in src/index.jsx - About 3 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 constructor has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(props: Props, context: null) {
              super(props, context);
              this.propsOnBlur = getEvent(props.onBlur);
              this.propsOnChange = getEvent(props.onChange);
              this.propsOnError = getEvent(props.onError);
          Severity: Minor
          Found in src/index.jsx - About 1 hr to fix

            Function getExtremum has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            const getExtremum = (attr: string, val: ?NumVal, parseFunc: ParseFunc, dDecimal?: boolean) => {
              if (typeof val === 'string' || typeof val === 'number') {
                const pVal = parseFunc(val);
            
                if (Number.isNaN(pVal)) {
            Severity: Minor
            Found in src/index.jsx - About 35 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

            Severity
            Category
            Status
            Source
            Language