Showing 252 of 825 total issues
Function deleteRoleAndParts
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deleteRoleAndParts = (wargame: WargameData, roles: Role[], key: number): WargameData | [WargameData, Role[]] => {
const res: WargameData = deepCopy(wargame)
// start off by deleting the role
const roleToDelete = roles[key].roleId
Function _emit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_emit(action, data) {
const newState = {}
switch (action) {
case 'ITEM_SELECT':
Function collapsible
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const collapsible = (): React.ReactElement => {
// if expanded && message haven't readed status set it as readed
const handleRead = (): void => {
onMessageRead && onMessageRead(message)
}
Function AdminMessage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const AdminMessage: React.FC<PropTypes> = ({ message, roleId }: PropTypes) => {
const msgRef = useRef<HTMLDivElement | null>(null)
if (message.messageType === CUSTOM_MESSAGE) {
const { details } = 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 isType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const isType = (childs: React.ReactNodeArray | undefined, type: string, hasContent = false): boolean => {
return (childs || []).findIndex((ch) => {
if (typeof ch === 'object') {
const chEl = ch as ChildInt
const res = chEl.type.displayName === type
- 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 MessageGroup
has a Cognitive Complexity of 11 (exceeds 5 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 ''
- 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 CollabChannel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const CollabChannel: React.FC<{ channelId: string }> = ({ channelId }) => {
const state = usePlayerUiState()
const playerUiDispatch = usePlayerUiDispatch()
const dispatch = useDispatch()
const [channelTabClass, setChannelTabClass] = useState<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
Function GameChannelsWithTour
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const GameChannelsWithTour: React.FC = () => {
const classes = useStyles()
const dispatch = usePlayerUiDispatch()
const {
selectedForce,
- 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 UnsavedForceModal
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const UnsavedForceModal: React.FC = () => {
const dispatch = useDispatch()
const currentModal = useSelector((state: RootState) => state.currentModal)
const wargame = useSelector((state: RootState) => state.wargame)
- 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 PropertiesPanel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const PropertiesPanel: React.FC<ProppertiesPanelProps> = ({ selectedProp, onPropertiesChange, onRemoveFilter, checkSidc, disableIdEdit, rendererProps, multipleSelect, disabled = false }) => {
const [isSIDCDialogOpen, setSIDCDialogOpen] = useState(false)
const openSIDCGenerator = () => setSIDCDialogOpen(true)
const closeSIDCGenerator = () => setSIDCDialogOpen(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 data
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
data: rfiData.map((row: any, rowIndex: number): RowWithCollapsibleType => {
const [id, channel, role, forceColor, content, status, owner] = row
const statusColors = {
Unallocated: '#B10303',
'In progress': '#E7740A',
Function Template
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Template: StoryFn<TurnPropTypes> = (args) => {
const { ...props } = args
const [state, setState] = useState({
phase: props.phase,
currentTurn: args.currentTurn,
Function _toggleMeasure
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_toggleMeasure: function () {
this._choice = !this._choice
this._clickedLatLong = null
this._clickedPoints = []
this._totalLength = 0
Function _toggleMeasure
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_toggleMeasure: function () {
this._choice = !this._choice
this._clickedLatLong = null
this._clickedPoints = []
this._totalLength = 0
Function convertMilliseconds
has 30 lines of code (exceeds 25 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)
Function DeleteModal
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DeleteModal: React.FC = (): JSX.Element => {
const dispatch = useDispatch()
const currentModal = useSelector((state: RootState) => state.currentModal)
const messages = useSelector((state: RootState) => state.messages)
const umpireMenu = useSelector((state: RootState) => state.umpireMenu)
Function SchemaEditor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SchemaEditor (elementId) {
Editor.call(this, elementId)
// Check whether the node is a properties button for an object,
// and not for the schema of an object named properties
Function getSelectedValue
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getSelectedValue = (type: string, channelData?: ChannelTypes): string[] => {
const collabChannel = channelData as unknown as ChannelCollab
const {
newMessageTemplate = { _id: '' },
responseTemplate = { _id: '' },
Function exportDataGroupedGetRowsAndFields
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const exportDataGroupedGetRowsAndFields = (messages: Message[], message: Message, channelTitles: ChannelTitles) :ExportDataGroupedGetRowsAndFields => {
const messagesFiltered: Message[] = message.messageType === CUSTOM_MESSAGE
? messages.filter(msg => msg.messageType === CUSTOM_MESSAGE && (message as MessageCustom).templateId === (msg as MessageCustom).templateId)
: messages.filter(({ messageType }) => message.messageType === messageType)
Function duplicateWargame
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const duplicateWargame = (dbPath: string): Promise<WargameRevision[]> => {
const dbName = getNameFromPath(dbPath)
const { db } = getWargameDbByName(dbName)
const uniqId = uniqid.time()
const newDbName = `wargame-${uniqId}`