dappros/ethora

View on GitHub

Showing 502 of 8,855 total issues

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

const ChatDetailsScreen = observer(({route}: any) => {
  const {chatStore, loginStore, apiStore} = useStores();
  const currentRoomDetail = chatStore.getRoomDetails(
    route.params.roomJID,
  ) as roomListProps;
Severity: Minor
Found in client-reactnative/src/Screens/Chat/ChatDetailsScreen.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 AccountScreen has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AccountScreen = observer(() => {
  const {loginStore, accountStore} = useStores();

  const {userAvatar, initialData, userDescription, userToken} = loginStore;

Severity: Major
Found in client-reactnative/src/Screens/Account/AccountScreen.tsx - About 5 hrs to fix

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

const NewChat: React.FC<INewChat> = ({}) => {
  const theme = useTheme();
  const user = useStoreState((state) => state.user);
  const { showSnackbar } = useSnackbar();
  const [loading, setLoading] = useState(false);
Severity: Major
Found in client-web/src/pages/NewChat/NewChat.tsx - About 5 hrs to fix

File ProfileScreen.tsx has 404 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
Copyright 2019-2021 (c) Dappros Ltd, registered in England & Wales, registration number 11455432. All rights reserved.
You may not use this file except in compliance with the License.
You may obtain a copy of the License at https://github.com/dappros/ethora/blob/main/LICENSE.
*/
Severity: Minor
Found in client-reactnative/src/Screens/Profile/ProfileScreen.tsx - About 5 hrs to fix

Function ChatDragItem has 142 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ChatDragItem = (props: ChatDragItemProps) => {

    const ref = useRef();

    const [animation, setAnimation] = useState(new Animated.Value(0));
Severity: Major
Found in client-reactnative/src/components/RoomList/ChatDragItem.tsx - About 5 hrs to fix

File Message.tsx has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useMemo, useState } from "react";
import {
  Message as KitMessage,
  MessageModel,
  MessageSeparator,
Severity: Minor
Found in client-web/src/components/Chat/Messages/Message.tsx - About 5 hrs to fix

Function MainHeader has 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const MainHeader = observer(() => {
  const {chatStore, apiStore, loginStore} = useStores();
  const navigation = useNavigation<HomeStackNavigationProp>();
  const route = useRoute();
  const buttons = [
Severity: Major
Found in client-reactnative/src/components/MainHeader/MainHeader.tsx - About 5 hrs to fix

Function UsernameSignUpForm has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function UsernameSignUpForm(props: TProps) {
  const history = useHistory();
  const setUser = useStoreState((state) => state.setUser);

  const [showPassword, setShowPassword] = useState(false);
Severity: Major
Found in client-web/src/pages/Signon/UsernameSignUpForm.tsx - About 5 hrs to fix

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

const ChangeBackgroundScreen = observer((props: any) => {
  const navigation = useNavigation();
  const {chatStore, loginStore, apiStore} = useStores();
  const roomJID = props.route.params.roomJID;

Severity: Major
Found in client-reactnative/src/Screens/Chat/ChangeBackgroundScreen.tsx - About 5 hrs to fix

Function Referrals has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Referrals: React.FC<IReferrals> = ({}) => {
  const link = useStoreState((state) => state.user._id);
  const walletAddress = useStoreState((state) => state.user.walletAddress);

  const setBalance = useStoreState((state) => state.setBalance);
Severity: Major
Found in client-web/src/pages/Referrals/Referrals.tsx - About 5 hrs to fix

Function EmailSignUpForm has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function EmailSignUpForm(props: TProps) {
  const [showPassword, setShowPassword] = useState(false);
  const [openSnack, setOpenSnack] = useState(false);
  const [errorMsg, setErrorMsg] = useState("");
  const history = useHistory();
Severity: Major
Found in client-web/src/pages/Signon/EmailSignUpForm.tsx - About 5 hrs to fix

Function TransactionsListItem has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const TransactionsListItem = (props: TransactionListProps) => {
  const {
    transactionReceiver,
    transactionSender,
    transactionAmount,

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

import * as React from "react";
import Container from "@mui/material/Container";
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
import Typography from "@mui/material/Typography";
Severity: Minor
Found in client-web/src/pages/Statistics/index.tsx - About 5 hrs to fix

File NftItemHistoryScreen.tsx has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {Fragment, useEffect, useState} from 'react';
import {ActivityIndicator, StyleSheet, TouchableOpacity} from 'react-native';
import {HStack, Image, ScrollView, Text, View, VStack} from 'native-base';
import SecondaryHeader from '../../components/SecondaryHeader/SecondaryHeader';
import AntIcon from 'react-native-vector-icons/AntDesign';
Severity: Minor
Found in client-reactnative/src/Screens/Profile/NftItemHistoryScreen.tsx - About 5 hrs to fix

Function HeaderMenu has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const HeaderMenu = () => {
  const navigation = useNavigation<HomeStackNavigationProp>();
  const [open, setOpen] = useState(false);

  const {loginStore, debugStore} = useStores();
Severity: Major
Found in client-reactnative/src/components/MainHeader/HeaderMenu.tsx - About 5 hrs to fix

XmppClass has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

export class XmppClass {
  public client!: Client;

  init(walletAddress: string, password: string) {
    if (!password) {
Severity: Minor
Found in client-web/src/xmpp.ts - About 5 hrs to fix

Function AddDocumentTabPanel has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const AddDocumentTabPanel = (props: AddDocumentTabPanelProps) => {
    const {getSharedLinks} = props
    const [expiration, setExpiration] = React.useState((-1).toString());
    const [memo, setMemo] = React.useState('');
    const [documentId, setDocumentId] = React.useState('');
Severity: Major
Found in client-web/src/pages/Privacy/AddDocumentTabPanel.tsx - About 5 hrs to fix

File inputUtils.ts has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {diffChars} from 'diff';
import {StyleProp, TextStyle} from 'react-native';
// @ts-ignore the lib do not have TS declarations yet
import matchAll from 'string.prototype.matchall';
import {
Severity: Minor
Found in client-reactnative/src/helpers/chat/inputUtils.ts - About 5 hrs to fix

Function onEnd has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function onEnd(
  p: Participant,
  client: Client,
  walletAddress: string
) {
Severity: Major
Found in bots/createBot/src/questions.create.ts - About 4 hrs to fix

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

      immer((set, get) => {
        return {
          user: {
            firstName: "",
            lastName: "",
Severity: Minor
Found in client-web/src/store/index.ts - 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

Severity
Category
Status
Source
Language