TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Avoid too many return statements within this function.
Open

            return t(`One week ago`);
Severity: Major
Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return t('{{amount}} years ago', {amount: Math.floor(diff)});
    Severity: Major
    Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return t('{{amount}} weeks ago', {amount: Math.floor(diff)});
      Severity: Major
      Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return t(`One day ago`);
        Severity: Major
        Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return t(`One hour ago`);
          Severity: Major
          Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return {save: parsedUrl.toString(), display: parsedUrl.toString()};
            Severity: Major
            Found in apps/admin-x-design-system/src/utils/formatUrl.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return t('Yesterday');
              Severity: Major
              Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return t('{{amount}} hrs ago', {amount: Math.floor(diff)});
                Severity: Major
                Found in apps/comments-ui/src/utils/helpers.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return {
                                  isExternal: true,
                                  route: `offers/${action.resource.id}`,
                                  models: [action.resource.id]
                              };
                  Severity: Major
                  Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return;
                    Severity: Major
                    Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return;
                      Severity: Major
                      Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return;
                        Severity: Major
                        Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return;
                          Severity: Major
                          Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return {
                                            isExternal: true,
                                            route: 'tag',
                                            models: [action.resource.slug]
                                        };
                            Severity: Major
                            Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return;
                              Severity: Major
                              Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return {route: `staff/${action.resource.slug}`};
                                Severity: Major
                                Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return {route: `staff/${action.actor.slug}`};
                                  Severity: Major
                                  Found in apps/admin-x-framework/src/api/actions.ts - About 30 mins to fix

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

                                        async import(quantity) {
                                            if (quantity === 0) {
                                                return;
                                            }
                                    
                                    
                                    Severity: Minor
                                    Found in ghost/data-generator/lib/importers/MembersStripeCustomersImporter.js - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

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

                                    export default function getScrollParent(node) {
                                        const isElement = node instanceof HTMLElement;
                                        const overflowY = isElement && window.getComputedStyle(node).overflowY;
                                        const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
                                    
                                    
                                    Severity: Minor
                                    Found in ghost/admin/app/utils/get-scroll-parent.js - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

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

                                    export function ghPriceAmount(amount, {cents = true} = {}) {
                                        if (amount) {
                                            let price = cents ? amount / 100 : Math.round(amount / 100);
                                            if (price % 1 === 0) {
                                                return formatNumber(price);
                                    Severity: Minor
                                    Found in ghost/admin/app/helpers/gh-price-amount.js - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language