glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

export const EmptyAccount: React.FC<Props> = ({
  size = 46,
  minimal = false,
}) => {
  return (
Severity: Major
Found in app/javascript/mastodon/components/empty_account.tsx and 1 other location - About 7 hrs to fix
app/javascript/flavours/glitch/components/empty_account.tsx on lines 13..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 193.

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

File index.jsx has 495 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//  Package imports
import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
Severity: Minor
Found in app/javascript/flavours/glitch/features/local_settings/page/index.jsx - About 7 hrs to fix

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

    export function fetchStatus(id, forceFetch = false, alsoFetchContext = true) {
      return (dispatch, getState) => {
        const skipLoading = !forceFetch && getState().getIn(['statuses', id], null) !== null;
    
        if (alsoFetchContext) {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/statuses.js and 1 other location - About 7 hrs to fix
    app/javascript/mastodon/actions/statuses.js on lines 52..73

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

    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

    export function fetchStatus(id, forceFetch = false, alsoFetchContext = true) {
      return (dispatch, getState) => {
        const skipLoading = !forceFetch && getState().getIn(['statuses', id], null) !== null;
    
        if (alsoFetchContext) {
    Severity: Major
    Found in app/javascript/mastodon/actions/statuses.js and 1 other location - About 7 hrs to fix
    app/javascript/flavours/glitch/actions/statuses.js on lines 52..73

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

    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 deleteStatus = (state, id, references, exclude_account = null) => {
      state.keySeq().forEach(timeline => {
        if (exclude_account === null || (timeline !== `account:${exclude_account}` && !timeline.startsWith(`account:${exclude_account}:`))) {
          const helper = list => list.filterNot(item => item === id);
          state = state.updateIn([timeline, 'items'], helper).updateIn([timeline, 'pendingItems'], helper);
    Severity: Major
    Found in app/javascript/flavours/glitch/reducers/timelines.js and 1 other location - About 7 hrs to fix
    app/javascript/mastodon/reducers/timelines.js on lines 134..148

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

    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 deleteStatus = (state, id, references, exclude_account = null) => {
      state.keySeq().forEach(timeline => {
        if (exclude_account === null || (timeline !== `account:${exclude_account}` && !timeline.startsWith(`account:${exclude_account}:`))) {
          const helper = list => list.filterNot(item => item === id);
          state = state.updateIn([timeline, 'items'], helper).updateIn([timeline, 'pendingItems'], helper);
    Severity: Major
    Found in app/javascript/mastodon/reducers/timelines.js and 1 other location - About 7 hrs to fix
    app/javascript/flavours/glitch/reducers/timelines.js on lines 140..154

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

    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

    export const LimitedAccountHint: React.FC<{ accountId: string }> = ({
      accountId,
    }) => {
      const dispatch = useAppDispatch();
      const reveal = useCallback(() => {
    app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.tsx on lines 10..35

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

    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

    export const LimitedAccountHint: React.FC<{ accountId: string }> = ({
      accountId,
    }) => {
      const dispatch = useAppDispatch();
      const reveal = useCallback(() => {
    app/javascript/mastodon/features/account_timeline/components/limited_account_hint.tsx on lines 10..35

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

    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

    File accounts.rb has 493 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'set'
    require_relative 'base'
    
    module Mastodon::CLI
      class Accounts < Base
    Severity: Minor
    Found in lib/mastodon/cli/accounts.rb - About 7 hrs to fix

      File index.jsx has 492 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import PropTypes from 'prop-types';
      import { PureComponent } from 'react';
      
      import { defineMessages, injectIntl } from 'react-intl';
      
      
      Severity: Minor
      Found in app/javascript/mastodon/features/ui/index.jsx - About 7 hrs to fix

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

        const mapStateToProps = (state, { id }) => ({
          media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
          account: state.getIn(['accounts', me]),
          isUploadingThumbnail: state.getIn(['compose', 'isUploadingThumbnail']),
          description: state.getIn(['compose', 'media_modal', 'description']),
        app/javascript/mastodon/features/ui/components/focal_point_modal.jsx on lines 43..53

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

        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 mapStateToProps = (state, { id }) => ({
          media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
          account: state.getIn(['accounts', me]),
          isUploadingThumbnail: state.getIn(['compose', 'isUploadingThumbnail']),
          description: state.getIn(['compose', 'media_modal', 'description']),
        app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx on lines 43..53

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

        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

        export const ServerHeroImage: React.FC<Props> = ({
          src,
          srcSet,
          blurhash,
          className,
        app/javascript/mastodon/components/server_hero_image.tsx on lines 14..35

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

        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

        export const ServerHeroImage: React.FC<Props> = ({
          src,
          srcSet,
          blurhash,
          className,
        Severity: Major
        Found in app/javascript/mastodon/components/server_hero_image.tsx and 1 other location - About 7 hrs to fix
        app/javascript/flavours/glitch/components/server_hero_image.tsx on lines 14..35

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

        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

        File index.jsx has 490 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import PropTypes from 'prop-types';
        import { PureComponent } from 'react';
        
        import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
        
        
        Severity: Minor
        Found in app/javascript/flavours/glitch/features/audio/index.jsx - About 7 hrs to fix

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

          const scroll = (
            node: Element,
            key: 'scrollTop' | 'scrollLeft',
            target: number,
          ) => {
          Severity: Major
          Found in app/javascript/mastodon/scroll.ts and 1 other location - About 7 hrs to fix
          app/javascript/flavours/glitch/scroll.ts on lines 8..36

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 190.

          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 scroll = (
            node: Element,
            key: 'scrollTop' | 'scrollLeft',
            target: number,
          ) => {
          Severity: Major
          Found in app/javascript/flavours/glitch/scroll.ts and 1 other location - About 7 hrs to fix
          app/javascript/mastodon/scroll.ts on lines 8..36

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 190.

          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

          File status.jsx has 489 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import PropTypes from 'prop-types';
          
          import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
          
          import classNames from 'classnames';
          Severity: Minor
          Found in app/javascript/mastodon/components/status.jsx - About 7 hrs to fix

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

            export function fillTimelineGaps(timelineId, path, params = {}) {
              return async (dispatch, getState) => {
                const timeline = getState().getIn(['timelines', timelineId], ImmutableMap());
                const items = timeline.get('items');
                const nullIndexes = items.map((statusId, index) => statusId === null ? index : null);
            Severity: Major
            Found in app/javascript/flavours/glitch/actions/timelines.js and 1 other location - About 7 hrs to fix
            app/javascript/mastodon/actions/timelines.js on lines 134..146

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

            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

            export function fillTimelineGaps(timelineId, path, params = {}) {
              return async (dispatch, getState) => {
                const timeline = getState().getIn(['timelines', timelineId], ImmutableMap());
                const items = timeline.get('items');
                const nullIndexes = items.map((statusId, index) => statusId === null ? index : null);
            Severity: Major
            Found in app/javascript/mastodon/actions/timelines.js and 1 other location - About 7 hrs to fix
            app/javascript/flavours/glitch/actions/timelines.js on lines 145..157

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language