Showing 244 of 805 total issues
File wargames_ActionCreators.ts
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as ActionConstant from 'src/config'
import 'whatwg-fetch'
import _ from 'lodash'
import * as wargamesApi from '../../api/wargames_api'
Function SettingOverview
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export const SettingOverview: React.FC<PropTypes> = ({
overview: initialOverview, onSave, onChange,
initiateWargame, wargameInitiated, ignoreFlatpickrSnapshot
}) => {
const [overview, setOverview] = useState<WargameOverview>(initialOverview)
- 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 populateDb
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const populateDb = () => {
const promises = []
return new Promise((resolve, reject) => {
db.allDocs().then(entries => {
File index.tsx
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { faCheck } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { Checkbox, FormControlLabel, Input } from '@material-ui/core'
import FormControl from '@material-ui/core/FormControl'
import MenuItem from '@material-ui/core/MenuItem'
Function RfiForm
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const RfiForm: React.FC<Props> = (props) => {
const classes = useStyles()
const { message } = props
const formReducers = (state: ActionPayload, action: Action): ActionPayload => {
switch (action.type) {
Function CollabMessageDetail
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const CollabMessageDetail: React.FC<Props> = ({
templates, message, state, onChange, isObserver, isUmpire,
role, channelColb, permission, assignees = [], collapseMe, gameDate, onRead, isReaded
}) => {
const [answer, setAnswer] = useState<{ [property: string]: any }>((message.details.collaboration && message.details.collaboration.response) || {})
- 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 TableHeadCell
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TableHeadCell = (props: Props): (React.ReactElement | null) => {
const [open, setOpen] = useState<boolean>(false)
const buttonRef = useRef(null)
const { content, id, filters, onFilter, sort, onSort, sortingColId, sortDirection = 'asc' } = props
const contentFilter = content as ContentFilterType
Function toMasked
has a Cognitive Complexity of 24 (exceeds 5 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
- 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 handle-channel-updates.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { CHANNEL_CHAT, CHANNEL_COLLAB, CHAT_CHANNEL_ID, CUSTOM_MESSAGE, expiredStorage, INFO_MESSAGE, INFO_MESSAGE_CLIPPED } from 'src/config'
import {
ChannelTypes, ChannelUI, ForceData, MessageChannel,
MessageCustom, MessageInfoType, MessageInfoTypeClipped, PlayerMessage, PlayerMessageLog, PlayerUiChannels, PlayerUiChatChannel, Role, SetWargameMessage, TemplateBodysByKey
} from 'src/custom-types'
Function genPlayerLogDataTable
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const genPlayerLogDataTable = (rows: PlayerLogModal[]): PlayerLogDataTable => {
const sortCol = (str1: string | React.ReactElement, str2: string | React.ReactElement): number => {
if (!str1 || !str2) {
return 1
}
Function ReactTable
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const ReactTable: React.FC<ReactTableProps> = (props) => {
const {
columns,
rows,
showArchived,
- 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 webpackFinal
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
webpackFinal: async config => {
config.module.rules.push(
{
test: /\.(js|jsx)$/,
loader: require.resolve('babel-loader'),
Function tabRender
has 76 lines of code (exceeds 25 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')
Function renderItems
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderItems = items.map((item, key) => {
let uniqid: React.ReactText = key
let value = item
const isNumber = typeof item === 'number'
if (typeof item === 'object') {
Function echelonMobilityTowedarray
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
const echelonMobilityTowedarray = (symbolset: string) => {
if (symbolset == '10') {
return [
{ code: '00', name: 'Unspecified', sidc: '10031000000000000000' },
{ code: '11', name: 'Team/Crew', sidc: '10031000110000000000' },
Function exportDataGroupedGetRowsAndFields
has a Cognitive Complexity of 21 (exceeds 5 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)
- 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 CoreRenderer
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const CoreRenderer: React.FC<CoreRendererProps> = ({ features, onDragged, onRemoved, onEdited, onSelect, forceStyles, selected = [] }) => {
const { filterFeatureIds, isMeasuring } = useMappingState()
const filter = (feature: Feature<Geometry, any>): boolean => feature.properties._type === RENDERER_CORE && filterFeatureIds.includes('' + feature.properties.id)
const style: StyleFunction<any> = (feature?: Feature<any>): PathOptions => {
if (feature) {
- 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 DeleteModal
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const DeleteModal: 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 genPlayerLogDataTable
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const genPlayerLogDataTable = (rows: PlayerLogModal[]): PlayerLogDataTable => {
const sortCol = (str1: string | React.ReactElement, str2: string | React.ReactElement): number => {
if (!str1 || !str2) {
return 1
}
- 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 pouchdb.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
const listeners = {}
let addListenersQueue = []
let wargameName = ''
const { wargameSettings, INFO_MESSAGE, dbSuffix, settings, CUSTOM_MESSAGE, databaseUrlPrefix } = require('../consts')