serge-web/serge-web

View on GitHub

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[]>([])

Severity: Minor
Found in client/src/Components/local/react-table/helpers/col-filter.tsx - About 1 hr to fix

    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)
    
    
    Severity: Minor
    Found in client/src/Components/Modals/UnsavedForceModal.tsx - About 1 hr to fix

      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) {
      Severity: Minor
      Found in client/static/leaflet/select/leaflet.select.js - About 1 hr 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 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
      
      
      Severity: Minor
      Found in client/static/leaflet/select/leaflet.select.js - About 1 hr 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 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"
        Severity: Minor
        Found in client/src/Components/local/organisms/setting-channels/index.tsx - About 1 hr to fix

          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,
          Severity: Minor
          Found in client/src/Views/ChannelTabsContainer/helpers/DefaultModel.tsx - About 1 hr to fix

            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) {
            Severity: Minor
            Found in client/src/Components/local/atoms/mapping-panel/index.tsx - About 1 hr to fix

              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)
                
                
                Severity: Minor
                Found in client/src/Components/Modals/UnsavedChannelModal.tsx - About 1 hr to fix

                  Function SettingChannels has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const SettingChannels: React.FC<PropTypes> = ({
                    onChange,
                    onSave,
                    onSidebarClick,
                    onCreate,
                  Severity: Minor
                  Found in client/src/Components/local/organisms/setting-channels/index.tsx - About 1 hr 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 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',
                  Severity: Minor
                  Found in client/src/Components/local/molecules/editable-list/index.tsx - About 1 hr 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 NewMessage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const NewMessage: React.FC<PropTypes> = ({
                    templates,
                    channel,
                    privateMessage,
                    orderableChannel,
                  Severity: Minor
                  Found in client/src/Components/local/form-elements/new-message/index.tsx - About 1 hr 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 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 = [],

                  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.
                  Severity: Minor
                  Found in client/src/Components/jsonSchemaEditor/json-schema-editor/editor.js - About 1 hr 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 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>('')
                  Severity: Minor
                  Found in client/src/Components/ChatChannel.tsx - About 1 hr 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 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)
                      
                      
                      Severity: Minor
                      Found in client/src/Components/local/atoms/mapping-panel/index.tsx - About 1 hr to fix

                        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
                          Severity
                          Category
                          Status
                          Source
                          Language