Showing 244 of 805 total issues
Function EditableRow
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
export const EditableRow: React.FC<PropTypes> = ({
items,
onChange,
actions,
onSave,
- 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 CoreMapping
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
const CoreMapping: React.FC<PropTypes> = ({ messages, channel, playerForce, playerRole, currentTurn, currentPhase, openPanelAsDefault, forceStyles, postBack, panelSize }) => {
const [featureCollection, setFeatureCollection] = useState<FeatureCollection>()
const [renderers, setRenderers] = useState<React.FunctionComponent<CoreRendererProps>[]>([])
const [pendingCreate, setPendingCreate] = useState<PM.ChangeEventHandler | null>(null)
const [checked, setChecked] = useState<boolean>(openPanelAsDefault)
- 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 TurnProgression
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TurnProgression: React.FC<Props> = (props: Props) => {
const {
adjudicationStartTime,
turnEndTime,
timeWarning,
Function GameChannelsWithTour
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
const GameChannelsWithTour: React.FC = () => {
const classes = useStyles()
const dispatch = usePlayerUiDispatch()
const {
selectedForce,
File game-messages-rfi.mock.ts
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { MessageCustom, Role } from 'src/custom-types'
import { CUSTOM_MESSAGE, CollaborativeMessageStates } from 'src/config'
import { forces } from './forces.mock'
const whiteGC: Role = forces[0].roles[0]
Function runServer
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
const runServer = (
pouchOptions,
corsOptions,
imgDir,
port,
Function MessageGroup
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MessageGroup: React.FC<MessageGroupProps> = (props): React.ReactElement => {
const { title, multiple, options, onChange, type, value, onDelete } = props
const getLabel = (val: string): string => {
if (!options || !options.length) return ''
Function ChatChannel
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export const ChatChannel: React.FC<ChatChannelProps> = ({
channel,
forces,
onChange
}) => {
- 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 tabRender
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
const tabRender = (state: PlayerUi): (node: TabNode) => void => {
return (node: TabNode): void => {
setTimeout(() => {
const tabLayout = document.getElementsByClassName('flexlayout__layout')[0]
const tabSetHeaderElms = tabLayout.getElementsByClassName('flexlayout__tabset')
- 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 set_all_messages_mock.ts
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { CHANNEL_CUSTOM, PARTICIPANT_CUSTOM } from 'src/config'
import { PlayerUi } from 'src/custom-types'
const testState: PlayerUi = {
selectedRole: 'CO',
Function ExportForces
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const ExportForces = ({ wargame, savExportItem, loader, exportItems }) => {
document.body.style.cursor = loader ? 'progress' : 'default'
const generateExportItem = () => {
savExportItem({
title: `Export ${new Date().toISOString().slice(0, 19).replace('T', ' ')}`,
- 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 MessageTemplates
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MessageTemplates = () => {
const dispatch = useDispatch()
const { messageTypes, umpireMenu, gameDate } = useSelector(state => state)
const [jsonMessage, setJsonMessage] = useState([])
Function DataTable
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export const DataTable: React.FC<Props> = ({ columns, data, sort, noExpand = false }: Props) => {
const classes = useStyles()
const [filters, setFilters] = useState<Array<string>>([])
const [filtersGroup, setFiltersGroup] = useState({})
const [expandedRows, setExpandedRows] = useState<Array<string>>([])
- 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 collab.tsx
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Divider, TableFooter } from '@material-ui/core'
import Paper from '@material-ui/core/Paper'
import Table from '@material-ui/core/Table'
import TableBody from '@material-ui/core/TableBody'
import TableCell from '@material-ui/core/TableCell'
File messages.js
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
export const messages = [
{
name: 'Force Laydown',
comment: 'After red has laid out its forces',
detail: {
Function genData
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export const genData = (
messages: MessageCustom[],
forces: ForceData[],
role: ForceRole,
templates: TemplateBodysByKey,
- 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 index.stories-inc.tsx
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { withKnobs } from '@storybook/addon-knobs'
import { Feature, FeatureCollection } from 'geojson'
import L from 'leaflet'
import { noop } from 'lodash'
import React, { CSSProperties, useEffect, useState } from 'react'
Function mapEventToFeatures
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mapEventToFeatures = (e: PM.ChangeEventHandler): Feature | null => {
const shapeType = (e as any).shape
const commonProps = {
id: (e as any).layer._leaflet_id,
phase: currentPhase,
Function renderContent
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderContent = (): React.ReactNode => {
const data = forcesData[selectedItem]
if (!data) return null
const handleChangeForce = (force: ForceData): void => {
Function CollapsibleHeader
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
export const CollapsibleHeader: React.FC<PropTypes> = (props) => {
const { children, onClick, onExpand, iconType = COLLASIBLE_DEFAULT_ICON } = props
const collapsed: boolean = typeof props.collapsed === 'undefined' ? true : props.collapsed
const hasContent: boolean = typeof props.hasContent === 'undefined' ? false : props.hasContent
const collapseOnDragHover: boolean = typeof props.collapseOnDragHover === 'undefined' ? false : props.collapseOnDragHover
- 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"