gil--/gatsby-starter-shopifypwa

View on GitHub

Showing 31 of 31 total issues

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

                        <Mutation mutation={CUSTOMER_RESET}>
                            {(resetPassword, { loading }) => {
                                return (
                                    <Formik
                                        initialValues={{
Severity: Major
Found in src/pages/account/reset.js and 1 other location - About 3 days to fix
src/pages/account/activate.js on lines 75..144

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

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

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

                        <Mutation mutation={CUSTOMER_ACTIVATE}>
                            {(activateAccount, { loading }) => {
                                return (
                                    <Formik
                                        initialValues={{
Severity: Major
Found in src/pages/account/activate.js and 1 other location - About 3 days to fix
src/pages/account/reset.js on lines 74..143

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

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

Function render has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        return (
            <StaticQuery
                query={graphql`
                    query settings {
Severity: Major
Found in src/components/AddToCart.js - About 3 hrs to fix

    Function render has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render() {
            const pageContent = (
                <ContextConsumer>
                    {({ set }) => {
                        return <>
    Severity: Major
    Found in src/pages/account/activate.js - About 3 hrs to fix

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

                                                  <li>
                                                      <label htmlFor="forgotEmail">Email</label>
                                                      <input id="forgotEmail" type="email" name="email" value={values.email} onChange={handleChange} required="" ref={this.firstInput} />
                                                      <ErrorMessage component="div" name="email" />
                                                  </li>
      Severity: Major
      Found in src/pages/account/forgotpassword.js and 1 other location - About 3 hrs to fix
      src/pages/account/login.js on lines 98..102

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

      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

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

                                                          <li>
                                                              <label htmlFor="loginEmail">Email</label>
                                                              <input id="loginEmail" type="email" name="email" value={values.email} onChange={handleChange} required="" ref={this.firstInput} />
                                                              <ErrorMessage component="div" name="email" />
                                                          </li>
      Severity: Major
      Found in src/pages/account/login.js and 1 other location - About 3 hrs to fix
      src/pages/account/forgotpassword.js on lines 87..91

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

      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

      Function render has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render() {
              const pageContent = (
                  <ContextConsumer>
                      {({ set }) => {
                          return <>
      Severity: Major
      Found in src/pages/account/reset.js - About 3 hrs to fix

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

            componentDidMount() {
                const params = new URLSearchParams(document.location.search.substring(1))
                const customerId = window.btoa(`gid://shopify/Customer/${params.get('id')}`)
                const activationToken = params.get('token')
        
        
        Severity: Major
        Found in src/pages/account/activate.js and 1 other location - About 3 hrs to fix
        src/pages/account/reset.js on lines 57..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 104.

        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

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

            componentDidMount() {
                const params = new URLSearchParams(document.location.search.substring(1))
                const customerId = window.btoa(`gid://shopify/Customer/${params.get('id')}`)
                const resetToken = params.get('token')
        
        
        Severity: Major
        Found in src/pages/account/reset.js and 1 other location - About 3 hrs to fix
        src/pages/account/activate.js on lines 57..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 104.

        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

        Function render has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render () {
                const pageContent = (
                    <ContextConsumer>
                        {({ set }) => {
                            return <>
        Severity: Major
        Found in src/pages/account/login.js - About 3 hrs to fix

          Function render has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render() {
                  const pageContent = (
                      <>
                          <h1>Sign Up</h1>
                          <Mutation mutation={CUSTOMER_CREATE}
          Severity: Major
          Found in src/pages/account/register.js - About 3 hrs to fix

            Function render has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                render() {
                    return (
                        <AccountLayout>
                            <h1>Account Dashboard</h1>
                            <ContextConsumer>
            Severity: Major
            Found in src/pages/account/index.js - About 2 hrs to fix

              Function render has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  render() {
                      const pageContent = (
                          <>
                              <h1>Forgot Your Password</h1>
                              <Mutation mutation={CUSTOMER_RESET}>
              Severity: Major
              Found in src/pages/account/forgotpassword.js - About 2 hrs to fix

                Function render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    render() {
                        const product = this.props.data.shopify.shop.productByHandle
                
                        let variant = this.state.selectedVariant || product.variants.edges[0].node
                        let variantImage = this.state.selectedVariantImage || product.images.edges[0].node.src
                Severity: Major
                Found in src/templates/product.js - About 2 hrs to fix

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

                  const FormSchema = Yup.object().shape({
                      password: Yup.string()
                          .required('Password is Required'),
                      passwordVerification: Yup.string()
                          .oneOf([Yup.ref('password')], 'Password and confirmation must been the same')
                  Severity: Major
                  Found in src/pages/account/reset.js and 1 other location - About 2 hrs to fix
                  src/pages/account/activate.js on lines 30..36

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

                  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

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

                  const FormSchema = Yup.object().shape({
                      password: Yup.string()
                          .required('Password is Required'),
                      passwordVerification: Yup.string()
                          .oneOf([Yup.ref('password')], 'Password and confirmation must been the same')
                  Severity: Major
                  Found in src/pages/account/activate.js and 1 other location - About 2 hrs to fix
                  src/pages/account/reset.js on lines 30..36

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

                  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

                  Function render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      render() {
                          if (!this.props.products) {
                              return <p>Your cart is currently empty.</p>
                          }
                  
                  
                  Severity: Major
                  Found in src/components/checkout/CartTable.js - About 2 hrs to fix

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

                            if (productsCache.data.shopify.shop.products.pageInfo.hasNextPage) {
                                await getMoreProducts(currentCursor = productsCache.data.shopify.shop.products.edges[productsCache.data.shopify.shop.products.edges.length - 1].cursor)
                            }
                    Severity: Major
                    Found in gatsby-node.js and 1 other location - About 1 hr to fix
                    gatsby-node.js on lines 80..82

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

                    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

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

                        if (productsCache.data.shopify.shop.products.pageInfo.hasNextPage) {
                            await getMoreProducts(currentCursor = productsCache.data.shopify.shop.products.edges[productsCache.data.shopify.shop.products.edges.length - 1].cursor)
                        }
                    Severity: Major
                    Found in gatsby-node.js and 1 other location - About 1 hr to fix
                    gatsby-node.js on lines 47..49

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

                    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

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

                    const FormSchema = Yup.object().shape({
                        email: Yup.string()
                            .email('Invalid email address')
                            .required('Email is Required'),
                        password: Yup.string()
                    Severity: Major
                    Found in src/pages/account/register.js and 1 other location - About 1 hr to fix
                    src/pages/account/login.js on lines 27..33

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

                    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