dappros/ethora

View on GitHub

Showing 502 of 8,855 total issues

File loginStore.ts has 469 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import AsyncStorage from '@react-native-async-storage/async-storage';
import {makeAutoObservable, runInAction, action} from 'mobx';
import {LoginManager} from 'react-native-fbsdk-next';
import {deleteAllRealm} from '../components/realmModels/allSchemas';
import {httpPost, httpPut} from '../config/apiService';
Severity: Minor
Found in client-reactnative/src/stores/loginStore.ts - About 7 hrs to fix

Function insertTransaction has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

export const insertTransaction = data =>
  new Promise(async (resolve, reject) => {
    data.map(item => {
      if (!item.nftTotal) item.nftTotal = '0';
      const data = {
Severity: Minor
Found in client-reactnative/src/components/realmModels/transaction.ts - About 7 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 sendMessage has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function sendMessage(p: Participant, message: Message, client: Client, walletAddress: string, repeat = false): Promise<void> {
  if (repeat === true) {
    for (const [index, msg] of message.messages.entries()) {
      await sleep(100)
      if (msg.repeat === true) {
Severity: Major
Found in bots/exportToUSDC/src/utils.ts - About 7 hrs to fix

Function sendMessage has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function sendMessage(p: Participant, message: Message, client: Client, walletAddress: string, repeat = false): Promise<void> {
  if (repeat === true) {
    for (const [index, msg] of message.messages.entries()) {
      await sleep(100)
      if (msg.repeat === true) {
Severity: Major
Found in bots/createBot/src/utils.ts - About 7 hrs to fix

File xmppHandler.ts has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  replaceMessageListItemProps,
  TActiveRoomFilter,
  TMessageHistory,
  TRoomRoles,
Severity: Minor
Found in client-web/src/xmppHandler.ts - About 7 hrs to fix

Function main has 175 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const main = async () => {
  const loginResponse = await login(USERNAME, PASSWORD)

  if (!loginResponse) {
    throw new Error('Bad creads for login')
Severity: Major
Found in bots/createBot/src/index.create.ts - About 7 hrs to fix

Function NewItemModal has 174 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function NewItemModal(props: Props) {
  const [preview, setPreview] = React.useState<any>(null);
  const [fileError, setFileError] = React.useState("");
  const [file, setFile] = React.useState<File | null>(null);
  const [loading, setLoading] = React.useState(false);
Severity: Major
Found in client-web/src/pages/Profile/NewItemModal.tsx - About 6 hrs to fix

Function main has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

const main = async () => {
  const loginResponse = await login(USERNAME, PASSWORD);

  if (!loginResponse) {
    throw new Error("Bad creads for login");
Severity: Minor
Found in bots/exportToUSDC/src/index.exportToUSDC.ts - About 6 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 MintNft has 169 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const MintNft: React.FC<IMintNft> = ({}) => {
  const [preview, setPreview] = React.useState<any>(null);
  const [fileError, setFileError] = React.useState("");
  const [file, setFile] = React.useState<File | null>(null);
  const [loading, setLoading] = React.useState(false);
Severity: Major
Found in client-web/src/pages/MintNft/MintNft.tsx - About 6 hrs to fix

Function router has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

const router = (xmpp, message, sender, receiver, requestType, receiverData, stanzaId) => {
    if (requestType === 'x' && message.match(/\binvite\S*\b/g)) {
        console.log('=> The bot was invited to the chat room ', receiver);
        connectRoom(xmpp, sender, receiver);
    }
Severity: Minor
Found in bots/huthut/router.js - About 6 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 NftListItem has 166 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const NftListItem = (props: NftListItemProps) => {
  const {
    assetUrl,
    assetsYouHave,
    totalAssets,
Severity: Major
Found in client-reactnative/src/components/Transactions/NftListItem.tsx - About 6 hrs to fix

File MetaNavigation.tsx has 441 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {useNavigation} from '@react-navigation/native';
import {HStack, Image} from 'native-base';
import React, {useEffect, useState} from 'react';
import {
  ActivityIndicator,
Severity: Minor
Found in client-reactnative/src/components/Chat/MetaNavigation.tsx - About 6 hrs to fix

Function MembersList has 160 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function MembersList() {
  const { roomJID }: any = useParams();
  const userChatRooms = useStoreState((store) => store.userChatRooms);
  const membersList = useStoreState((store) =>
    store.roomMemberInfo.filter((item) => item.name !== "none")
Severity: Major
Found in client-web/src/pages/ChatRoomDetails/MembersList.tsx - About 6 hrs to fix

Function DocumentShareAdd has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const DocumentShareAdd: React.FC<IDocumentShareAdd> = observer(({}) => {
  const [memo, setMemo] = useState('');
  const [expiration, setExpiration] = useState('-1');
  const [documentId, setDocumentId] = useState('');

Severity: Major
Found in client-reactnative/src/Screens/Privacy/DocumentShareAdd.tsx - About 6 hrs to fix

File ChatDetailsScreen.tsx has 426 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  Actionsheet,
  AlertDialog,
  Button,
  Text,
Severity: Minor
Found in client-reactnative/src/Screens/Chat/ChatDetailsScreen.tsx - About 6 hrs to fix

Function messages has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const messages = () => {
    return {
        general: {
            welcomeMessage: '',
            youHaveQuestions: 'You have an unfinished in-take form to complete.',
Severity: Major
Found in bots/merchantBot/config/messages.js - About 6 hrs to fix

Function main has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

const main = async () => {
  const loginResponse = await login(USERNAME, PASSWORD)

  if (!loginResponse) {
    throw new Error('Bad creads for login')
Severity: Minor
Found in bots/createBot/src/index.create.ts - About 6 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 UploadDocument has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UploadDocument: React.FC<IUploadDocument> = ({}) => {
  const [loading, setLoading] = useState(false);
  const fileRef = useRef<HTMLInputElement>(null);
  const { showSnackbar } = useSnackbar();
  const [uploadedFile, setUploadedFile] = useState({
Severity: Major
Found in client-web/src/pages/UploadDocument/UploadDocument.tsx - About 6 hrs to fix

File OtherUserProfileScreen.tsx has 414 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/OtherUserProfileScreen.tsx - About 5 hrs to fix

Function CreateApp has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function CreateApp() {
  const [loading, setLoading] = React.useState(false);
  const fileRef = React.useRef<HTMLInputElement>(null);

  const formik = useFormik({
Severity: Major
Found in client-web/src/pages/CreateApp/index.tsx - About 5 hrs to fix
Severity
Category
Status
Source
Language