TryGhost/Ghost

View on GitHub
apps/admin-x-activitypub/src/components/feed/FeedItem.tsx

Summary

Maintainability
F
1 wk
Test Coverage

File FeedItem.tsx has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import APAvatar from '../global/APAvatar';
import React, {useState} from 'react';
import getRelativeTimestamp from '../../utils/get-relative-timestamp';
import getUsername from '../../utils/get-username';
import {ActorProperties, ObjectProperties} from '@tryghost/admin-x-framework/api/activitypub';
Severity: Minor
Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - About 2 hrs to fix

    Function FeedItem has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    const FeedItem: React.FC<FeedItemProps> = ({actor, object, layout, type, last}) => {
        const timestamp =
            new Date(object?.published ?? new Date()).toLocaleDateString('default', {year: 'numeric', month: 'short', day: '2-digit'}) + ', ' + new Date(object?.published ?? new Date()).toLocaleTimeString('default', {hour: '2-digit', minute: '2-digit'});
    
        const date = new Date(object?.published ?? new Date());
    Severity: Minor
    Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - 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 renderInboxAttachment has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function renderInboxAttachment(object: ObjectProperties) {
        let attachment;
        if (object.image) {
            attachment = object.image;
        }
    Severity: Major
    Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - About 2 hrs to fix

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

      export function renderFeedAttachment(object: ObjectProperties, layout: string) {
          let attachment;
          if (object.image) {
              attachment = object.image;
          }
      Severity: Minor
      Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - About 1 hr to fix

        Function renderFeedAttachment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export function renderFeedAttachment(object: ObjectProperties, layout: string) {
            let attachment;
            if (object.image) {
                attachment = object.image;
            }
        Severity: Minor
        Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

        Consider simplifying this complex logical expression.
        Open

            } else if (layout === 'reply') {
                return (
                    <>
                        {object && (
                            <div className={`group/article relative cursor-pointer pt-5`}>
        Severity: Major
        Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - About 40 mins to fix

          Avoid too many return statements within this function.
          Open

              return (<></>);
          Severity: Major
          Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - About 30 mins to fix

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

            function renderInboxAttachment(object: ObjectProperties) {
                let attachment;
                if (object.image) {
                    attachment = object.image;
                }
            Severity: Minor
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx - 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

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

                                            <div className='relative z-10 flex w-full flex-col overflow-visible text-[1.5rem]'>
                                                <div className='flex'>
                                                    <span className='truncate whitespace-nowrap font-bold' data-test-activity-heading>{author.name}</span>
                                                    <span className='whitespace-nowrap text-grey-700 before:mx-1 before:content-["·"]' title={`${timestamp}`}>{getRelativeTimestamp(date)}</span>
                                                </div>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 5 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 429..437
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 172..180
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 262..270

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

            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 4 locations. Consider refactoring.
            Open

                                        <div className='relative z-10 flex w-full flex-col overflow-visible text-[1.5rem]'>
                                            <div className='flex'>
                                                <span className='truncate whitespace-nowrap font-bold' data-test-activity-heading>{author.name}</span>
                                                <span className='whitespace-nowrap text-grey-700 before:mx-1 before:content-["·"]' title={`${timestamp}`}>{getRelativeTimestamp(date)}</span>
                                            </div>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 5 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 429..437
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 214..222
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 262..270

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

            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 4 locations. Consider refactoring.
            Open

                                        <div className='relative z-10 flex w-full flex-col overflow-visible text-[1.5rem]'>
                                            <div className='flex'>
                                                <span className='truncate whitespace-nowrap font-bold' data-test-activity-heading>{author.name}</span>
                                                <span className='whitespace-nowrap text-grey-700 before:mx-1 before:content-["·"]' title={`${timestamp}`}>{getRelativeTimestamp(date)}</span>
                                            </div>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 5 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 429..437
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 172..180
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 214..222

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

            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 4 locations. Consider refactoring.
            Open

                                                <div className='mt-3 flex gap-2'>
                                                    <Button className={`self-start text-grey-500 transition-all hover:text-grey-800 ${isClicked ? 'bump' : ''} ${isLiked ? 'ap-red-heart text-red *:!fill-red hover:text-red' : ''}`} hideLabel={true} icon='heart' id='like' size='md' unstyled={true} onClick={handleLikeClick}/>
                                                    <span className={`text-grey-800 ${isLiked ? 'opacity-100' : 'opacity-0'}`}>1</span>
                                                </div>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 4 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 444..447
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 474..477
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 518..521

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

            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

                    return (
                        <div className={`attachment-gallery mt-2 grid ${gridClass} gap-2`}>
                            {attachment.map((item, index) => (
                                <img key={item.url} alt={`attachment-${index}`} className={`h-full w-full rounded-md object-cover ${attachmentCount === 3 && index === 0 ? 'row-span-2' : ''}`} src={item.url} />
                            ))}
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 4 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 354..360

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

            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 4 locations. Consider refactoring.
            Open

                                    {(type === 'Announce' && object.type === 'Note') && <div className='z-10 mb-2 flex items-center gap-3 text-grey-700'>
                                        <div className='z-10 flex w-10 justify-end'><Icon colorClass='text-grey-700' name='reload' size={'sm'}></Icon></div>
                                        <span className='z-10'>{actor.name} reposted</span>
                                    </div>}
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 3 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 422..425
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 205..208
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 253..256

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

            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 4 locations. Consider refactoring.
            Open

                                        {(type === 'Announce' && object.type === 'Note') && <div className='z-10 mb-2 flex items-center gap-3 text-grey-700'>
                                            <div className='z-10 flex w-10 justify-end'><Icon colorClass='text-grey-700' name='reload' size={'sm'}></Icon></div>
                                            <span className='z-10'>{actor.name} reposted</span>
                                        </div>}
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 3 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 422..425
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 163..166
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 253..256

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

            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 4 locations. Consider refactoring.
            Open

                                    {(type === 'Announce' && object.type === 'Note') && <div className='z-10 mb-2 flex items-center gap-3 text-grey-700'>
                                        <div className='z-10 flex w-10 justify-end'><Icon colorClass='text-grey-700' name='reload' size={'sm'}></Icon></div>
                                        <span className='z-10'>{actor.name} reposted</span>
                                    </div>}
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 3 other locations - About 3 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 422..425
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 163..166
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 205..208

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

            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

                                                    <div className='mt-3 flex gap-1'>
                                                        <Button className={`self-start text-grey-900`} hideLabel={true} icon='comment' id='like' size='md' unstyled={true} onClick={handleLikeClick}/>
                                                        <span className={`text-grey-900`}>2</span>
                                                    </div>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 3 hrs to fix
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 276..279

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

            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

                                                <div className='mt-3 flex gap-1'>
                                                    <Button className={`self-start text-grey-900`} hideLabel={true} icon='comment' id='like' size='md' unstyled={true} onClick={handleLikeClick}/>
                                                    <span className={`text-grey-900`}>1</span>
                                                </div>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 3 hrs to fix
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 232..235

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

            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 timestamp =
                    new Date(object?.published ?? new Date()).toLocaleDateString('default', {year: 'numeric', month: 'short', day: '2-digit'}) + ', ' + new Date(object?.published ?? new Date()).toLocaleTimeString('default', {hour: '2-digit', minute: '2-digit'});
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 2 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 397..398

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

            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 3 locations. Consider refactoring.
            Open

                const handleLikeClick = (event: React.MouseEvent<HTMLElement> | undefined) => {
                    event?.stopPropagation();
                    setIsClicked(true);
                    setIsLiked(!isLiked);
                    setTimeout(() => setIsClicked(false), 300); // Reset the animation class after 300ms
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 2 other locations - About 2 hrs to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 405..410
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 498..503

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

            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

                case 'audio/ogg':
                    return (
                        <div className='min-w-[160px]'>
                            <div className='relative mb-4 mt-2 w-full'>
                                <audio className='w-full' src={attachment.url} controls/>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 1 hr to fix
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 106..113

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

            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

                case 'video/webm':
                    return (
                        <div className='min-w-[160px]'>
                            <div className='relative mb-4 mt-2'>
                                <video className='h-[300px] w-full rounded object-cover' src={attachment.url} controls/>
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 1 hr to fix
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 116..123

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

            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 (type === 'Announce' && object.type === 'Note') {
                    author = typeof object.attributedTo === 'object' ? object.attributedTo as ActorProperties : actor;
                }
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 1 hr to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 413..415

            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

                    if (layout === 'modal') {
                        gridClass = 'grid-cols-1'; // Single image, full width
                    } else if (attachmentCount === 2) {
                        gridClass = 'grid-cols-2 auto-rows-[150px]'; // Two images, side by side
                    } else if (attachmentCount === 3 || attachmentCount === 4) {
            Severity: Minor
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 1 other location - About 45 mins to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 346..352

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

            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 3 locations. Consider refactoring.
            Open

                case 'audio/ogg':
                    return <div className='relative mb-4 mt-2 w-full'>
                        <audio className='w-full' src={attachment.url} controls/>
                    </div>;
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 2 other locations - About 45 mins to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 375..378
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 49..52

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

            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 3 locations. Consider refactoring.
            Open

                case 'video/webm':
                    return <div className='relative mb-4 mt-2'>
                        <video className='h-[300px] w-full rounded object-cover' src={attachment.url} controls/>
                    </div>;
            Severity: Major
            Found in apps/admin-x-activitypub/src/components/feed/FeedItem.tsx and 2 other locations - About 45 mins to fix
            apps/admin-x-activitypub/src/components/_ObsoleteListIndex.tsx on lines 375..378
            apps/admin-x-activitypub/src/components/feed/FeedItem.tsx on lines 55..58

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

            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