onebeyond/react-form-builder

View on GitHub

Showing 34 of 233 total issues

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

const QuestionTextarea = ({ question }) => {
  const {
    register,
    formState: { errors }
  } = useFormContext()
Severity: Minor
Found in src/Questions/Textarea/index.js - 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

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

const QuestionPhone = ({ isMobile, isoCode, question, useForm, ...props }) => {
  const {
    formState: { errors },
    clearErrors,
    setError,
Severity: Minor
Found in src/Questions/Phone/index.js - 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

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

const QuestionGender = ({ question, useForm, language, ...props }) => {
  const {
    formState: { errors },
    control,
    trigger,
Severity: Minor
Found in src/Questions/Genre/index.js - 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 QuestionCountry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const QuestionCountry = ({
  component,
  question,
  useForm,
  countryAndRegionsData,
Severity: Minor
Found in src/Questions/Country/index.js - 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

Consider simplifying this complex logical expression.
Open

    if (
      theme &&
      theme.forms &&
      theme.forms.select &&
      theme.forms.select[property]
Severity: Major
Found in src/Fields/AsyncReactSelect/index.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

        if (
          theme &&
          theme.forms &&
          theme.forms.select &&
          theme.forms.select[property]
    Severity: Major
    Found in src/Fields/Select/index.js - About 40 mins to fix

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

      const Markdown = React.forwardRef(({ modalLabel, ...props }, ref) => {
        const MarkDownLink = ({ href, children }) => {
          const modalName = href.startsWith('#') && href.toString().substr(1)
          return (
            <Link
      Severity: Minor
      Found in src/Fields/Markdown/index.js - 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 buildCountryOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const buildCountryOptions = (config, language) => {
        const priorityOptions = config?.priorityOptions || []
        const whitelist = config?.whitelist || []
        const blacklist = config?.blacklist || []
        const flag = config?.flag || false
      Severity: Minor
      Found in src/Questions/CountryV2/index.js - 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

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

      const DropdownIndicator = (props) => {
        const { menuIsOpen, arrows } = props.selectProps
      
        if (arrows && (arrows.up || arrows.down)) {
          const { up, down, width, height } = arrows
      Severity: Minor
      Found in src/Fields/Select/index.js - 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

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

      const Phone = ({
        control,
        setError,
        clearErrors,
        defaultCountry,
      Severity: Minor
      Found in src/Fields/Phone/index.js - 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

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

      const QuestionAge = ({ question, useForm, language, ...props }) => {
        const {
          formState: { errors },
          setValue,
          trigger,
      Severity: Minor
      Found in src/Questions/Age/index.js - 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

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

      const QuestionCounty = ({ question, useForm, ...props }) => {
        const {
          formState: { errors },
          trigger,
          control,
      Severity: Minor
      Found in src/Questions/County/index.js - 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

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

      const QuestionCountrySubdivision = ({
        question,
        ...props
      }) => {
        const {
      Severity: Minor
      Found in src/Questions/CountrySubdivision/index.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

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

      const QuestionCountryV2 = ({
        question,
        language,
        ...props
      }) => {
      Severity: Minor
      Found in src/Questions/CountryV2/index.js - 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

      Severity
      Category
      Status
      Source
      Language