concord-consortium/rigse

View on GitHub
rails/react-components/src/library/components/signup/text_input.tsx

Summary

Maintainability
A
3 hrs
Test Coverage

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

  render () {
    const { type, placeholder, disabled, name } = this.props;

    let className = "text-input " + this.props.name;
    if (this.props.showRequired && !this.props.isPristine) {
Severity: Minor
Found in rails/react-components/src/library/components/signup/text_input.tsx - About 1 hr to fix

    Function convertValidationsToObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const convertValidationsToObject = (validations: any) => {
      if (typeof validations === "string") {
        return validations.split(/,(?![^{[]*[}\]])/g).reduce((validationsAccumulator, validation) => {
          let args = validation.split(":");
          const validateMethod = args.shift() as string;
    Severity: Minor
    Found in rails/react-components/src/library/components/signup/text_input.tsx - About 45 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

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

    const TextInputWithAsyncValidationSupport = (props: any) => {
      const { asyncValidation, asyncValidationError, validations, ...innerProps } = props;
      const [asyncValidationPassed, setAsyncValidationPassed] = useState(true);
    
      // eslint-disable-next-line react-hooks/exhaustive-deps
    Severity: Minor
    Found in rails/react-components/src/library/components/signup/text_input.tsx - 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

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

      render () {
        const { type, placeholder, disabled, name } = this.props;
    
        let className = "text-input " + this.props.name;
        if (this.props.showRequired && !this.props.isPristine) {
    Severity: Minor
    Found in rails/react-components/src/library/components/signup/text_input.tsx - 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

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

      onChange (event: any) {
        const cursor = event.target.selectionStart;
        let newVal = event.currentTarget.value;
        const delay = this.props.isValidValue(newVal) ? 0 : TIMEOUT;
    
    
    Severity: Minor
    Found in rails/react-components/src/library/components/signup/text_input.tsx - 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

    There are no issues that match your filters.

    Category
    Status