ctrl-alt-del-world/midway

View on GitHub

Showing 45 of 47 total issues

Function Activate has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Activate = (props: { id: string; token: string }) => {
  const [passwordField1, setPasswordField1] = useState("")
  const [passwordField2, setPasswordField2] = useState("")
  const [attempts, setAttempts] = useState(0)

Severity: Major
Found in web/src/components/auth/activate.tsx - About 4 hrs to fix

    Function SEO has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    export const SEO = ({
      defaultMeta,
      defaultTitle,
      pagePath,
      metaInfo,
    Severity: Minor
    Found in web/src/components/SEO.tsx - About 4 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 handler has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const handler = async (event: APIGatewayEvent): Promise<any> => {
      if (event.httpMethod !== 'POST' || !event.body) {
        return statusReturn(400, '')
      }
    
    
    Severity: Major
    Found in web/src/lambda/shopify-sync.ts - About 3 hrs to fix

      Function Reset has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Reset = (props: {
        path: string
        id?: string
        token?: string
      }) => {
      Severity: Major
      Found in web/src/components/auth/reset.tsx - About 3 hrs to fix

        Function getIcon has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const getIcon = (name, color = 'currentColor') => {
          switch (name) {
            case 'facebook':
              return (
                <path
        Severity: Major
        Found in web/src/components/icon.tsx - About 3 hrs to fix

          Function updateEverything has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const updateEverything = async (data: {
            id: number
            title: string
            variants: any[]
            handle: string
          Severity: Major
          Found in web/src/lambda/shopify-sync.ts - About 3 hrs to fix

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

            export const handler = async (event: APIGatewayEvent): Promise<any> => {
              if (event.httpMethod !== 'POST' || !event.body) {
                return statusReturn(400, '')
              }
            
            
            Severity: Minor
            Found in web/src/lambda/shopify-sync.ts - 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 createAllPages has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.createAllPages = (
              promiseResults,
              actions,
              resolve,
              reject
            Severity: Major
            Found in web/src/build/createPages.js - About 3 hrs to fix

              Function Orders has 78 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const Orders = () => {
                const {customerToken} = useStore()
                const [orders, setOrders] = useState([])
                const handleOrders = useCallback(
                  (token) =>
              Severity: Major
              Found in web/src/components/auth/orders.tsx - About 3 hrs to fix

                Function ProductForm has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                export const ProductForm = ({ slug, defaultPrice, productId, showQuantity, waitlist = true, addText }: {
                  defaultPrice: string
                  slug?: {
                    current: string
                  }
                Severity: Minor
                Found in web/src/components/product/form.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

                File siteContext.tsx has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                {
                /*
                  Orginal Author of this file: https://github.com/thetrevorharmon
                  Orginal File: https://github.com/thetrevorharmon/sell-things-fast/blob/master/src/context/StoreContext.js
                
                
                Severity: Minor
                Found in web/src/context/siteContext.tsx - About 2 hrs to fix

                  Function CartDrawer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const CartDrawer = () => {
                    const lineItems = useCartItems()
                    const { cartIsOpen } = useStore()
                    const { total } = useCartTotals()
                    const toggleCart = useToggleCart()
                  Severity: Major
                  Found in web/src/components/cartDrawer.tsx - About 2 hrs to fix

                    Function handler has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const handler = async (event: APIGatewayEvent): Promise<any> => {
                      // TEST for POST request
                      if (event.httpMethod !== 'POST' || !event.body) {
                        return statusReturn(400, '')
                      }
                    Severity: Major
                    Found in web/src/lambda/register.ts - About 2 hrs to fix

                      Function handler has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const handler = async (event: APIGatewayEvent): Promise<any> => {
                      
                        // TEST for POST request
                        if (event.httpMethod !== 'POST' || !event.body) {
                          return statusReturn(400, '')
                      Severity: Major
                      Found in web/src/lambda/reset-password.ts - About 2 hrs to fix

                        Function handler has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const handler = async (event: APIGatewayEvent): Promise<any> => {
                          if (event.httpMethod !== 'POST' || !event.body) return statusReturn(400, {})
                        
                          try {
                            data = JSON.parse(event.body)
                        Severity: Minor
                        Found in web/src/lambda/login.ts - About 1 hr to fix

                          Function Activate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const Activate = (props: { id: string; token: string }) => {
                            const [passwordField1, setPasswordField1] = useState("")
                            const [passwordField2, setPasswordField2] = useState("")
                            const [attempts, setAttempts] = useState(0)
                          
                          
                          Severity: Minor
                          Found in web/src/components/auth/activate.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 Register has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const Register = ({path}: {path: string}) => {
                            const [passwordField1, setPasswordField1] = useState("")
                            const [passwordField2, setPasswordField2] = useState("")
                            const form = React.createRef() as React.RefObject<HTMLFormElement>
                            const [attempts, setAttempts] = useState(0)
                          Severity: Minor
                          Found in web/src/components/auth/register.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 verifyAccount has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              async e => {
                                setAttempts(attempts + 1)
                          
                                if (passwordField1 !== passwordField2) {
                                  await Timeout.set(400)
                          Severity: Minor
                          Found in web/src/components/auth/activate.tsx - About 1 hr to fix

                            Function handler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const handler = async (event: APIGatewayEvent): Promise<any> => {
                              if (event.httpMethod !== "POST" || !event.body) return statusReturn(400, '')
                            
                              try {
                                data = JSON.parse(event.body)
                            Severity: Minor
                            Found in web/src/lambda/forgot-password.ts - About 1 hr to fix

                              Function handleRegister has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  async (email, password, firstName, lastName) => {
                                    setAttempts(attempts + 1)
                              
                                    if (!PasswordSchema.validate(passwordField1)) {
                                      throw new Error(
                              Severity: Minor
                              Found in web/src/components/auth/register.tsx - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language