serge-web/serge-web

View on GitHub

Showing 244 of 805 total issues

Function EditableRow has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

export const EditableRow: React.FC<PropTypes> = ({
  items,
  onChange,
  actions,
  onSave,
Severity: Minor
Found in client/src/Components/local/molecules/editable-row/index.tsx - About 5 hrs to fix

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 CoreMapping has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

const CoreMapping: React.FC<PropTypes> = ({ messages, channel, playerForce, playerRole, currentTurn, currentPhase, openPanelAsDefault, forceStyles, postBack, panelSize }) => {
  const [featureCollection, setFeatureCollection] = useState<FeatureCollection>()
  const [renderers, setRenderers] = useState<React.FunctionComponent<CoreRendererProps>[]>([])
  const [pendingCreate, setPendingCreate] = useState<PM.ChangeEventHandler | null>(null)
  const [checked, setChecked] = useState<boolean>(openPanelAsDefault)
Severity: Minor
Found in client/src/Components/local/atoms/core-mapping/index.tsx - About 5 hrs to fix

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 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const TurnProgression: React.FC<Props> = (props: Props) => {
  const {
    adjudicationStartTime,
    turnEndTime,
    timeWarning,
Severity: Major
Found in client/src/Components/local/molecules/turn-progression/index.tsx - About 5 hrs to fix

    Function GameChannelsWithTour has 145 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const GameChannelsWithTour: React.FC = () => {
      const classes = useStyles()
      const dispatch = usePlayerUiDispatch()
      const {
        selectedForce,
    Severity: Major
    Found in client/src/Views/GameChannelsWithTour.tsx - About 5 hrs to fix

      File game-messages-rfi.mock.ts has 405 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { MessageCustom, Role } from 'src/custom-types'
      import { CUSTOM_MESSAGE, CollaborativeMessageStates } from 'src/config'
      import { forces } from './forces.mock'
      
      const whiteGC: Role = forces[0].roles[0]
      Severity: Minor
      Found in client/src/mocks/game-messages-rfi.mock.ts - About 5 hrs to fix

        Function runServer has 133 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const runServer = (
          pouchOptions,
          corsOptions,
          imgDir,
          port,
        Severity: Major
        Found in server/server.js - About 5 hrs to fix

          Function MessageGroup has 133 lines of code (exceeds 25 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 ''

            Function ChatChannel has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

            export const ChatChannel: React.FC<ChatChannelProps> = ({
              channel,
              forces,
              onChange
            }) => {

            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 tabRender has a Cognitive Complexity of 35 (exceeds 5 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')
            Severity: Minor
            Found in client/src/Views/ChannelTabsContainer/helpers/tabRender.tsx - About 5 hrs to fix

            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 set_all_messages_mock.ts has 379 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { CHANNEL_CUSTOM, PARTICIPANT_CUSTOM } from 'src/config'
            import { PlayerUi } from 'src/custom-types'
            
            const testState: PlayerUi = {
              selectedRole: 'CO',

              Function ExportForces has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

              const ExportForces = ({ wargame, savExportItem, loader, exportItems }) => {
                document.body.style.cursor = loader ? 'progress' : 'default'
                const generateExportItem = () => {
                  savExportItem({
                    title: `Export ${new Date().toISOString().slice(0, 19).replace('T', ' ')}`,
              Severity: Minor
              Found in client/src/Views/ExportForces.jsx - About 5 hrs to fix

              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 126 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const MessageTemplates = () => {
                const dispatch = useDispatch()
                const { messageTypes, umpireMenu, gameDate } = useSelector(state => state)
                const [jsonMessage, setJsonMessage] = useState([])
              
              
              Severity: Major
              Found in client/src/Views/MessageTemplates.jsx - About 5 hrs to fix

                Function DataTable has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                export const DataTable: React.FC<Props> = ({ columns, data, sort, noExpand = false }: Props) => {
                  const classes = useStyles()
                  const [filters, setFilters] = useState<Array<string>>([])
                  const [filtersGroup, setFiltersGroup] = useState({})
                  const [expandedRows, setExpandedRows] = useState<Array<string>>([])
                Severity: Minor
                Found in client/src/Components/local/organisms/data-table/index.tsx - About 4 hrs to fix

                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 collab.tsx has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Divider, TableFooter } from '@material-ui/core'
                import Paper from '@material-ui/core/Paper'
                import Table from '@material-ui/core/Table'
                import TableBody from '@material-ui/core/TableBody'
                import TableCell from '@material-ui/core/TableCell'

                  File messages.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  export const messages = [
                    {
                      name: 'Force Laydown',
                      comment: 'After red has laid out its forces',
                      detail: {
                  Severity: Minor
                  Found in client/public/messages.js - About 4 hrs to fix

                    Function genData has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const genData = (
                      messages: MessageCustom[],
                      forces: ForceData[],
                      role: ForceRole,
                      templates: TemplateBodysByKey,
                    Severity: Minor
                    Found in client/src/Components/local/collab-status-board/helpers/gen-data.tsx - About 4 hrs to fix

                    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 index.stories-inc.tsx has 360 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { withKnobs } from '@storybook/addon-knobs'
                    import { Feature, FeatureCollection } from 'geojson'
                    import L from 'leaflet'
                    import { noop } from 'lodash'
                    import React, { CSSProperties, useEffect, useState } from 'react'
                    Severity: Minor
                    Found in client/src/Components/local/atoms/core-mapping/index.stories-inc.tsx - About 4 hrs to fix

                      Function mapEventToFeatures has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const mapEventToFeatures = (e: PM.ChangeEventHandler): Feature | null => {
                          const shapeType = (e as any).shape
                          const commonProps = {
                            id: (e as any).layer._leaflet_id,
                            phase: currentPhase,
                      Severity: Major
                      Found in client/src/Components/local/atoms/core-mapping/index.tsx - About 4 hrs to fix

                        Function renderContent has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const renderContent = (): React.ReactNode => {
                            const data = forcesData[selectedItem]
                            if (!data) return null
                        
                            const handleChangeForce = (force: ForceData): void => {
                        Severity: Major
                        Found in client/src/Components/local/organisms/setting-forces/index.tsx - About 3 hrs to fix

                          Function CollapsibleHeader has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const CollapsibleHeader: React.FC<PropTypes> = (props) => {
                            const { children, onClick, onExpand, iconType = COLLASIBLE_DEFAULT_ICON } = props
                            const collapsed: boolean = typeof props.collapsed === 'undefined' ? true : props.collapsed
                            const hasContent: boolean = typeof props.hasContent === 'undefined' ? false : props.hasContent
                            const collapseOnDragHover: boolean = typeof props.collapseOnDragHover === 'undefined' ? false : props.collapseOnDragHover

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language