dappros/ethora

View on GitHub

Showing 502 of 8,855 total issues

Function HomeStackScreen has 272 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const HomeStackScreen = observer(() => {
  const {chatStore, loginStore, walletStore, apiStore} = useStores();
  const {initialData} = loginStore;
  const {xmppPassword, xmppUsername, walletAddress} = initialData;
  const navigation = useNavigation<HomeStackNavigationProp>();
Severity: Major
Found in client-reactnative/src/navigation/HomeStack.tsx - About 1 day to fix

File index.ts has 612 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import create from "zustand";
import { immer } from "zustand/middleware/immer";
import { persist, devtools } from "zustand/middleware";
import * as http from "../http";
import { TCombinedMimeType } from "../constants";
Severity: Major
Found in client-web/src/store/index.ts - About 1 day to fix

Function NftItemHistoryScreen has 264 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NftItemHistoryScreen = (props: any) => {
  const {item, userWalletAddress} = props.route.params.params;

  const {loginStore, walletStore} = useStores();

Severity: Major
Found in client-reactnative/src/Screens/Profile/NftItemHistoryScreen.tsx - About 1 day to fix

Function Signon has 261 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function Signon() {
  const setUser = useStoreState((state) => state.setUser);
  const user = useStoreState((state) => state.user);
  const query = useQuery();
  const history = useHistory();
Severity: Major
Found in client-web/src/pages/Signon/index.tsx - About 1 day to fix

File http.ts has 595 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import axios from "axios";
import { config } from "./config";
import {
  ExplorerRespose,
  IBlock,
Severity: Major
Found in client-web/src/http.ts - About 1 day to fix

Function MessageText has 254 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const MessageText = observer((props: any) => {
  const [youtubeMetaData, setYoutubeMetaData] = useState({});

  const {loginStore, apiStore, chatStore} = useStores();

Severity: Major
Found in client-reactnative/src/components/Chat/MessageText.tsx - About 1 day to fix

Function MintScreen has 246 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MintScreen = () => {

  //mobx stores
  const {loginStore, walletStore} = useStores();
  //mobx stores
Severity: Major
Found in client-reactnative/src/Screens/Actions/MintScreen.tsx - About 1 day to fix

Function Bubble has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

const Bubble = observer((props: BubbleProps) => {
  const {chatStore} = useStores();
  const [width, setWidth] = useState(0);
  const initialAnimationValue = new Animated.Value(0);

Severity: Minor
Found in client-reactnative/src/components/Chat/MessageBubble.tsx - About 1 day 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 MessageBubble.tsx has 560 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: Major
Found in client-reactnative/src/components/Chat/MessageBubble.tsx - About 1 day to fix

Function AuthenticationScreen has 228 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const AuthenticationScreen: React.FC<IAuthentication> = ({ }) => {

  //mobx stores
  const { loginStore } = useStores();
  //mobx stores
Severity: Major
Found in client-reactnative/src/Screens/Account/Authentication.tsx - About 1 day to fix

File walletStore.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {makeAutoObservable, runInAction} from 'mobx';
import {Alert} from 'react-native';
import {httpGet, httpPost} from '../config/apiService';
import {
  docsURL,
Severity: Major
Found in client-reactnative/src/stores/walletStore.ts - About 1 day to fix

Function UsersTable has 224 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function UsersTable() {
  const apps = useStoreState((state) => state.apps);
  const ownerAccess = useStoreState((state) => state.user.ACL.ownerAccess);
  const user = useStoreState((state) => state.user);
  const [showNewUser, setShowNewUser] = React.useState(false);
Severity: Major
Found in client-web/src/pages/Owner/Users.tsx - About 1 day to fix

Function ChatInRoom has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

export function ChatInRoom() {
  const messages = useStoreState((state) => state.historyMessages);
  const user = useStoreState((store) => store.user);
  const userChatRooms = useStoreState((store) => store.userChatRooms);
  const currentThreadViewMessage = useStoreState(
Severity: Minor
Found in client-web/src/pages/ChatInRoom/Chat.tsx - About 1 day 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 215 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UploadDocumentsScreen = () => {
  const {loginStore, walletStore, debugStore} = useStores();

  const [itemName, setItemName] = useState<string>('');
  // data api
Severity: Major
Found in client-reactnative/src/Screens/Actions/UploadDocumentsScreen.tsx - About 1 day to fix

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

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

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