dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

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

          <Input
            margin={5}
            maxLength={15}
            fontFamily={textStyles.lightFont}
            fontSize={hp('1.6%')}
client-reactnative/src/components/Modals/Profile/ProfileModal.tsx on lines 96..106

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 89.

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

          <Input
            margin={5}
            maxLength={15}
            fontFamily={textStyles.lightFont}
            fontSize={hp('1.6%')}
client-reactnative/src/components/Modals/Profile/ProfileModal.tsx on lines 108..118

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 89.

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 EnterInviteCode has 66 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/EnterInviteCodeScreen.tsx - About 2 hrs to fix

File Authentication.tsx has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Clipboard from '@react-native-clipboard/clipboard';
import { useWalletConnect } from '@walletconnect/react-native-dapp';
import React, { useEffect, useState } from 'react';
import { Linking, StyleSheet, Text, View } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';
Severity: Minor
Found in client-reactnative/src/Screens/Account/Authentication.tsx - About 2 hrs to fix

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

          <View style={classes.section1}>
            <TextInput
              value={itemName}
              onChangeText={text => setItemName(text)}
              placeholder="Item Name"
Severity: Major
Found in client-reactnative/src/Screens/Actions/MintScreen.tsx and 1 other location - About 2 hrs to fix
client-reactnative/src/Screens/MintScreen.tsx on lines 208..217

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 87.

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

          <View style={classes.section1}>
            <TextInput
              value={itemName}
              onChangeText={itemName => setItemName(itemName)}
              placeholder="Item Name"
Severity: Major
Found in client-reactnative/src/Screens/MintScreen.tsx and 1 other location - About 2 hrs to fix
client-reactnative/src/Screens/Actions/MintScreen.tsx on lines 185..194

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 87.

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

    try {
      const formData = new FormData();
      formData.append("isAssetsOpen", assetsState);
      const { data } = await changeUserData(formData);

Severity: Major
Found in client-web/src/pages/Privacy/VisibilityTab.tsx and 1 other location - About 2 hrs to fix
client-web/src/pages/Privacy/VisibilityTab.tsx on lines 51..61

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 87.

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

    try {
      const formData = new FormData();
      formData.append("isProfileOpen", profileState);
      const { data } = await changeUserData(formData);

Severity: Major
Found in client-web/src/pages/Privacy/VisibilityTab.tsx and 1 other location - About 2 hrs to fix
client-web/src/pages/Privacy/VisibilityTab.tsx on lines 70..81

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 87.

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

  blacklistUser = (userJIDToBlacklist: string) => {
    const stanza = xml(
      "iq",
      {
        from: this.client.jid?.toString(),
Severity: Major
Found in client-web/src/xmpp.ts and 1 other location - About 2 hrs to fix
client-web/src/xmpp.ts on lines 793..808

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 87.

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

  removeUserFromBlackList = (userAddressToRemoveFromBlacklist: string) => {
    const stanza = xml(
      "iq",
      {
        from: this.client.jid?.toString(),
Severity: Major
Found in client-web/src/xmpp.ts and 1 other location - About 2 hrs to fix
client-web/src/xmpp.ts on lines 639..654

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 87.

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 router has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const router = (handlerData) => {

    if(currentItem.status === "work"){
        userSteps('setStep', handlerData.userJID, 4);
    }
Severity: Minor
Found in bots/raffle/router.js - 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

Function MessageDefault has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const MessageDefault: React.FC<IMessagesProps> = ({message, previousJID, nextJID}) => {
    const [messagePositionData, setMessagePositionData] = useState<IMessagePosition>({
        position: "single",
        type: "single"
    });
Severity: Minor
Found in client-web/src/components/Chat/Messages/MessageDefault.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

Function NewUserModal has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export default function NewUserModal({ open, setOpen, setUsers }: TProps) {
  const apps = useStoreState((state) => state.apps);
  const addAppUsers = useStoreState((state) => state.addAppUsers);
  const [loading, setLoading] = useState(false);

Severity: Minor
Found in client-web/src/pages/Owner/NewUserModal.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

Function message has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    message: async (p) => {
      let balance, error;
      try {
        const web3 = new Web3(process.env.EXTERNAL_BC_WS as string);
        const contractAddressUSDC = process.env.USDC_CONTRACT_ADDRESS as string;
Severity: Major
Found in bots/exportToUSDC/src/questions.create.ts - About 2 hrs to fix

Function TransactionDetails has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TransactionDetails: React.FC<ITransactionDetailsProps> = (
  props
) => {
  const [transactionDetails, setTransactionDetails] = useState<
    ITransaction | {}
Severity: Major
Found in client-web/src/pages/Explorer/TransactionDetails.tsx - About 2 hrs to fix

File PrivacyPolicy.tsx has 273 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/PrivacyPolicy.tsx - About 2 hrs to fix

File AccountScreen.tsx has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {observer} from 'mobx-react-lite';
import React, {useEffect, useState} from 'react';
import {
  Text,
  View,
Severity: Minor
Found in client-reactnative/src/Screens/Account/AccountScreen.tsx - About 2 hrs to fix

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

export type Participant = {
  id: string
  stanza: Element
  msg: string
  firstName: string
Severity: Major
Found in bots/createBot/src/types.ts and 1 other location - About 2 hrs to fix
bots/exportToUSDC/src/types.ts on lines 4..16

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 86.

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 type Participant = {
  id: string;
  stanza: Element;
  msg: string;
  firstName: string;
Severity: Major
Found in bots/exportToUSDC/src/types.ts and 1 other location - About 2 hrs to fix
bots/createBot/src/types.ts on lines 3..15

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 86.

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 userData has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const userData = (type, jid, data, dataGroup) => {
    let userIndex = userDatalist.findIndex(user => user.name === jid);

    if (userIndex < 0) {
        console.log('=>=> Create user data', jid);
Severity: Major
Found in bots/merchantBot/actions.js - About 2 hrs to fix
Severity
Category
Status
Source
Language