serge-web/serge-web

View on GitHub

Showing 244 of 809 total issues

File set_latest_wargame_message_mock.ts has 1785 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { CHANNEL_CHAT, CHANNEL_CUSTOM, CUSTOM_MESSAGE, FEEDBACK_MESSAGE, PARTICIPANT_CHAT, PARTICIPANT_CUSTOM } from 'src/config'
import { PlayerUi } from 'src/custom-types'

const state: PlayerUi = {
  selectedForce: undefined,

    Function AdminGameSetup has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
    Open

    const AdminGameSetup: React.FC = () => {
      const dispatch = useDispatch()
      const { wargame, messageTypes }: { wargame: WargamesState, messageTypes: MessageTypes } = useSelector(({ wargame, messageTypes }: RootState) => ({ wargame, messageTypes }))
    
      const {
    Severity: Minor
    Found in client/src/Views/GameSetupNew.tsx - About 1 day 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 message-templates.mock.ts has 792 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { TemplateBody } from 'src/custom-types'
    
    const messageTemplatesMock: TemplateBody[] = [
      {
        completed: false,
    Severity: Major
    Found in client/src/mocks/message-templates.mock.ts - About 1 day to fix

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

        const renderContent = (): React.ReactNode => {
          if (!localChannelUpdates) return null
      
          const handleSaveRows = (participants: ParticipantCollab[]): void => {
            const newChannel = { ...localChannelUpdates }

        Function pouchDb has 281 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const pouchDb = (app, io, pouchOptions) => {
          const PouchDB = require('pouchdb-core')
            .plugin(require('pouchdb-adapter-node-websql'))
            .plugin(require('pouchdb-adapter-http'))
            .plugin(require('pouchdb-mapreduce'))
        Severity: Major
        Found in server/providers/pouchdb.js - About 1 day to fix

          File coa-messages.mock.ts has 627 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Function JsonEditor has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
            Open

            export const JsonEditor: React.FC<Props> = ({
              messageId,
              messageContent,
              title,
              template,
            Severity: Minor
            Found in client/src/Components/local/molecules/json-editor/index.tsx - About 1 day 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 MappingPanel has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
            Open

            export const MappingPanel: React.FC<MappingPanelProps> = ({ onClose, features, rendererProps, selected, onSelect, onSave, forceStyles }): React.ReactElement => {
              const [filterredFeatures, setFilterredFeatures] = useState<FeatureCollection<Geometry, GeoJsonProperties> | undefined>(features)
              const [pendingSaveFeatures, setPendingSaveFeatures] = useState<FeatureCollection<Geometry, GeoJsonProperties> | undefined>(features)
              const [openAddFilter, setOpenAddFilter] = useState<boolean>(false)
              const [propertyFiltersListPanel, setPropertyFiltersListPanel] = useState<string[]>([])
            Severity: Minor
            Found in client/src/Components/local/atoms/mapping-panel/index.tsx - About 1 day 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 couchDb has 270 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const couchDb = (app, io, pouchOptions) => {
              const CouchDB = require('pouchdb-core')
              const PouchDB = require('pouchdb-core')
                .plugin(require('pouchdb-adapter-node-websql'))
                .plugin(require('pouchdb-adapter-http'))
            Severity: Major
            Found in server/providers/couchdb.js - About 1 day to fix

              Function AdminGameSetup has 252 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const AdminGameSetup: React.FC = () => {
                const dispatch = useDispatch()
                const { wargame, messageTypes }: { wargame: WargamesState, messageTypes: MessageTypes } = useSelector(({ wargame, messageTypes }: RootState) => ({ wargame, messageTypes }))
              
                const {
              Severity: Major
              Found in client/src/Views/GameSetupNew.tsx - About 1 day to fix

                File index.ts has 581 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable no-unused-vars */
                import { ADJUDICATION_PHASE, allDbs, clearAll, COUNTER_MESSAGE, CUSTOM_MESSAGE, databasePath, FEEDBACK_MESSAGE, hiddenPrefix, INFO_MESSAGE, MSG_STORE, MSG_TYPE_STORE, PLANNING_PHASE, SERGE_INFO, serverPath, wargameSettings, dbDefaultSettings } from 'src/config'
                import { deleteRoleAndParts, duplicateThisForce } from 'src/Helpers'
                import _ from 'lodash'
                import moment from 'moment'
                Severity: Major
                Found in client/src/api/wargames_api/index.ts - About 1 day to fix

                  Function SortableList has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const SortableList: React.FC<PropTypes> = React.forwardRef(({
                    onClick,
                    onChange,
                    items,
                    title = 'Add',
                  Severity: Minor
                  Found in client/src/Components/local/molecules/sortable-list/index.tsx - About 1 day 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 ReactTable has 207 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const ReactTable: React.FC<ReactTableProps> = (props) => {
                    const {
                      columns,
                      rows,
                      showArchived,
                  Severity: Major
                  Found in client/src/Components/local/react-table/index.tsx - About 1 day to fix

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

                      const renderContent = (): React.ReactNode => {
                        if (!localChannelUpdates) return null
                    
                        const handleSaveRows = (participants: ParticipantChat[]): void => {
                          const newChannel = { ...localChannelUpdates }

                      Function CollabChannel has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const CollabChannel: React.FC<CollabChannelProps> = ({
                        channel,
                        forces,
                        messageTemplates,
                        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 renderContent has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const renderContent = (): React.ReactNode => {
                          if (!localChannelUpdates) return null
                      
                          const handleSaveRows = (participants: ParticipantCustom[]): void => {
                            const newChannel = { ...localChannelUpdates }

                        Function genData has 161 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function CustomChannel has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const CustomChannel: React.FC<CustomChannelProps> = ({
                            channel,
                            forces,
                            messageTemplates,
                            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

                          File index.tsx has 422 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { faCircleArrowRight } from '@fortawesome/free-solid-svg-icons'
                          import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
                          import { Box, Button } from '@material-ui/core'
                          import Slide from '@mui/material/Slide'
                          import { Feature, FeatureCollection, GeoJsonProperties, Geometry } from 'geojson'
                          Severity: Minor
                          Found in client/src/Components/local/atoms/core-mapping/index.tsx - About 6 hrs to fix

                            File index.tsx has 422 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { faArrowAltCircleLeft, faWindowMaximize, faWindowMinimize } from '@fortawesome/free-solid-svg-icons'
                            import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
                            import { Checkbox, FormControlLabel } from '@material-ui/core'
                            import { Feature, FeatureCollection, GeoJsonProperties, Geometry } from 'geojson'
                            import { cloneDeep, get, isEqual, merge, set, uniq } from 'lodash'
                            Severity: Minor
                            Found in client/src/Components/local/atoms/mapping-panel/index.tsx - About 6 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language