dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

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

        <LineChart
          width={500}
          height={300}
          data={[]}
          margin={{
Severity: Major
Found in client-web/src/pages/Dashboard/TokensGraph.tsx and 1 other location - About 3 hrs to fix
client-web/src/pages/Dashboard/UsersGraph.tsx on lines 68..92

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

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 4 locations. Consider refactoring.
Open

      <TableCell
        style={{
          backgroundColor: !checkDisabled(row?.disabled, "read")
            ? "white"
            : "lightgrey",
Severity: Major
Found in client-web/src/components/EditAcl.tsx and 3 other locations - About 3 hrs to fix
client-web/src/components/EditAcl.tsx on lines 102..117
client-web/src/components/EditAcl.tsx on lines 118..133
client-web/src/components/EditAcl.tsx on lines 134..149

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

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

export const answerHandler = (data) => {
    console.log('=> answerHandler | Message received from ', data.userJID, data.message);
    let currentButtonType = userData('getData', data.userJID, null, 'buttonType');

    const userMessage = data.message;
Severity: Major
Found in bots/merchantBot/handlers/answer.js - About 3 hrs to fix

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

const getWritingTime = (message) => {
    if (message.length <= 120) {
        return 2000
    }
    if (message.length <= 250 && message.length > 120) {
Severity: Major
Found in bots/translateBot/actions.js and 4 other locations - About 3 hrs to fix
bots/autoResponder/actions.js on lines 89..102
bots/botTemplate/actions.js on lines 89..102
bots/gptBot/actions.js on lines 89..102
bots/raffle/actions.js on lines 89..102

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

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 5 locations. Consider refactoring.
Open

const getWritingTime = (message) => {
    if (message.length <= 120) {
        return 2000
    }
    if (message.length <= 250 && message.length > 120) {
Severity: Major
Found in bots/raffle/actions.js and 4 other locations - About 3 hrs to fix
bots/autoResponder/actions.js on lines 89..102
bots/botTemplate/actions.js on lines 89..102
bots/gptBot/actions.js on lines 89..102
bots/translateBot/actions.js on lines 89..102

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

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 5 locations. Consider refactoring.
Open

const getWritingTime = (message) => {
    if (message.length <= 120) {
        return 2000
    }
    if (message.length <= 250 && message.length > 120) {
Severity: Major
Found in bots/gptBot/actions.js and 4 other locations - About 3 hrs to fix
bots/autoResponder/actions.js on lines 89..102
bots/botTemplate/actions.js on lines 89..102
bots/raffle/actions.js on lines 89..102
bots/translateBot/actions.js on lines 89..102

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

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 5 locations. Consider refactoring.
Open

const getWritingTime = (message) => {
    if (message.length <= 120) {
        return 2000
    }
    if (message.length <= 250 && message.length > 120) {
Severity: Major
Found in bots/botTemplate/actions.js and 4 other locations - About 3 hrs to fix
bots/autoResponder/actions.js on lines 89..102
bots/gptBot/actions.js on lines 89..102
bots/raffle/actions.js on lines 89..102
bots/translateBot/actions.js on lines 89..102

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

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 5 locations. Consider refactoring.
Open

const getWritingTime = (message) => {
    if (message.length <= 120) {
        return 2000
    }
    if (message.length <= 250 && message.length > 120) {
Severity: Major
Found in bots/autoResponder/actions.js and 4 other locations - About 3 hrs to fix
bots/botTemplate/actions.js on lines 89..102
bots/gptBot/actions.js on lines 89..102
bots/raffle/actions.js on lines 89..102
bots/translateBot/actions.js on lines 89..102

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

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

            {userAclNetworkKeys.map((row) => {
              const network = userAcl!.result.network.netStats;
              const myNetworkAcl = myAcl!.result.network.netStats;

              return (
Severity: Major
Found in client-web/src/components/EditAcl.tsx and 1 other location - About 3 hrs to fix
client-web/src/components/EditAcl.tsx on lines 280..294

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

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

              userAclApplicationKeys.map((row) => {
                const application = userAcl!.result.application[row];
                const myApplicationAcl = myAcl!.result.application[row];

                return (
Severity: Major
Found in client-web/src/components/EditAcl.tsx and 1 other location - About 3 hrs to fix
client-web/src/components/EditAcl.tsx on lines 316..330

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

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 DocumentHistoryScreen.tsx has 324 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, 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/DocumentHistoryScreen.tsx - About 3 hrs to fix

Function MintScreen has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const MintScreen = (props: MintScreenProps) => {
  const {loginStore, walletStore, apiStore} = useStores();
  const navigation = useNavigation();

  const [itemName, setItemName] = useState<string>('');
Severity: Minor
Found in client-reactnative/src/Screens/MintScreen.tsx - About 3 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 UploadDocumentsScreen has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const UploadDocumentsScreen = (props: MintScreenProps) => {
  const {loginStore, walletStore, apiStore, debugStore} = useStores();
  const navigation = useNavigation();

  const [itemName, setItemName] = useState<string>('');
Severity: Minor
Found in client-reactnative/src/Screens/UploadDocumentsScreen.tsx - About 3 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 EmailSingInForm has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function EmailSingInForm(props: TProps) {
  const history = useHistory();
  const setUser = useStoreState((state) => state.setUser);
  const [disable, setDisable] = useState(false);
  const [showPassword, setShowPassword] = useState(false);
Severity: Major
Found in client-web/src/pages/Signon/EmailSignInForm.tsx - About 3 hrs to fix

File TokensOrItemsTransfer.tsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {VStack, Input, View, Text} from 'native-base';
import React, {useState} from 'react';
import {ActivityIndicator, FlatList, StyleSheet} from 'react-native';
import {
  commonColors,

File MessageText.tsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import {Button, Image, Text, View} from 'native-base';
import Ionicons from 'react-native-vector-icons/Ionicons';
import {
  widthPercentageToDP as wp,
Severity: Minor
Found in client-reactnative/src/components/Chat/MessageText.tsx - About 3 hrs to fix

Function Routes has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Routes = () => {
  const userId = useStoreState((state) => state.user._id);
  const user = useStoreState((state) => state.user);

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

Function MyProfile has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function MyProfile() {
  const [loading, setLoading] = useState(false);
  const [transactions, setTransactions] =
    useState<ExplorerRespose<ITransaction[]>>();
  const user = useStoreState((store) => store.user);
Severity: Major
Found in client-web/src/pages/Profile/MyProfile.tsx - About 3 hrs to fix

Function ProfileScreen has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

export const ProfileScreen = observer(() => {
  const {loginStore, walletStore, chatStore, apiStore} = useStores();

  const navigation = useNavigation();

Severity: Minor
Found in client-reactnative/src/Screens/Profile/ProfileScreen.tsx - About 3 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 Menu has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Menu: React.FC<IMenu> = ({}) => {
  const { active, deactivate } = useWeb3React();
  const user = useStoreState((state) => state.user);
  const history = useHistory();
  const ACL = useStoreState((state) => state.ACL);
Severity: Major
Found in client-web/src/components/Menu.tsx - About 3 hrs to fix
Severity
Category
Status
Source
Language