TryGhost/Ghost

View on GitHub
apps/portal/src/App.js

Summary

Maintainability
F
1 wk
Test Coverage

File App.js has 821 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import * as Sentry from '@sentry/react';
import TriggerButton from './components/TriggerButton';
import Notification from './components/Notification';
import PopupModal from './components/PopupModal';
Severity: Major
Found in apps/portal/src/App.js - About 1 day to fix

    Function fetchQueryStrData has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        fetchQueryStrData(qs = '') {
            const qsParams = new URLSearchParams(qs);
            const data = {
                site: {
                    plans: {}
    Severity: Minor
    Found in apps/portal/src/App.js - About 5 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

    App has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class App extends React.Component {
        constructor(props) {
            super(props);
    
            this.setupCustomTriggerButton(props);
    Severity: Minor
    Found in apps/portal/src/App.js - About 3 hrs to fix

      Function fetchQueryStrData has 93 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          fetchQueryStrData(qs = '') {
              const qsParams = new URLSearchParams(qs);
              const data = {
                  site: {
                      plans: {}
      Severity: Major
      Found in apps/portal/src/App.js - About 3 hrs to fix

        Function getPageFromLinkPath has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getPageFromLinkPath(path, useSite) {
                const customPricesSignupRegex = /^signup\/?(?:\/(\w+?))?\/?$/;
                const customMonthlyProductSignup = /^signup\/?(?:\/(\w+?))\/monthly\/?$/;
                const customYearlyProductSignup = /^signup\/?(?:\/(\w+?))\/yearly\/?$/;
                const customOfferRegex = /^offers\/(\w+?)\/?$/;
        Severity: Major
        Found in apps/portal/src/App.js - About 3 hrs to fix

          Function fetchLinkData has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              fetchLinkData(site) {
                  const qParams = new URLSearchParams(window.location.search);
                  if (qParams.get('uuid') && qParams.get('action') === 'unsubscribe') {
                      return {
                          showPopup: true,
          Severity: Minor
          Found in apps/portal/src/App.js - 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 setupFirstPromoter has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              setupFirstPromoter({site, member}) {
                  if (hasMode(['test'])) {
                      return null;
                  }
                  const firstPromoterId = getFirstpromoterId({site});
          Severity: Minor
          Found in apps/portal/src/App.js - About 2 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 getPageFromLinkPath has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              getPageFromLinkPath(path, useSite) {
                  const customPricesSignupRegex = /^signup\/?(?:\/(\w+?))?\/?$/;
                  const customMonthlyProductSignup = /^signup\/?(?:\/(\w+?))\/monthly\/?$/;
                  const customYearlyProductSignup = /^signup\/?(?:\/(\w+?))\/yearly\/?$/;
                  const customOfferRegex = /^offers\/(\w+?)\/?$/;
          Severity: Minor
          Found in apps/portal/src/App.js - About 2 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 fetchLinkData has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              fetchLinkData(site) {
                  const qParams = new URLSearchParams(window.location.search);
                  if (qParams.get('uuid') && qParams.get('action') === 'unsubscribe') {
                      return {
                          showPopup: true,
          Severity: Major
          Found in apps/portal/src/App.js - About 2 hrs to fix

            Function handleOfferQuery has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                async handleOfferQuery({site, offerId, member = this.state.member}) {
                    const {portal_button: portalButton} = site;
                    removePortalLinkFromUrl();
                    if (!isPaidMember({member})) {
                        try {
            Severity: Minor
            Found in apps/portal/src/App.js - About 2 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 fetchOfferQueryStrData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                fetchOfferQueryStrData(qs = '') {
                    const qsParams = new URLSearchParams(qs);
                    const data = {};
                    // Handle the query params key/value pairs
                    for (let pair of qsParams.entries()) {
            Severity: Minor
            Found in apps/portal/src/App.js - About 2 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 initSetup has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async initSetup() {
                    try {
                        // Fetch data from API, links, preview, dev sources
                        const {site, member, page, showPopup, popupNotification, lastPage, pageQuery, pageData} = await this.fetchData();
                        const i18nLanguage = this.props.siteI18nEnabled ? site.locale : 'en';
            Severity: Minor
            Found in apps/portal/src/App.js - About 1 hr to fix

              Function fetchOfferQueryStrData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  fetchOfferQueryStrData(qs = '') {
                      const qsParams = new URLSearchParams(qs);
                      const data = {};
                      // Handle the query params key/value pairs
                      for (let pair of qsParams.entries()) {
              Severity: Minor
              Found in apps/portal/src/App.js - About 1 hr to fix

                Function setupFirstPromoter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    setupFirstPromoter({site, member}) {
                        if (hasMode(['test'])) {
                            return null;
                        }
                        const firstPromoterId = getFirstpromoterId({site});
                Severity: Minor
                Found in apps/portal/src/App.js - About 1 hr to fix

                  Function dispatchAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async dispatchAction(action, data) {
                          clearTimeout(this.timeoutId);
                          this.setState({
                              action: `${action}:running`
                          });
                  Severity: Minor
                  Found in apps/portal/src/App.js - About 1 hr to fix

                    Function handleOfferQuery has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        async handleOfferQuery({site, offerId, member = this.state.member}) {
                            const {portal_button: portalButton} = site;
                            removePortalLinkFromUrl();
                            if (!isPaidMember({member})) {
                                try {
                    Severity: Minor
                    Found in apps/portal/src/App.js - About 1 hr to fix

                      Function fetchData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          async fetchData() {
                              const {site: apiSiteData, member} = await this.fetchApiData();
                              const {site: devSiteData, ...restDevData} = this.fetchDevData();
                              const {site: linkSiteData, ...restLinkData} = this.fetchLinkData(apiSiteData);
                              const {site: previewSiteData, ...restPreviewData} = this.fetchPreviewData();
                      Severity: Minor
                      Found in apps/portal/src/App.js - About 1 hr to fix

                        Function getContextMember has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            getContextMember({page, member, customSiteUrl}) {
                                if (hasMode(['dev', 'preview'], {customSiteUrl})) {
                                    /** Use dummy member(free or paid) for account pages in dev/preview mode*/
                                    if (isAccountPage({page}) || isOfferPage({page})) {
                                        if (hasMode(['dev'], {customSiteUrl})) {
                        Severity: Minor
                        Found in apps/portal/src/App.js - 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 componentDidUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            componentDidUpdate(prevProps, prevState) {
                                /**Handle custom trigger class change on popup open state change */
                                if (prevState.showPopup !== this.state.showPopup) {
                                    this.handleCustomTriggerClassUpdate();
                        
                        
                        Severity: Minor
                        Found in apps/portal/src/App.js - 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 setupCustomTriggerButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            setupCustomTriggerButton() {
                                // Handler for custom buttons
                                this.clickHandler = (event) => {
                                    event.preventDefault();
                                    const target = event.currentTarget;
                        Severity: Minor
                        Found in apps/portal/src/App.js - 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

                        Consider simplifying this complex logical expression.
                        Open

                                if (path && linkRegex.test(path)) {
                                    const [,pagePath] = path.match(linkRegex);
                                    const {page, pageQuery, pageData} = this.getPageFromLinkPath(pagePath, site) || {};
                                    const lastPage = ['accountPlan', 'accountProfile'].includes(page) ? 'accountHome' : null;
                                    const showPopup = (
                        Severity: Major
                        Found in apps/portal/src/App.js - About 40 mins to fix

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

                              setupSentry({site}) {
                                  if (hasMode(['test'])) {
                                      return null;
                                  }
                                  const {portal_sentry: portalSentry, portal_version: portalVersion, version: ghostVersion} = site;
                          Severity: Minor
                          Found in apps/portal/src/App.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 handleSignupQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              handleSignupQuery({site, pageQuery, member}) {
                                  const offerQueryRegex = /^offers\/(\w+?)\/?$/;
                                  let priceId = pageQuery;
                                  if (offerQueryRegex.test(pageQuery || '')) {
                                      const [, offerId] = pageQuery.match(offerQueryRegex);
                          Severity: Minor
                          Found in apps/portal/src/App.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 fetchNotificationData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              fetchNotificationData() {
                                  const {type, status, duration, autoHide, closeable} = NotificationParser({billingOnly: true}) || {};
                                  if (['stripe:billing-update'].includes(type)) {
                                      if (status === 'success') {
                                          const popupNotification = createPopupNotification({
                          Severity: Minor
                          Found in apps/portal/src/App.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 getContextPage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              getContextPage({site, page, member}) {
                                  /**Set default page based on logged-in status */
                                  if (!page || page === 'default') {
                                      const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup';
                                      page = member ? 'accountHome' : loggedOutPage;
                          Severity: Minor
                          Found in apps/portal/src/App.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

                          Avoid too many return statements within this function.
                          Open

                                      return {
                                          page: 'signup',
                                          pageQuery: 'free'
                                      };
                          Severity: Major
                          Found in apps/portal/src/App.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return {};
                            Severity: Major
                            Found in apps/portal/src/App.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return {
                                              page: 'signup',
                                              pageQuery: `${productId}/yearly`
                                          };
                              Severity: Major
                              Found in apps/portal/src/App.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return {
                                                page: 'supportError'
                                            };
                                Severity: Major
                                Found in apps/portal/src/App.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return {
                                                  page: 'signup',
                                                  pageQuery: 'yearly'
                                              };
                                  Severity: Major
                                  Found in apps/portal/src/App.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return {
                                                    page: 'accountEmail'
                                                };
                                    Severity: Major
                                    Found in apps/portal/src/App.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return {
                                                      page: 'signup',
                                                      pageQuery: pageQuery
                                                  };
                                      Severity: Major
                                      Found in apps/portal/src/App.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return {
                                                        page: 'accountHome'
                                                    };
                                        Severity: Major
                                        Found in apps/portal/src/App.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return {
                                                          page: 'signup',
                                                          pageQuery: 'monthly'
                                                      };
                                          Severity: Major
                                          Found in apps/portal/src/App.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return {
                                                            page: 'support'
                                                        };
                                            Severity: Major
                                            Found in apps/portal/src/App.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                          return {
                                                              page: 'signin'
                                                          };
                                              Severity: Major
                                              Found in apps/portal/src/App.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        return {
                                                            page: 'default'
                                                        };
                                                Severity: Major
                                                Found in apps/portal/src/App.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return {
                                                                  page: 'accountProfile'
                                                              };
                                                  Severity: Major
                                                  Found in apps/portal/src/App.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                            return member;
                                                    Severity: Major
                                                    Found in apps/portal/src/App.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                  return {
                                                                      page: 'supportSuccess'
                                                                  };
                                                      Severity: Major
                                                      Found in apps/portal/src/App.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                    return {
                                                                        page: 'recommendations',
                                                                        pageData: {
                                                                            signup: false
                                                                        }
                                                        Severity: Major
                                                        Found in apps/portal/src/App.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                      return {
                                                                          page: 'accountPlan'
                                                                      };
                                                          Severity: Major
                                                          Found in apps/portal/src/App.js - About 30 mins to fix

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

                                                                        try {
                                                                            if (this.state.showPopup) {
                                                                                /** When modal is opened, store current overflow and set as hidden */
                                                                                this.bodyScroll = window.document?.body?.style?.overflow;
                                                                                window.document.body.style.overflow = 'hidden';
                                                            Severity: Major
                                                            Found in apps/portal/src/App.js and 1 other location - About 4 hrs to fix
                                                            apps/sodo-search/src/App.js on lines 33..44

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

                                                            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

                                                                                    if (member) {
                                                                                        const {tierId, cadence} = getProductCadenceFromPrice({site, priceId: price.id});
                                                                                        this.dispatchAction('checkoutPlan', {plan: price.id, offerId, tierId, cadence});
                                                                                    } else {
                                                            Severity: Major
                                                            Found in apps/portal/src/App.js and 1 other location - About 2 hrs to fix
                                                            apps/portal/src/App.js on lines 697..700

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

                                                            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

                                                                                    } else {
                                                                                        const {tierId, cadence} = getProductCadenceFromPrice({site, priceId: price.id});
                                                                                        this.dispatchAction('signup', {plan: price.id, offerId, tierId, cadence});
                                                                                    }
                                                            Severity: Major
                                                            Found in apps/portal/src/App.js and 1 other location - About 2 hrs to fix
                                                            apps/portal/src/App.js on lines 694..697

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

                                                            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

                                                                    const {site, member, action, page, lastPage, showPopup, pageQuery, pageData, popupNotification, customSiteUrl, t} = this.state;
                                                            Severity: Major
                                                            Found in apps/portal/src/App.js and 1 other location - About 1 hr to fix
                                                            ghost/core/core/server/services/members/middleware.js on lines 379..391

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

                                                            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

                                                                sendPortalReadyEvent() {
                                                                    if (window.self !== window.parent) {
                                                                        window.parent.postMessage({
                                                                            type: 'portal-ready',
                                                                            payload: {}
                                                            Severity: Minor
                                                            Found in apps/portal/src/App.js and 1 other location - About 50 mins to fix
                                                            apps/portal/src/components/PopupModal.js on lines 134..141

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

                                                            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

                                                                            {
                                                                                id: 'monthly',
                                                                                stripe_price_id: 'dummy_stripe_monthly',
                                                                                stripe_product_id: 'dummy_stripe_product',
                                                                                active: 1,
                                                            Severity: Minor
                                                            Found in apps/portal/src/App.js and 1 other location - About 35 mins to fix
                                                            apps/portal/src/App.js on lines 384..394

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

                                                            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

                                                                            {
                                                                                id: 'yearly',
                                                                                stripe_price_id: 'dummy_stripe_yearly',
                                                                                stripe_product_id: 'dummy_stripe_product',
                                                                                active: 1,
                                                            Severity: Minor
                                                            Found in apps/portal/src/App.js and 1 other location - About 35 mins to fix
                                                            apps/portal/src/App.js on lines 373..383

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

                                                            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

                                                            There are no issues that match your filters.

                                                            Category
                                                            Status