Showing 56 of 274 total issues
Function RichInputElement
has a Cognitive Complexity of 241 (exceeds 5 allowed). Consider refactoring. Open
const RichInputElement = ({ richText = '',
listUsers: listAllUsers,
setChosenUsers = ()=>{},
onSubmit ,
onClose,
- 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 RichInputElement.test.js
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import { render, fireEvent , screen } from '@testing-library/react';
import RichInputElement from "../UI/rich-text/RichInputElement";
import Cursor from "../UI/rich-text/cursor";
import RichText from "../UI/rich-text/rich-text"
Function handleKeyDown
has 216 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleKeyDown = event => {
event.preventDefault()
const selectedValue = window.getSelection().toString();
const text = element.textContent
const cursorPos = Cursor.getCurrentCursorPosition(element, initCoordinates)
Function getCurrentCursorPosition
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
static getCurrentCursorPosition(parentElement, initCoord = {x: 0, y: 0}) {
if(window.getSelection()) {
const selection = window.getSelection()
let charCount = -1
let focusNode = null
- 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 RichInputElement.js
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useRef, useState} from 'react';
import Cursor from "../rich-text/cursor";
import DropDownList from "./DropDownList";
import {userFullName} from "../../helpers/library";
import RichText from "./rich-text";
Function MemeSelection
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const MemeSelection = ({data, setData, saveDataToDb, steps, service, isCustomGif, setIsCustomGif, draft}) => {
const {emotion, api_giphy_key, response} = data
const navigate = useNavigate()
const {isLoading, error} = service
const [gifUrl, setGifUrl] = useState(response.attributes.gif || {})
- 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 Results
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const Results = ({data, setData, steps = data.response.attributes.steps || [], draft = true}) => {
const [loaded, setLoaded] = useState(false)
const [results, setResults] = useState( {})
const {answers, emotions, fun_question, gifs, sent_shoutouts, received_shoutouts,
current_user_shoutouts, responses_count, received_and_public_shoutouts, prev_results_path} = results
- 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 _createRange
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static _createRange(node, chars, range) {
if (!range) {
range = document.createRange()
range.selectNode(node);
range.setStart(node, 0);
- 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 App
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
const App = () => {
const mainPage = 'emotion-selection-web'
const [error, setError] = useState('')
const [frontDatabase, setFrontDatabase] = useState(initDB)
const [isLoading, setIsLoading] = useState(false)
Function getCurrentCursorPosition
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getCurrentCursorPosition(parentElement, initCoord = {x: 0, y: 0}) {
if(window.getSelection()) {
const selection = window.getSelection()
let charCount = -1
let focusNode = null
RichText
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export default class RichText {
static filtrationById = ( separatorArr, mainArr ) => {
if ( !separatorArr?.length ) {return mainArr}
return mainArr.filter(item=> !separatorArr.some(({ id }) => id === item.id))
Function IcebreakerAnswer
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const IcebreakerAnswer = ({data, setData, saveDataToDb, steps, service, draft}) => {
const {isLoading, error} = service
const [loaded, setLoaded] = useState(false)
const [prevStateAnswer, setPrevStateAnswer] = useState( {})
const [answerFunQuestion, setAnswerFunQuestion] = useState( {})
- 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 EmotionIndex
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const EmotionIndex = ({ teams, nextTimePeriod, isMinUsersResponses }) => {
function getDataForTeam(team) {
const emotionData = {
name: team.name,
- 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 ResultsManager
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const ResultsManager = ({data, setData, steps = data.response.attributes.steps || [], draft = true}) => {
const [loaded, setLoaded] = useState(false)
const [results, setResults] = useState( {})
const {emotions, responses_count, teams, prev_results_path} = results
const {time_periods, time_period, current_user} = data
- 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 ModalOverlay
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ModalOverlay = () =>{
const idEditText = isEmpty(editObj) ? null : editObj.id
const submitHandling = ({richText, chosenUsers, isPublic}) => {
const dataSend = {
Function NavigationBar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const NavigationBar = ({timePeriod, showPrevTimePeriod, showNextTimePeriod, time_periods, prevTimePeriod,
nextTimePeriod, steps, emotions, data, setShowWorkingModal, setData}) => {
if(isEmpty(time_periods)) return null;
const notWorking = data.response.attributes.not_working
- 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 ShoutoutModal
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const ShoutoutModal = ({ onClose, data, setData: setDataInDB, editObj = {} }) => {
const [isNotAlert, setIsNotAlert] = useState(true)
const [errorMessage, setErrorMessage] = useState("")
const [richText, setRichText] = useState(isEmpty(editObj) ? '' : editObj.rich_text)
- 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 EmotionIntensity
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const EmotionIntensity = ({data, setData, saveDataToDb, steps, service, draft}) => {
const {isLoading, error} = service
const { word, category } = data.emotion
const gif_url = data.response.attributes.gif?.src
const [rating, setRating] = useState(data.response.attributes.rating || null);
- 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 ListItem
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ListItem = ( props ) => {
const ref = useRef(null);
useEffect(() => {
if (props.focus) {
ref.current?.focus();
Function IcebreakerQuestion
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const IcebreakerQuestion = ({data, setData, saveDataToDb, steps, service, draft}) => {
const {isLoading, error} = service
const [loaded, setLoaded] = useState(false)
const [prevStateQuestion, setPrevStateQuestion] = useState({})
const [funQuestion, setFunQuestion] = useState( {})
- 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"