Showing 252 of 825 total issues
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
return (
<Card>
<CardHeader>
Boolean options
Function createOrUpdateChannelUI
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createOrUpdateChannelUI = (
channel: ChannelTypes,
forceId: string | undefined,
selectedRole: Role['roleId'],
isObserver: boolean,
Function InsightsModal
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const InsightsModal: React.FC = () => {
const state = usePlayerUiState()
const dispatch = usePlayerUiDispatch()
const { selectedForce, currentTurn } = state
if (selectedForce === undefined) throw new Error('selectedForce is undefined')
Function handleAllInitialChannelMessages
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handleAllInitialChannelMessages = (
payload: Array<MessageInfoType | MessageCustom>,
currentWargame: string,
selectedForce: ForceData | undefined,
selectedRole: Role['roleId'],
Function Collapsible
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const Collapsible: React.FC<PropTypes> = ({
children,
onClick,
openByDefault = false,
collapseOnDragHover = 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 RenderContent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const RenderContent: FC<ContentProps> = ({ setWargameMenuOpen, scrollPos, game, onGameClick, wargameMenuOpen, menuConfig }): React.ReactElement => {
const optionMenuRef = useRef(null)
const gameTitleRef = useRef(null)
const gameTitleProps = {
- 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 findAndCopy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const findAndCopy = async (file, path, prefix, finalDir) => {
return new Promise((resolve, reject) => {
find.file(file, path, (files) => {
if (files.length) {
console.log(`${prefix} file "${file}" was founded`)
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const MessageTemplates = () => {
const dispatch = useDispatch()
const { messageTypes, umpireMenu, gameDate } = useSelector(state => state)
const [jsonMessage, setJsonMessage] = 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 ChannelMessage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const ChannelMessage: React.FC<Props> = (props: Props) => {
const CollapsibleHeader = ({ onExpand, collapsed }: any): React.ReactElement => {
const { onRead, onUnread, message } = props
const title = messageTitleFor(message)
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const TurnProgression: React.FC<Props> = (props: Props) => {
const {
adjudicationStartTime,
turnEndTime,
timeWarning,
- 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 ImageDropzone
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const ImageDropzone: React.FC<PropTypes> = ({
title,
onChange,
onRejected,
limit,
- 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 getIDs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const getIDs = (message: MessageChannel): string => {
let res
const generalMessage = message as any as Message
const isNotMapping = !(generalMessage.messageType === MAPPING_MESSAGE || generalMessage.messageType === MAPPING_MESSAGE_DELTA)
const customMessage = message as any as MessageCustom
- 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 renderSwitchItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderSwitchItem = (item: SwitchItem, itemKey: number): React.ReactNode => {
const isEditMode = mode === 'edit'
const useStyles = makeStyles(() => createStyles({
root: {
Function renderChannelContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderChannelContent = useMemo(() => {
const channelType = (selectedChannelState && selectedChannelState.channelType)
switch (channelType) {
case CHANNEL_COLLAB:
return <CollabChannel
Function CollapsibleContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CollapsibleContent: React.FC<PropTypes> = (props) => {
const { children, onClick } = props
// str.replace is not a function: es default values (for boolean) not works with storybook
// define default values
const useIndent: boolean | number = typeof props.useIndent === 'undefined' ? true : props.useIndent
Function retryUntilWritten
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const retryUntilWritten = (db, doc) => {
return db.get(doc._id).then((origDoc) => {
doc._rev = origDoc._rev
return db.put(doc).then(async (result) => {
doc._id = result.id
Function updateMessageInDb
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const updateMessageInDb = (id, message) => {
return new Promise((resolve, reject) => {
(async () => {
const allMessages = await getAllMessagesFromDb()
const matchedName = allMessages.find((el) => el.details.title === message.title && el._id !== id)
Function Default
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Default: React.FC = () => {
const [items, setItems] = useState<Array<Item>>([{ name: 'list item 1' }, { name: 'list item 2' }])
const handleClick = (item: Item): void => {
console.log('selected item:', item)
Function retryUntilWritten
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const retryUntilWritten = (db, doc) => {
return db.get(doc._id).then((origDoc) => {
doc._rev = origDoc._rev
return db.put(doc).then(async (result) => {
doc._id = result.id
Function updateMessageInDb
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const updateMessageInDb = (schema, id) => {
return new Promise((resolve, reject) => {
(async () => {
const allMessages = await getAllMessagesFromDb()