serge-web/serge-web

View on GitHub

Showing 252 of 825 total issues

Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    return (
      <Card>
        <CardHeader>
          Boolean options
Severity: Minor
Found in client/src/Components/jsonSchemaEditor/options.js - About 1 hr to fix

    Function createOrUpdateChannelUI has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const createOrUpdateChannelUI = (
      channel: ChannelTypes,
      forceId: string | undefined,
      selectedRole: Role['roleId'],
      isObserver: boolean,
    Severity: Minor
    Found in client/src/Helpers/handle-channel-updates.ts - About 1 hr to fix

      Function InsightsModal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const InsightsModal: React.FC = () => {
        const state = usePlayerUiState()
        const dispatch = usePlayerUiDispatch()
        const { selectedForce, currentTurn } = state
        if (selectedForce === undefined) throw new Error('selectedForce is undefined')
      Severity: Minor
      Found in client/src/Components/Modals/InsightsModal.tsx - About 1 hr to fix

        Function handleAllInitialChannelMessages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const handleAllInitialChannelMessages = (
          payload: Array<MessageInfoType | MessageCustom>,
          currentWargame: string,
          selectedForce: ForceData | undefined,
          selectedRole: Role['roleId'],
        Severity: Minor
        Found in client/src/Helpers/handle-channel-updates.ts - About 1 hr to fix

          Function Collapsible has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const Collapsible: React.FC<PropTypes> = ({
            children,
            onClick,
            openByDefault = false,
            collapseOnDragHover = false,
          Severity: Minor
          Found in client/src/Components/local/helper-elements/collapsible/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 RenderContent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const RenderContent: FC<ContentProps> = ({ setWargameMenuOpen, scrollPos, game, onGameClick, wargameMenuOpen, menuConfig }): React.ReactElement => {
            const optionMenuRef = useRef(null)
            const gameTitleRef = useRef(null)
          
            const gameTitleProps = {

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

          const findAndCopy = async (file, path, prefix, finalDir) => {
            return new Promise((resolve, reject) => {
              find.file(file, path, (files) => {
                if (files.length) {
                  console.log(`${prefix} file "${file}" was founded`)
          Severity: Minor
          Found in executable/helpers/pkhCopyCrossPlatforms.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 MessageTemplates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const MessageTemplates = () => {
            const dispatch = useDispatch()
            const { messageTypes, umpireMenu, gameDate } = useSelector(state => state)
            const [jsonMessage, setJsonMessage] = useState([])
          
          
          Severity: Minor
          Found in client/src/Views/MessageTemplates.jsx - 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 ChannelMessage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const ChannelMessage: React.FC<Props> = (props: Props) => {
            const CollapsibleHeader = ({ onExpand, collapsed }: any): React.ReactElement => {
              const { onRead, onUnread, message } = props
          
              const title = messageTitleFor(message)
          Severity: Minor
          Found in client/src/Components/local/molecules/channel-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 TurnProgression has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const TurnProgression: React.FC<Props> = (props: Props) => {
            const {
              adjudicationStartTime,
              turnEndTime,
              timeWarning,
          Severity: Minor
          Found in client/src/Components/local/molecules/turn-progression/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 ImageDropzone has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const ImageDropzone: React.FC<PropTypes> = ({
            title,
            onChange,
            onRejected,
            limit,
          Severity: Minor
          Found in client/src/Components/local/atoms/image-dropzone/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 getIDs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const getIDs = (message: MessageChannel): string => {
            let res
            const generalMessage = message as any as Message
            const isNotMapping = !(generalMessage.messageType === MAPPING_MESSAGE || generalMessage.messageType === MAPPING_MESSAGE_DELTA)
            const customMessage = message as any as MessageCustom
          Severity: Minor
          Found in client/src/Helpers/most-recent-only.ts - 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 renderSwitchItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const renderSwitchItem = (item: SwitchItem, itemKey: number): React.ReactNode => {
              const isEditMode = mode === 'edit'
          
              const useStyles = makeStyles(() => createStyles({
                root: {
          Severity: Minor
          Found in client/src/Components/local/molecules/editable-row/index.tsx - About 1 hr to fix

            Function renderChannelContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const renderChannelContent = useMemo(() => {
                const channelType = (selectedChannelState && selectedChannelState.channelType)
                switch (channelType) {
                  case CHANNEL_COLLAB:
                    return <CollabChannel
            Severity: Minor
            Found in client/src/Components/local/organisms/setting-channels/index.tsx - About 1 hr to fix

              Function CollapsibleContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const CollapsibleContent: React.FC<PropTypes> = (props) => {
                const { children, onClick } = props
                // str.replace is not a function: es default values (for boolean) not works with storybook
                // define default values
                const useIndent: boolean | number = typeof props.useIndent === 'undefined' ? true : props.useIndent

                Function retryUntilWritten has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const retryUntilWritten = (db, doc) => {
                      return db.get(doc._id).then((origDoc) => {
                        doc._rev = origDoc._rev
                        return db.put(doc).then(async (result) => {
                          doc._id = result.id
                Severity: Minor
                Found in server/providers/pouchdb.js - About 1 hr to fix

                  Function updateMessageInDb has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const updateMessageInDb = (id, message) => {
                    return new Promise((resolve, reject) => {
                      (async () => {
                        const allMessages = await getAllMessagesFromDb()
                        const matchedName = allMessages.find((el) => el.details.title === message.title && el._id !== id)
                  Severity: Minor
                  Found in client/src/api/messages_api.js - About 1 hr to fix

                    Function Default has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Default: React.FC = () => {
                      const [items, setItems] = useState<Array<Item>>([{ name: 'list item 1' }, { name: 'list item 2' }])
                    
                      const handleClick = (item: Item): void => {
                        console.log('selected item:', item)

                      Function retryUntilWritten has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const retryUntilWritten = (db, doc) => {
                            return db.get(doc._id).then((origDoc) => {
                              doc._rev = origDoc._rev
                              return db.put(doc).then(async (result) => {
                                doc._id = result.id
                      Severity: Minor
                      Found in server/providers/couchdb.js - About 1 hr to fix

                        Function updateMessageInDb has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const updateMessageInDb = (schema, id) => {
                          return new Promise((resolve, reject) => {
                            (async () => {
                              const allMessages = await getAllMessagesFromDb()
                        
                        
                        Severity: Minor
                        Found in client/src/api/messageTypes_api.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language