TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function StylesWrapper has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const StylesWrapper = () => {
    return {
        modalContainer: {
            zIndex: '3999999',
            position: 'fixed',
Severity: Minor
Found in apps/portal/src/components/PopupModal.js - About 1 hr to fix

    Function getInputFields has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getInputFields({state, fieldNames}) {
            const {t} = this.context;
    
            const errors = state.errors || {};
            const fields = [
    Severity: Minor
    Found in apps/portal/src/components/pages/AccountProfilePage.js - About 1 hr to fix

      Function handleActivate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const handleActivate = async () => {
              try {
                  await activateTheme(theme.name);
                  showToast({
                      title: 'Theme activated',

        Function comments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                comments: state.comments.map((c) => {
                    const replies = c.replies.map((r) => {
                        if (r.id === comment.id) {
                            return {
                                ...r,
        Severity: Minor
        Found in apps/comments-ui/src/actions.ts - About 1 hr to fix

          Function comments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  comments: state.comments.map((c) => {
                      const replies = c.replies.map((r) => {
                          if (r.id === comment.id) {
                              return {
                                  ...r,
          Severity: Minor
          Found in apps/comments-ui/src/actions.ts - About 1 hr to fix

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

                getObject(event) {
                    if (event.type === 'signup_event' || event.type === 'subscription_event' || event.type === 'donation_event') {
                        if (event.data.attribution?.title) {
                            return event.data.attribution.title;
                        }
            Severity: Minor
            Found in ghost/admin/app/helpers/parse-member-event.js - 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 compute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                compute(
                    positionalParams,
                    {excludedEvents = [], includeEvents = null, member = '', post = '', excludeEmailEvents = false}
                ) {
                    const excludedEventsSet = new Set();
            Severity: Minor
            Found in ghost/admin/app/helpers/members-event-filter.js - 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 generate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                generate() {
                    this.count += 1;
            
                    const isActive = this.isActiveSubscriptionStatus(this.model.status);
                    if (this.count > 1 && isActive) {

            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 beforeSend has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            export function beforeSend(event, hint) {
                try {
                    const exception = hint.originalException;
                    event.tags = event.tags || {};
                    event.tags.shown_to_user = event.tags.shown_to_user || false;
            Severity: Minor
            Found in ghost/admin/app/utils/sentry.js - 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 statusCompare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function statusCompare(postA, postB) {
                let status1 = postA.get('status');
                let status2 = postB.get('status');
            
                // if any of those is empty
            Severity: Minor
            Found in ghost/admin/app/models/post.js - 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 buildIncludeURL has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                buildIncludeURL(store, modelName, id, snapshot, requestType, query) {
                    const url = this.buildURL(modelName, id, snapshot, requestType, query);
                    const parsedUrl = new URL(url);
            
                    if (snapshot?.adapterOptions?.newsletter) {
            Severity: Minor
            Found in ghost/admin/app/adapters/post.js - 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 handleIframeMessage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                @action
                async handleIframeMessage(event) {
                    if (this.isDestroyed || this.isDestroying) {
                        return;
                    }
            Severity: Minor
            Found in ghost/admin/app/components/gh-billing-iframe.js - 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 handleIframeMessage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                @action
                async handleIframeMessage(event) {
                    if (this.isDestroyed || this.isDestroying) {
                        return;
                    }
            Severity: Minor
            Found in ghost/admin/app/components/gh-explore-iframe.js - 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 _fetchEmailData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                async _fetchEmailData() {
                    let {html, subject} = this;
            
                    // Fetch newsletter
                    if (!this.newsletter && this.args.data.newsletter) {
            Severity: Minor
            Found in ghost/admin/app/components/modals/email-preview.js - 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 publishedAtBlogDate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                publishedAtBlogDate(model) {
                    let publishedAtBlogDate = model.publishedAtBlogDate;
                    let publishedAtBlogTime = model.publishedAtBlogTime;
            
                    if (!this._shouldValidatePublishedAtBlog(model)) {
            Severity: Minor
            Found in ghost/admin/app/validators/post.js - 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 getOfferData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                getOfferData(offer) {
                    if (offer) {
                        let offAmount = '';
                        let offDuration = '';
            
            
            Severity: Minor
            Found in ghost/staff-service/lib/StaffServiceEmails.js - 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 handleInvoiceEvent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                async handleInvoiceEvent(invoice) {
                    const {api, memberRepository, eventRepository, productRepository} = this.deps;
            
                    if (!invoice.subscription) {
                        // Check if this is a one time payment, related to a donation
            Severity: Minor
            Found in ghost/stripe/lib/services/webhook/InvoiceEventService.js - 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 _startVerificationProcess has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                async _startVerificationProcess({
                    amount,
                    throwOnTrigger,
                    source
                }) {
            Severity: Minor
            Found in ghost/verification-trigger/lib/VerificationTrigger.js - 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 forPost has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            const forPost = (id, attrs, frame) => {
                attrs.url = urlService.getUrlByResourceId(id, {absolute: true});
            
                /**
                 * CASE: admin api should serve preview urls

            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 populateDefaults has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                populateDefaults: async function populateDefaults(unfilteredOptions) {
                    const options = this.filterOptions(unfilteredOptions, 'populateDefaults');
                    const self = this;
            
                    if (!options.context) {
            Severity: Minor
            Found in ghost/core/core/server/models/settings.js - 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

            Severity
            Category
            Status
            Source
            Language