dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

Identical blocks of code found in 6 locations. Consider refactoring.
Open

export const connectingToNewRoom = (xmpp, roomJID, connectData) => {
    console.log('=> Received an invitation to join the chat room', roomJID)
    getOneRoom(roomJID).then(result => {
        if (!result) {
            saveRoomData(roomJID).then(() => {
Severity: Major
Found in bots/gptBot/config/connect.js and 5 other locations - About 7 hrs to fix
bots/autoResponder/config/connect.js on lines 64..86
bots/botTemplate/config/connect.js on lines 66..88
bots/merchantBot/config/connect.js on lines 59..81
bots/raffle/config/connect.js on lines 66..88
bots/translateBot/config/connect.js on lines 66..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File UploadDocumentsScreen.tsx has 491 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {useState} from 'react';
import {
  Text,
  View,
  StyleSheet,
Severity: Minor
Found in client-reactnative/src/Screens/UploadDocumentsScreen.tsx - About 7 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <Box>
                <Typography
                fontSize={"15px"}
                fontWeight={"bold"}
                >Here you go!</Typography>
Severity: Major
Found in client-web/src/pages/Privacy/AddProfileTabPanel.tsx and 1 other location - About 7 hrs to fix
client-web/src/pages/Privacy/AddDocumentTabPanel.tsx on lines 121..158

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 190.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <Box>
                <Typography
                fontSize={"15px"}
                fontWeight={"bold"}
                >Here you go!</Typography>
Severity: Major
Found in client-web/src/pages/Privacy/AddDocumentTabPanel.tsx and 1 other location - About 7 hrs to fix
client-web/src/pages/Privacy/AddProfileTabPanel.tsx on lines 182..219

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 190.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function main has 190 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/exportToUSDC/src/index.exportToUSDC.ts - About 7 hrs to fix

File MintScreen.tsx has 480 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {Fragment, useState} from 'react';
import {
  Text,
  View,
  StyleSheet,
Severity: Minor
Found in client-reactnative/src/Screens/MintScreen.tsx - About 7 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    const mockMessage: IMessage = {
        "_id": "1675255919817827",
        "attachmentId": "",
        "contractAddress": undefined,
        "createdAt": `2023-01-31T18":"30":00.000Z`,
Severity: Major
Found in client-reactnative/__tests__/Chat/MessageBubble-test.tsx and 1 other location - About 7 hrs to fix
client-reactnative/__tests__/Chat/AudioMessage-test.tsx on lines 10..45

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 185.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    const mockMessage: IMessage = {
        "_id": "1675255919817827",
        "attachmentId": "",
        "contractAddress": undefined,
        "createdAt": `2023-01-31T18":"30":00.000Z`,
Severity: Major
Found in client-reactnative/__tests__/Chat/AudioMessage-test.tsx and 1 other location - About 7 hrs to fix
client-reactnative/__tests__/Chat/MessageBubble-test.tsx on lines 9..44

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 185.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const userSteps = (type, jid, newStep) => {
    console.log('=>=> Run user steps, find user. Type: ', type, ' user jid: ', jid);
    let userIndex = userStepsList.findIndex(user => user.name === jid);

    if (userIndex < 0) {
Severity: Major
Found in bots/questionnaire/actions.js and 1 other location - About 7 hrs to fix
bots/huthut/actions.js on lines 64..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 184.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const userSteps = (type, jid, newStep) => {
    console.log('=>=> Run user steps, find user. Type: ', type, ' user jid: ', jid);
    let userIndex = userStepsList.findIndex(user => user.name === jid);

    if (userIndex < 0) {
Severity: Major
Found in bots/huthut/actions.js and 1 other location - About 7 hrs to fix
bots/questionnaire/actions.js on lines 62..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 184.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function AppTopNav has 186 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AppTopNav = () => {
  const currentUntrackedChatRoom = useStoreState(
    (store) => store.currentUntrackedChatRoom
  );
  const chatUrl = currentUntrackedChatRoom
Severity: Major
Found in client-web/src/components/AppTopNav.tsx - About 7 hrs to fix

Function renderDialogContent has 184 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderDialogContent = () => {
    if (!message) return null;
    switch (dialogType) {
      case dialogTypes.clarification:
        return (
Severity: Major
Found in client-web/src/components/Chat/ChatTransferDialog.tsx - About 7 hrs to fix

Function NewChatScreen has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NewChatScreen = (props: NewChatScreenProps) => {
  const [chatAvatar, setChatAvatar] = useState();
  const [chatName, setChatName] = useState('');
  const [chatDescription, setChatDescription] = useState('');
  const [loading, setLoading] = useState(false);
Severity: Major
Found in client-reactnative/src/Screens/Chat/NewChatScreen.tsx - About 7 hrs to fix

Identical blocks of code found in 2 locations. Consider refactoring.
Open

export interface IApiMetaRoom {
  _id: string;
  contractAddress: string;
  createdAt: Date;
  description: string;
Severity: Major
Found in client-reactnative/src/components/Chat/MetaNavigation.tsx and 1 other location - About 7 hrs to fix
client-web/src/components/MetaNavigation/MetaNavigation.tsx on lines 26..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 181.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

export interface IApiMetaRoom {
  _id: string;
  contractAddress: string;
  createdAt: Date;
  description: string;
Severity: Major
Found in client-web/src/components/MetaNavigation/MetaNavigation.tsx and 1 other location - About 7 hrs to fix
client-reactnative/src/components/Chat/MetaNavigation.tsx on lines 37..58

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 181.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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
Severity
Category
Status
Source
Language