kabisa/kudos-frontend

View on GitHub

Showing 17 of 230 total issues

File CreatePost.tsx has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, createRef, FormEvent, RefObject } from "react";
import { Mutation } from "@apollo/client/react/components";
import { toast } from "react-toastify";
import { gql } from "@apollo/client";
import { ApolloConsumer } from "@apollo/client";
Severity: Minor
Found in src/modules/feed/components/CreatePost/CreatePost.tsx - About 4 hrs to fix

    Function render has 139 lines of code (exceeds 80 allowed). Consider refactoring.
    Open

      render() {
        const { amountError, receiversError, messageError } = this.state;
        const { transaction } = this.props;
        return (
          <ApolloConsumer>
    Severity: Major
    Found in src/modules/feed/components/CreatePost/CreatePost.tsx - About 3 hrs to fix

      Function render has 109 lines of code (exceeds 80 allowed). Consider refactoring.
      Open

        render() {
          return (
            <Mutation<CreateGoalParameters>
              mutation={this.state.editing ? UPDATE_GOAL : CREATE_GOAL}
              onCompleted={() => {
      Severity: Major
      Found in src/modules/manage-team/sections/kudometer/goals/EditGoal.tsx - About 2 hrs to fix

        Function render has 103 lines of code (exceeds 80 allowed). Consider refactoring.
        Open

          render() {
            return (
              <Mutation<CreateGuidelineParameters>
                mutation={this.state.editing ? UPDATE_GUIDELINE : CREATE_GUIDELINE}
                onCompleted={() => {
        Severity: Major
        Found in src/modules/manage-team/sections/guideline/EditGuideline.tsx - About 1 hr to fix

          Function setTestSubject has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          export const setTestSubject = <
            TComponent extends React.FC<any>,
            TDecorators extends Decorator<string, any>[],
          >(
            Component: TComponent,
          Severity: Minor
          Found in src/support/testing/testSubject.tsx - About 1 hr 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 render has 95 lines of code (exceeds 80 allowed). Consider refactoring.
          Open

            render() {
              return (
                <ApolloConsumer>
                  {(client) => (
                    <div className="form-container">
          Severity: Major
          Found in src/modules/manage-team/sections/kudometer/KudometerSection.tsx - About 1 hr to fix

            Function KudometerRow has 91 lines of code (exceeds 80 allowed). Consider refactoring.
            Open

            export function KudometerRow(props: KudometerRowProps) {
              function deleteKudometer(mutation: any) {
                const { id } = props.kudometer;
                if (global.confirm("Are you sure you want to delete this kudometer?")) {
                  mutation({ variables: { id } });
            Severity: Major
            Found in src/modules/manage-team/sections/kudometer/KudometerRow.tsx - About 1 hr to fix

              Function render has 89 lines of code (exceeds 80 allowed). Consider refactoring.
              Open

                render() {
                  return (
                    <Mutation<LoginResult, LoginParameters>
                      mutation={MUTATION_LOGIN}
                      onError={(error) => {
              Severity: Major
              Found in src/modules/login/LoginPage.tsx - About 1 hr to fix

                Function calculateProgress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                const calculateProgress = (
                  goals: Goal[],
                  current: number,
                  scale = 100,
                ): number => {
                Severity: Minor
                Found in src/support/calculateProgress.ts - About 1 hr 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 AlterRoleButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                export function AlterRoleButton(props: AlterRoleButtonProps) {
                  function isDisabled(): boolean {
                    if (props.mode === AlterRoleButtonMode.PROMOTE) {
                      return props.membership.role === "admin";
                    }
                Severity: Minor
                Found in src/modules/manage-team/sections/member/AlterRoleButton.tsx - About 55 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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  render() {
                    const { liked, post } = this.props;
                
                    const allLikes = post.votes.length
                      ? post.votes.map((item) => item.voter.name).join(", ")
                Severity: Minor
                Found in src/modules/feed/components/Transaction/LikeButton.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 InviteList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                const InviteList = () => (
                  <div>
                    <Query<InvitesResult>
                      query={GET_INVITES}
                      pollInterval={2000}
                Severity: Minor
                Found in src/modules/choose-team/components/InviteList.tsx - 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

                Avoid too many return statements within this function.
                Open

                      return;
                Severity: Major
                Found in src/modules/feed/components/CreatePost/CreatePost.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return true;
                  Severity: Major
                  Found in src/modules/user/ResetPasswordPage.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return false;
                    Severity: Major
                    Found in src/modules/user/ResetPasswordPage.tsx - About 30 mins to fix

                      Function onSubmit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        onSubmit(
                          e: FormEvent<HTMLFormElement>,
                          createPost: any,
                          client: ApolloClient<any>,
                        ) {
                      Severity: Minor
                      Found in src/modules/feed/components/CreatePost/CreatePost.tsx - About 25 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 Invite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function Invite(props: InviteProps) {
                        const showConfirmDialog = (
                          deleteInvite: MutationFunction<
                            DeleteInviteParameters,
                            OperationVariables,
                      Severity: Minor
                      Found in src/modules/manage-team/sections/invite/Invite.tsx - About 25 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