dappros/ethora

View on GitHub

Showing 502 of 8,855 total issues

Function ChatContainer has 1064 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ChatContainer = observer((props: ChatContainerProps) => {
  //props
  const {
    containerType,
    roomDetails,
Severity: Major
Found in client-reactnative/src/components/Chat/ChatContainer.tsx - About 5 days to fix

File Tnc.tsx has 1866 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import "./Tnc.scss";

type TProps = {
Severity: Major
Found in client-web/src/pages/Signon/Tnc.tsx - About 5 days to fix

Function ChatInRoom has 696 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function ChatInRoom() {
  const messages = useStoreState((state) => state.historyMessages);
  const user = useStoreState((store) => store.user);
  const userChatRooms = useStoreState((store) => store.userChatRooms);
  const currentThreadViewMessage = useStoreState(
Severity: Major
Found in client-web/src/pages/ChatInRoom/Chat.tsx - About 3 days to fix

File ChatContainer.tsx has 1260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {useCallback, useEffect, useRef, useState} from 'react';
import {Actions, GiftedChat, Send} from 'react-native-gifted-chat';
import {AudioSendButton} from './AudioSendButton';
import {
  ActivityIndicator,
Severity: Major
Found in client-reactnative/src/components/Chat/ChatContainer.tsx - About 3 days to fix

File chatStore.ts has 1090 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//@ts-ignore
import {client, xml} from '@xmpp/client';
import {makeAutoObservable, runInAction, toJS} from 'mobx';
import {
  defaultChatBackgroundTheme,
Severity: Major
Found in client-reactnative/src/stores/chatStore.ts - About 2 days to fix

Function getTnc has 537 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getTnc(
  company: string,
  fname: string,
  lname: string,
  email: string,
Severity: Major
Found in client-web/src/pages/Signon/OwnerRegistrationModal.tsx - About 2 days to fix

File ChatExperimental.tsx has 1004 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {observer} from 'mobx-react-lite';
import React, {useEffect, useRef, useState} from 'react';
import {GiftedChat, Send, Actions} from 'react-native-gifted-chat';
import {useStores} from '../../stores/context';
import {
Severity: Major
Found in client-reactnative/src/Screens/Chat/ChatExperimental.tsx - About 2 days to fix

File stanzas.ts has 935 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {xml} from '@xmpp/client';
import {ApiStore} from '../stores/apiStore';
import {XMPP_TYPES} from './xmppConstants';
const store = new ApiStore();

Severity: Major
Found in client-reactnative/src/xmpp/stanzas.ts - About 2 days to fix

File xmpp.ts has 798 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import xmpp, { xml } from "@xmpp/client";
import { Client } from "@xmpp/client";
import { CONFERENCEDOMAIN, DOMAIN, SERVICE } from "./constants";
import { useStoreState } from "./store";
import { walletToUsername } from "./utils/walletManipulation";
Severity: Major
Found in client-web/src/xmpp.ts - About 1 day to fix

File Chat.tsx has 794 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {
  useCallback,
  useEffect,
  useMemo,
  useRef,
Severity: Major
Found in client-web/src/pages/ChatInRoom/Chat.tsx - About 1 day to fix

Function UploadDocumentsScreen has 374 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UploadDocumentsScreen = (props: MintScreenProps) => {
  const {loginStore, walletStore, apiStore, debugStore} = useStores();
  const navigation = useNavigation();

  const [itemName, setItemName] = useState<string>('');
Severity: Major
Found in client-reactnative/src/Screens/UploadDocumentsScreen.tsx - About 1 day to fix

Function MintScreen has 368 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MintScreen = (props: MintScreenProps) => {
  const {loginStore, walletStore, apiStore} = useStores();
  const navigation = useNavigation();

  const [itemName, setItemName] = useState<string>('');
Severity: Major
Found in client-reactnative/src/Screens/MintScreen.tsx - About 1 day to fix

Function ProfileScreen has 367 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ProfileScreen = observer(() => {
  const {loginStore, walletStore, chatStore, apiStore} = useStores();

  const navigation = useNavigation();

Severity: Major
Found in client-reactnative/src/Screens/Profile/ProfileScreen.tsx - About 1 day to fix

File OwnerRegistrationModal.tsx has 769 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useState } from "react";
import Dialog from "@mui/material/Dialog";
import DialogTitle from "@mui/material/DialogTitle";
import Box from "@mui/material/Box";
import IconButton from "@mui/material/IconButton";
Severity: Major
Found in client-web/src/pages/Signon/OwnerRegistrationModal.tsx - About 1 day to fix

Function _useStore has 356 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      immer((set, get) => {
        return {
          user: {
            firstName: "",
            lastName: "",
Severity: Major
Found in client-web/src/store/index.ts - About 1 day to fix

Function Bubble has 351 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Bubble = observer((props: BubbleProps) => {
  const {chatStore} = useStores();
  const [width, setWidth] = useState(0);
  const initialAnimationValue = new Animated.Value(0);

Severity: Major
Found in client-reactnative/src/components/Chat/MessageBubble.tsx - About 1 day to fix

Function ChatScreen has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
Open

const ChatScreen = observer(({route, navigation}: any) => {
  const {loginStore, chatStore, walletStore, apiStore, debugStore} =
    useStores();

  const {firstName, lastName, walletAddress} = loginStore.initialData;
Severity: Minor
Found in client-reactnative/src/Screens/Chat/ChatExperimental.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 StatisticsPage has 329 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function StatisticsPage() {
  const [value, setValue] = React.useState(0);
  const [apiCount, setApiCount] = React.useState();
  const [sessionsCount, setSessionsCount] = React.useState();
  const [transactionCount, setTransactionCount] = React.useState();
Severity: Major
Found in client-web/src/pages/Statistics/index.tsx - About 1 day to fix

File config.ts has 691 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Master switches

/*
START SCREEN switch.
This specifies which screen is going to be the default one for Users. See options below.
Severity: Major
Found in client-reactnative/docs/config.ts - About 1 day to fix

Function ChatContainer has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

const ChatContainer = observer((props: ChatContainerProps) => {
  //props
  const {
    containerType,
    roomDetails,
Severity: Minor
Found in client-reactnative/src/components/Chat/ChatContainer.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

Severity
Category
Status
Source
Language