GeekPark/gpk_account

View on GitHub
frontend/src/components/share/VerifyCode.jsx

Summary

Maintainability
A
25 mins
Test Coverage

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

  constructor() {
    super();

    this.getValue = () => {
      const v = this.refs.input.value;
Severity: Minor
Found in frontend/src/components/share/VerifyCode.jsx - 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

Using string literals in ref attributes is deprecated.
Open

      <Tooltip className="form-group mb-input" ref="tip">

For more information visit Source: http://eslint.org/docs/rules/

'className' PropType is defined but prop is never used
Open

  className: PropTypes.string,

For more information visit Source: http://eslint.org/docs/rules/

Using this.refs is deprecated.
Open

      const tip = this.refs.tip;

For more information visit Source: http://eslint.org/docs/rules/

Prop type object is forbidden
Open

  verify_code: PropTypes.object.isRequired,

For more information visit Source: http://eslint.org/docs/rules/

Visible, non-interactive elements should not have mouse or keyboard event listeners
Open

          <div className="form-side" onClick={this.getCode}>

For more information visit Source: http://eslint.org/docs/rules/

Using this.refs is deprecated.
Open

    this.clearTip = () => this.refs.tip.clear();

For more information visit Source: http://eslint.org/docs/rules/

propType "isEmail" is not required, but has no corresponding defaultProp declaration.
Open

  isEmail: PropTypes.bool,

For more information visit Source: http://eslint.org/docs/rules/

Absolute imports should come before relative imports.
Open

import intl from 'react-intl-universal';

For more information visit Source: http://eslint.org/docs/rules/

Using string literals in ref attributes is deprecated.
Open

            type="text" ref="input" onChange={this.clearTip}

For more information visit Source: http://eslint.org/docs/rules/

propType "className" is not required, but has no corresponding defaultProp declaration.
Open

  className: PropTypes.string,

For more information visit Source: http://eslint.org/docs/rules/

Using this.refs is deprecated.
Open

      const v = this.refs.input.value;

For more information visit Source: http://eslint.org/docs/rules/

Using this.refs is deprecated.
Open

    this.postErr = msg => this.refs.tip.postErr(msg);

For more information visit Source: http://eslint.org/docs/rules/

There are no issues that match your filters.

Category
Status