dappros/ethora

View on GitHub

Showing 502 of 8,855 total issues

Function EnterInviteCode has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const EnterInviteCode = observer(() => {
  const [code, setCode] = useState('');
  const [loading, setLoading] = useState(false);
  const {loginStore, apiStore} = useStores();

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

Function Message has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const Message: React.FC<IMessage> = ({
  message,
  position,
  onMessageButtonClick,
  toggleTransferDialog,
Severity: Minor
Found in client-web/src/components/Chat/Messages/Message.tsx - About 2 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

File ChatDragItem.tsx has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
Copyright 2019-2022 (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.
Note: linked open-source libraries and components may be subject to their own licenses.
Severity: Minor
Found in client-reactnative/src/components/RoomList/ChatDragItem.tsx - About 2 hrs to fix

Function router has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const router = (handlerData) => {

    if(currentItem.status === "work"){
        userSteps('setStep', handlerData.userJID, 4);
    }
Severity: Major
Found in bots/raffle/router.js - About 2 hrs to fix

Function createMessage has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const createMessage = (
  data: any,
  body: any,
  id: string,
  from: string
Severity: Major
Found in client-web/src/utils/createMessage.ts - About 2 hrs to fix

Function Blocking has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Blocking: React.FC<IBlocking> = observer(({}) => {
  const {chatStore, loginStore} = useStores();
  const manipulatedWalletAddress = underscoreManipulation(
    loginStore.initialData.walletAddress,
  );
Severity: Major
Found in client-reactnative/src/Screens/Privacy/Blocking.tsx - About 2 hrs to fix

XmppHandler has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

export class XmppHandler {
  public lastMsgId: string = "";
  public isGettingMessages: boolean = false;
  public isGettingFirstMessages: boolean = false;
  private temporaryMessages: TMessageHistory[] = [];
Severity: Minor
Found in client-web/src/xmppHandler.ts - About 2 hrs to fix

Function searchItemsHandler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const searchItemsHandler = (data) => {
    console.log('=> searchItemsHandler | Message received from ', data.receiver, data.message);
    let tokenAmount = 1;
    userPaymentVerify(data, botOptions.botData.collectFee).then(response => {
        if (!response) {
Severity: Major
Found in bots/huthut/handlers/searchItems.js - About 2 hrs to fix

Function gettingCoinsHandler has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const gettingCoinsHandler = (data) => {
    logCurrentHandler('gettingCoinsHandler', data.userJID, data.message);
    const coinAmount = 7;

    if (messageCheck(data.message, botOptions.botData.firstName + ' ' + botOptions.botData.lastName)) {
Severity: Major
Found in bots/raffle/handlers/coins/gettingCoinsHandler.js - About 2 hrs to fix

Function TransactionsTable has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function TransactionsTable(props: TProps) {
  const history = useHistory();

  return (
    <TableContainer style={{ flex: 1, marginTop: "10px" }} component={Paper}>
Severity: Major
Found in client-web/src/pages/Profile/TransactionsTable.tsx - About 2 hrs to fix

Function ManageTabPanel has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ManageTabPanel = (props: ManageTabPanelProps) => {
  const {
    handleChangeTab,
    sharedLinks,
    loading,
Severity: Major
Found in client-web/src/pages/Privacy/ManageProfileTabPanel.tsx - About 2 hrs to fix

File DebugScreen.tsx has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {useEffect, useState} from 'react';
import {
  ScrollView,
  Text,
  TextInput,
Severity: Minor
Found in client-reactnative/src/Screens/System/DebugScreen.tsx - About 2 hrs to fix

Function BlockDetails has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function BlockDetails(props) {
  const [blockDetails, setBlockDetails] = useState<IBlock | {}>({});
  const [loading, setLoading] = useState(false);
  const params = useParams<{ blockNumber: string }>();
  const getDetails = async () => {
Severity: Major
Found in client-web/src/pages/Explorer/BlockDetails.tsx - About 2 hrs to fix

Function helloMessageHandler has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const helloMessageHandler = (data) => {
    console.log('=> helloMessageHandler || Message received from ', data.userJID, data.message);
    userData('setData', data.userJID, '', 'deleteItem');

    getUserData(data.userJID).then(userData => {
Severity: Major
Found in bots/merchantBot/handlers/helloMessage.js - About 2 hrs to fix

Function transferTokens has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async transferTokens(
    bodyData: any,
    token: string,
    fromWallet: string,
    senderName: string,
Severity: Major
Found in client-reactnative/src/stores/walletStore.ts - About 2 hrs to fix

Function handleCreateNewChat has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const handleCreateNewChat = () => {
    let roomHash = '';
    sha256(chatName).then(async hash => {
      roomHash = hash;

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

Function answerHandler has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const answerHandler = (data) => {
    console.log('=> answerHandler | Message received from ', data.receiver, data.message);
    const userMessage = data.message.split(' ').slice(1).join(' ');
    getListAnswers(data.receiver).then(result => {
        const answerId = result.length+1;
Severity: Major
Found in bots/questionnaire/handlers/answer.js - About 2 hrs to fix

Function sendFile has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const sendFile = async (file: File, isReply: boolean) => {
    const formData = new FormData();
    formData.append("files", file);
    setFileUploading(true);
    try {
Severity: Major
Found in client-web/src/pages/ChatInRoom/Chat.tsx - About 2 hrs to fix

Function ManageDocumentShareTabPanel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ManageDocumentShareTabPanel = (
  props: ManageDocumentShareTabPanelProps
) => {
  const { handleChangeTab, loading, sharedLinks, handleOpenModal, deleteLink } =
    props;
Severity: Major
Found in client-web/src/pages/Privacy/ManageDocumentShareTabPanel.tsx - About 2 hrs to fix

Function AddNewEmailModal has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AddNewEmailModal = (props: AddNewEmailModalProps) => {
  const {
    setNewEmail,
    submitEmail,
    loading,
Severity: Major
Found in client-reactnative/src/components/Modals/Account/AddNewEmail.tsx - About 2 hrs to fix
Severity
Category
Status
Source
Language