Showing 244 of 805 total issues
Function UnsavedChannelModal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const UnsavedChannelModal: React.FC = () => {
const dispatch = useDispatch()
const wargame = useSelector((state: RootState) => state.wargame)
const currentModal = useSelector((state: RootState) => state.currentModal)
- 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 MilSymbolRenderer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const MilSymbolRenderer: React.FC<CoreRendererProps> = ({ features, onDragged, onRemoved, onSelect, showLabels, selected = [] }): any => {
const { filterFeatureIds, isMeasuring } = useMappingState()
const filter = (feature: Feature<Geometry, any>): boolean => feature.properties._type === RENDERER_MILSYM && filterFeatureIds.includes('' + feature.properties.id)
const pointToLayer = (feature: Feature<Point, any>, latLng: L.LatLng) => {
- 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
Avoid too many return
statements within this function. Open
return that.createStrItem(pair)
Avoid too many return
statements within this function. Open
return []
Avoid too many return
statements within this function. Open
if (moment(pair[1], moment.ISO_8601, true).isValid()) return that.createTimeItem(pair)
Avoid too many return
statements within this function. Open
return (
<Fragment key={`${pair[0]}-${pair[1]}`}>
<h3>{pair[0]}</h3>
<span>{pair[1]}</span>
</Fragment>
Avoid too many return
statements within this function. Open
return true
Avoid too many return
statements within this function. Open
return {
type: 'Feature',
properties: props,
geometry: {
coordinates: polygon.coordinates,
Avoid too many return
statements within this function. Open
return <></>
Avoid too many return
statements within this function. Open
return null
Function actionsFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const actionsFor = (actionTable: ActionTable, state: States, permission: Permission, isOwner?: boolean): Action[] => {
const forState: ActionList = actionTable[state]
if (state === States.InProgress) {
// special handling. We only offer save/submit if it's the owner
if (isOwner) {
- 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 lightOrDark
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const lightOrDark = (color: string): 'light' | 'dark' => {
let r: any, g: any, b: any
// Check the format of the color, HEX or RGB?
if (color.match(/^rgb/)) {
// If HEX --> store the red, green, blue values in separate variables
- 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 Template
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Template: Story<TurnPropTypes> = (args) => {
const { ...props } = args
const [state, setState] = useState({
phase: props.phase,
currentTurn: args.currentTurn,
- 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 StatusBar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const StatusBar: React.FC<PropTypes> = ({
onChange,
onSave,
wargame: initialWargame
}) => {
- 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 getChannelTitlesFromInfoTypeMessages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getChannelTitlesFromInfoTypeMessages = (messages: MessageInfoType[]): ChannelTitles => {
const channelTitles: ChannelTitles = {}
for (const { data } of messages) {
for (const channel of data.channels.channels) {
const { name, uniqid } = channel
- 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 AdminLogin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const AdminLogin: React.FC<Props> = ({ onSubmit }: Props) => {
// (temporarily) put password in box, to make testing quicker in dev
const providePassword = true
const [password, setPassword] = useState(providePassword ? DEFAULT_SERVER : '')
const gameInfo = useSelector((state: RootState) => state.gameInfo)
- 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 filteredMessages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const filteredMessages = (messages: MessageCustom[], showArchived: boolean): MessageCustom[] => {
return messages.filter(msg => {
if (showArchived) {
// ok - show all messages
return true
- 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 convertMilliseconds
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const convertMilliseconds = (milliseconds: number, type: string): string => {
if (milliseconds === null) return ''
let hours, minutes, seconds, days
seconds = Math.floor(milliseconds / 1000)
- 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 ChannelTabsContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ChannelTabsContainer: React.FC<Props> = ({ rootRef, onTabChange }): React.ReactElement => {
const [allowTabChangeEvent, setAllowTabChangeEvent] = useState<boolean>(false)
const [wargamesLoaded, setWargamesLoaded] = useState(false)
const selectedNode = useRef<FlexLayout.TabNode>()
- 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 getColumns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getColumns = (message: MessageCustom, columns: SpecialChannelColumns[]): string[][] => {
const msg = message.message
const res = columns.map((column: SpecialChannelColumns): string[] => {
switch (column) {
case SpecialChannelColumns.LOCATION: {
- 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"