dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

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

const Row = ({
  name,
  row,
  onChange,
  disableAllRow,
Severity: Minor
Found in client-web/src/components/EditAcl.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 router has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const router = (handlerData) => {
    handlerData.userStep = userSteps('getStep', handlerData.userJID);

    if (messageCheck(handlerData.message, 'close') || messageCheck(handlerData.message, 'leave')) {
        return leaveHandler(handlerData);
Severity: Minor
Found in bots/botTemplate/router.js - 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 produceNfmtItems has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const produceNfmtItems = (array = []) => {
  const result = [];
  const rareTotal = 20;
  const uniqueTotal = 1;

Severity: Minor
Found in client-web/src/utils/index.ts - 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 EditAcl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const EditAcl: React.FC<IEditAcl> = ({ userId, updateData }) => {
  const [userAcl, setUserAcl] = useState<IUserAcl>();
  const [userAclApplicationKeys, setUserAclApplicationKeys] = useState<
    Array<TKeys>
  >([]);
Severity: Minor
Found in client-web/src/components/EditAcl.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 getPosition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const getPosition = (
  arr: TMessageHistory[],
  message: TMessageHistory,
  index: number
) => {
Severity: Minor
Found in client-web/src/utils/index.ts - 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 (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

Avoid deeply nested control flow statements.
Open

            if (isValid) {
              // next question
              participant.answers[currentQuestion.name] = participant.msg
              await nextMessage(
                participant,
Severity: Major
Found in bots/createBot/src/index.create.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (isValid) {
              // next question
              participant.answers[currentQuestion.name] = participant.msg;
              await nextMessage(
                participant,
Severity: Major
Found in bots/exportToUSDC/src/index.exportToUSDC.ts - About 45 mins to fix

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

export function OtherProfile(props: TProps) {
  const [loading, setLoading] = useState(true);
  const [profile, setProfile] = useState<TProfile>();
  const [transactions, setTransactions] =
    useState<ExplorerRespose<ITransaction[]>>();
Severity: Minor
Found in client-web/src/pages/Profile/OtherProfile.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 nextMessage 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/createBot/src/utils.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/createBot/src/utils.ts - About 45 mins to fix

Function nextMessage 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 (START_BOT_COMMANDS.includes(msgText.toLocaleLowerCase())) {
              const data = stanza.getChild("data");

              if (data) {
                const newParticipant: Participant = {
Severity: Major
Found in bots/exportToUSDC/src/index.exportToUSDC.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 (
                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

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

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

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

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

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

        if (userStep === 5 && receiverData.attrs.isSystemMessage && receiverData.attrs.tokenAmount >= 1) {
            return searchItemsHandler(handlerData)
        }
Severity: Minor
Found in bots/huthut/router.js and 1 other location - About 45 mins to fix
bots/huthut/router.js on lines 64..66

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

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

Severity
Category
Status
Source
Language