Showing 34 of 233 total issues
File countryAndCounties.js
has 4585 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default [
{
cn: 'Andorra',
cs: 'AD',
regions: [
File countryAndRegion.js
has 1247 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default [
{
cn: 'Afghanistan',
cs: 'AF',
value: 'afghanistan'
Function QuestionsMap
has 188 lines of code (exceeds 25 allowed). Consider refactoring. Open
const QuestionsMap = (question) => {
return {
box: (
<div
sx={{ variant: 'forms.boxContainer' }}
File builder.js
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** @jsxRuntime classic */
/** @jsx jsx */
import React, { useEffect, useRef, useState } from 'react'
import { jsx } from 'theme-ui'
import { useForm, FormProvider } from 'react-hook-form'
File fr.js
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default [
{ cn: 'Afghanistan', cs: 'AF', value: 'afghanistan' },
{ cn: 'Afrique du Sud', cs: 'ZA', value: 'south africa' },
{ cn: 'Albanie', cs: 'AL', value: 'albania' },
{ cn: 'Algérie', cs: 'DZ', value: 'algeria' },
File de.js
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default [
{ cn: 'Afghanistan', cs: 'AF', value: 'afghanistan' },
{ cn: 'Ägypten', cs: 'EG', value: 'egypt' },
{ cn: 'Åland', cs: 'AX', value: 'åland islands' },
{ cn: 'Albanien', cs: 'AL', value: 'albania' },
File es.js
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default [
{ cn: 'Afganistán', cs: 'AF', value: 'afghanistan' },
{ cn: 'Åland', cs: 'AX', value: 'åland islands' },
{ cn: 'Albania', cs: 'AL', value: 'albania' },
{ cn: 'Alemania', cs: 'DE', value: 'germany' },
File input.stories.js
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react'
import Input from './'
export default {
title: 'Question/Input',
Function QuestionSelectImage
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const QuestionSelectImage = ({ component, form, question, useForm }) => {
const {
getValues,
formState: { errors },
register,
- Read upRead up
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 CountriesForm
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CountriesForm = () => {
const [modalText, setModalText] = useState('')
const [show, setShow] = useState(false)
const [isLoading, setLoading] = useState(false)
const [formErrors, setFormErrors] = useState()
Function FormBuilder
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const FormBuilder = ({
onSubmit: onSubmitForm,
currentPath,
isLoading,
form,
- Read upRead up
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
File country.test.js
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react'
import {
cleanup,
getByText,
screen,
Function Contact
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Contact = () => {
const [modalText, setModalText] = useState('')
const [show, setShow] = useState(false)
const [isLoading, setLoading] = useState(false)
const [formErrors, setFormErrors] = useState()
Consider simplifying this complex logical expression. Open
if (arrows && (arrows.up || arrows.down)) {
const { up, down, width, height } = arrows
return (
<components.DropdownIndicator {...props}>
Function ConditionalQuestion
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ConditionalQuestion(question, name, preQuestionType) {
return (dependentQuestion, i) => {
const nestedQuestion = dependentQuestion && dependentQuestion.question
const getConditions = () =>
Function CountrySubdivisionsForm
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CountrySubdivisionsForm = () => {
const [modalText, setModalText] = useState('')
const [show, setShow] = useState(false)
const [isLoading, setLoading] = useState(false)
const [formErrors, setFormErrors] = useState()
Function disableOthers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const disableOthers = (e) => {
Object.entries(e.target.form).forEach(([, v]) => {
if (e.target.checked === true) {
if (v.type === 'checkbox' && v.name === e.target.name && v !== e.target) {
v.checked = false
- Read upRead up
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 35 lines of code (exceeds 25 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
Function QuestionAutocomplete
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const QuestionAutocomplete = ({ question, useForm }) => {
const {
formState: { errors },
defaultValue,
control,
- Read upRead up
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 buildCountrySubdivisonOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const buildCountrySubdivisonOptions = (config, selectedCountryCode) => {
const priorityOptions = config.priorityOptions?.[selectedCountryCode] || []
const whitelist = config.whitelist?.[selectedCountryCode] || []
const blacklist = config.blacklist?.[selectedCountryCode] || []
const valueType = config.valueType