dappros/ethora

View on GitHub

Showing 502 of 8,855 total issues

Avoid deeply nested control flow statements.
Open

            if (START_BOT_COMMANDS.includes(msgText.toLocaleLowerCase())) {
              const data = stanza.getChild('data')

              if (data) {
                const newParticipant: Participant = {
Severity: Major
Found in bots/createBot/src/index.create.ts - About 45 mins to fix

Function repeatMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  participant: Participant,
  questions: Question[],
  participants: { [key: string]: Participant },
  onEnd: (p: Participant, client: Client, walletAddress: string) => Promise<void>,
  client: Client,
Severity: Minor
Found in bots/exportToUSDC/src/utils.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if (message.system) {
                if (message?.contractAddress && message.nftId) {
                  await updateMessageToWrapped(message.receiverMessageId, {
                    nftId: message.nftId,
                    contractAddress: message.contractAddress,
Severity: Major
Found in client-reactnative/src/stores/chatStore.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if (
                this.blackList.find(item => item.userJid === message.user._id)
                  ?.userJid
              ) {
                return;
Severity: Major
Found in client-reactnative/src/stores/chatStore.ts - About 45 mins to fix

Function NftListItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const NftListItem = (props: NftListItemProps) => {
  const {
    assetUrl,
    assetsYouHave,
    totalAssets,
Severity: Minor
Found in client-reactnative/src/components/Transactions/NftListItem.tsx - About 45 mins 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

Avoid deeply nested control flow statements.
Open

              if (message.isReply && message.mainMessage?.id) {
                const thread = temporaryArchiveMessages.filter(
                  item => item.mainMessage?.id === message.mainMessage?.id,
                );
                this.updateMessageProperty(
Severity: Major
Found in client-reactnative/src/stores/chatStore.ts - About 45 mins to fix

Function ManageData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const ManageData: React.FC<IManageData> = ({}) => {
  const {loginStore} = useStores();
  const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
  const [loading, setLoading] = useState(false);

Severity: Minor
Found in client-reactnative/src/Screens/Privacy/ManageData.tsx - About 45 mins 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 EnterInviteCode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const EnterInviteCode = observer(() => {
  const [code, setCode] = useState('');
  const [loading, setLoading] = useState(false);
  const {loginStore, apiStore} = useStores();

Severity: Minor
Found in client-reactnative/src/Screens/Account/EnterInviteCodeScreen.tsx - About 45 mins 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 EnterInviteCode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const EnterInviteCode = observer(() => {
  const [code, setCode] = useState('');
  const [loading, setLoading] = useState(false);
  const {loginStore, apiStore} = useStores();

Severity: Minor
Found in client-reactnative/src/Screens/EnterInviteCodeScreen.tsx - About 45 mins 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

Consider simplifying this complex logical expression.
Open

    if (
      !firstname ||
      !lastname ||
      !username ||
      !password ||
Severity: Major
Found in client-reactnative/src/Screens/Login/RegisterScreen.tsx - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if (
      currentMessage &&
      nextMessage &&
      position &&
      isSameUser(currentMessage, nextMessage) &&
Severity: Major
Found in client-reactnative/src/components/Chat/MessageBubble.tsx - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if (
      currentMessage &&
      previousMessage &&
      position &&
      isSameUser(currentMessage, previousMessage) &&
Severity: Major
Found in client-reactnative/src/components/Chat/MessageBubble.tsx - About 40 mins to fix

Function sendMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export async function sendMessage(p: Participant, message: Message, client: Client, walletAddress: string, repeat = false): Promise<void> {
Severity: Minor
Found in bots/createBot/src/utils.ts - About 35 mins to fix

Function registerOwner has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  firstName: string,
  lastName: string,
  email: string,
  company: string,
  tnc: string
Severity: Minor
Found in client-web/src/http.ts - About 35 mins to fix

Function getTnc has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  company: string,
  fname: string,
  lname: string,
  email: string,
  date: string
Severity: Minor
Found in client-web/src/pages/Signon/OwnerRegistrationModal.tsx - About 35 mins to fix

Function registerSignature has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  walletAddress: string,
  signature: string,
  msg: string,
  firstName: string,
  lastName: string
Severity: Minor
Found in client-web/src/http.ts - About 35 mins to fix

Function sendMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export async function sendMessage(p: Participant, message: Message, client: Client, walletAddress: string, repeat = false): Promise<void> {
Severity: Minor
Found in bots/exportToUSDC/src/utils.ts - About 35 mins to fix

Function userSteps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const userSteps = (type, jid, step, newData) => {
    //Get the index of the user in the array by his jid
    const userIndex = userStepsList.findIndex(user => user.name === jid);

    //If the user with the specified jid is not found, create a new data object for him.
Severity: Minor
Found in bots/gptBot/actions.js - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const sendMessage = (data, message, type, isSystemMessage, tokenAmount) => {
    data.xmpp.send(xml('message', {
        to: data.stanzaId ? data.stanzaId.attrs.by : data.receiver,
        type: data.receiverData ? 'groupchat' : type,
        id: "sendMessage"
Severity: Minor
Found in bots/questionnaire/actions.js - About 35 mins 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 userSteps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const userSteps = (type, jid, step, newData) => {
    //Get the index of the user in the array by his jid
    const userIndex = userStepsList.findIndex(user => user.name === jid);

    //If the user with the specified jid is not found, create a new data object for him.
Severity: Minor
Found in bots/raffle/actions.js - About 35 mins 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

Severity
Category
Status
Source
Language