Showing 252 of 825 total issues
Function ColFilter
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ColFilter: React.FC<ColFilterProps> = (props) => {
const { onClose, open, anchorEl, filters, onFilterChanged, colName } = props
const { menuItem } = useStyles()
const [localFilter, setLocalFilter] = useState<CellFilter[]>([])
Function UnsavedForceModal
has 44 lines of code (exceeds 25 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)
Function _isSelected
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_isSelected(item) {
const sel = this.state.selected
if (sel) {
if (this._isGroup(item)) {
if ('children' in item) {
- 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 initialize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
initialize(options) {
this.menus = []
L.Util.setOptions(this, options)
const opts = this.options
- 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 toMasked
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const toMasked = (turnTime: GameTurnLength): string => {
if (turnTime) {
// we need to do this twice, so refactor to function
const fromMillis = (millis: number): string => {
let days, hours, minutes, seconds
Function renderChannelActions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderChannelActions = useMemo(() => {
return <div className={styles.actions}>
<ButtonGroup
variant="contained"
color="secondary"
Function setDefaultModel
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setDefaultModel = (allChannels: ChannelTypes[]) => {
const hasMap = allChannels.find(({ name }) => name.toLowerCase() === 'mapping')
const setTabContent = (channel: ChannelTypes) => ({
type: 'tab',
id: channel.uniqid,
Function features
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
cloneFeature.features = cloneFeature.features.filter((f) => {
const orFoundKey: {[x: string]: boolean} = {}
Object.keys(selectedFiltersProps).forEach((filterKey) => {
const value = selectedFiltersProps[filterKey].value
if (filterKey === wildcardLabel) {
Function Template
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Template: StoryFn<RFIPropTypes> = (args) => {
const { isObserver, message, isUmpire, permission, state, channelColb, role } = args
const [messageState, setMessageState] = useState<MessageCustom>(message)
const [roleState, setRoleState] = useState<ForceRole | undefined>(undefined)
const [msgStatus, setMsgStatus] = useState<CollaborativeMessageStates>(state || CollaborativeMessageStates.Unallocated)
Function UnsavedChannelModal
has 40 lines of code (exceeds 25 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)
Function SettingChannels
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const SettingChannels: React.FC<PropTypes> = ({
onChange,
onSave,
onSidebarClick,
onCreate,
- 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 EditableList
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const EditableList: React.FC<PropTypes> = ({
onClick,
items,
title = 'Add',
qaType = 'add',
- 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 NewMessage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const NewMessage: React.FC<PropTypes> = ({
templates,
channel,
privateMessage,
orderableChannel,
- 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 getSelectedOptions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const getSelectedOptions = (type: string, messageLocal: MessagesValues, channelData?: ChannelTypes): Option[] => {
const collabChannel = channelData as unknown as ChannelCollab
const {
requestChangesVerbs = [],
approveVerbs = [],
- 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 updateSchema
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
SchemaEditor.prototype.updateSchema = function (schema) {
this.destroy()
// Add extra validation logic for integer Schemas that use the `range` format.
// For integer Schemas that use the `range` format we require that minimum and maximum properties are set, too.
- 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 ChatChannel
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const ChatChannel: React.FC<{ channelId: string, isCustomChannel?: boolean }> = ({ channelId, isCustomChannel }) => {
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 Default
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Default: React.FC = () => {
const Wrapper = (): React.ReactElement => {
const forcesMock = watuWargame.data.forces.forces[0]
const initialState = { types: forcesMock.roles }
Function Implementation
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Implementation: React.FC = () => {
const [visible, setVisible] = useState(false)
const force = {
color: '#2b900f',
name: 'Green',
Function handlePanelState
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handlePanelState = (panelName: 'filterPanelState' | 'itemPanelState' | 'propertyPanelState', state: boolean) => {
const clonePanelState = cloneDeep(panelState)
set(clonePanelState, `${panelName}.state`, state)
setPanelState(clonePanelState)
Function handleCurrentWargamePlayer
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handleCurrentWargamePlayer = (newState: PlayerUi, payload: Wargame, state: PlayerUi): void => {
const { data, name, wargameTitle, wargameInitiated, gameTurn, phase, adjudicationStartTime, turnEndTime } = payload
const overview = data.overview
// Helper function to convert string to enum