GeekPark/gpk_account

View on GitHub
frontend/src/components/sessions/PasswordInput.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.state = {
      inputType: 'password',
Severity: Minor
Found in frontend/src/components/sessions/PasswordInput.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 this.refs is deprecated.
Open

      focus(this.refs.input);

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.toggleType}>

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/

Empty components are self-closing
Open

            <i className={`iconfont icon-eye ${this.state.inputType === 'text' ? 'active' : ''}`}></i>

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 "className" is not required, but has no corresponding defaultProp declaration.
Open

  className: PropTypes.string,

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

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

  autofocus: PropTypes.bool,

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

Using string literals in ref attributes is deprecated.
Open

            ref="input" onChange={this.clearTip} minLength="6" autoFocus={this.props.autofocus}

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 string literals in ref attributes is deprecated.
Open

      <Tooltip ref="tip">

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

Using this.refs is deprecated.
Open

      const { tip, input } = this.refs;

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

There are no issues that match your filters.

Category
Status