glitch-soc/mastodon

View on GitHub

Showing 4,906 of 4,906 total issues

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

export const apiFetchNotifications = async (
  params?: {
    account_id?: string;
    since_id?: string;
  },
Severity: Major
Found in app/javascript/flavours/glitch/api/notifications.ts and 1 other location - About 3 hrs to fix
app/javascript/mastodon/api/notifications.ts on lines 13..30

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

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 messages = defineMessages({
  accept: { id: 'notifications.policy.accept', defaultMessage: 'Accept' },
  accept_hint: {
    id: 'notifications.policy.accept_hint',
    defaultMessage: 'Show in notifications',
app/javascript/mastodon/features/notifications/components/policy_controls.tsx on lines 12..28

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

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 messages = defineMessages({
  accept: { id: 'notifications.policy.accept', defaultMessage: 'Accept' },
  accept_hint: {
    id: 'notifications.policy.accept_hint',
    defaultMessage: 'Show in notifications',
app/javascript/flavours/glitch/features/notifications/components/policy_controls.tsx on lines 12..28

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

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 apiFetchNotifications = async (
  params?: {
    account_id?: string;
    since_id?: string;
  },
Severity: Major
Found in app/javascript/mastodon/api/notifications.ts and 1 other location - About 3 hrs to fix
app/javascript/flavours/glitch/api/notifications.ts on lines 13..30

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

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 zoomable_image.jsx has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

const MIN_SCALE = 1;
const MAX_SCALE = 4;

    File zoomable_image.jsx has 322 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import { PureComponent } from 'react';
    
    const MIN_SCALE = 1;
    const MAX_SCALE = 4;
    Severity: Minor
    Found in app/javascript/mastodon/features/ui/components/zoomable_image.jsx - About 3 hrs to fix

      File scrollable_list.jsx has 321 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import PropTypes from 'prop-types';
      import { Children, cloneElement, PureComponent } from 'react';
      
      import classNames from 'classnames';
      import { useLocation } from 'react-router-dom';
      Severity: Minor
      Found in app/javascript/flavours/glitch/components/scrollable_list.jsx - About 3 hrs to fix

        File scrollable_list.jsx has 321 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import PropTypes from 'prop-types';
        import { Children, cloneElement, PureComponent } from 'react';
        
        import classNames from 'classnames';
        import { useLocation } from 'react-router-dom';
        Severity: Minor
        Found in app/javascript/mastodon/components/scrollable_list.jsx - About 3 hrs to fix

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

            handleMouseUp = () => {
              document.removeEventListener('mousemove', this.handleMouseMove, true);
              document.removeEventListener('mouseup', this.handleMouseUp, true);
              document.removeEventListener('touchmove', this.handleMouseMove, true);
              document.removeEventListener('touchend', this.handleMouseUp, true);
          Severity: Major
          Found in app/javascript/flavours/glitch/features/video/index.jsx and 3 other locations - About 3 hrs to fix
          app/javascript/flavours/glitch/features/audio/index.jsx on lines 270..278
          app/javascript/mastodon/features/audio/index.jsx on lines 264..272
          app/javascript/mastodon/features/video/index.jsx on lines 250..258

          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

            handleMouseUp = () => {
              document.removeEventListener('mousemove', this.handleMouseMove, true);
              document.removeEventListener('mouseup', this.handleMouseUp, true);
              document.removeEventListener('touchmove', this.handleMouseMove, true);
              document.removeEventListener('touchend', this.handleMouseUp, true);
          Severity: Major
          Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 3 hrs to fix
          app/javascript/flavours/glitch/features/audio/index.jsx on lines 270..278
          app/javascript/flavours/glitch/features/video/index.jsx on lines 253..261
          app/javascript/mastodon/features/audio/index.jsx on lines 264..272

          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

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

                    <div className='account__relationship'>
                      <IconButton title={intl.formatMessage(messages.authorize)} icon='check' iconComponent={CheckIcon} onClick={onAuthorize} />
                      <IconButton title={intl.formatMessage(messages.reject)} icon='times' iconComponent={CloseIcon} onClick={onReject} />
                    </div>
          app/javascript/mastodon/features/notifications/components/follow_request.jsx on lines 54..57

          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

            handleMouseUp = () => {
              document.removeEventListener('mousemove', this.handleMouseMove, true);
              document.removeEventListener('mouseup', this.handleMouseUp, true);
              document.removeEventListener('touchmove', this.handleMouseMove, true);
              document.removeEventListener('touchend', this.handleMouseUp, true);
          Severity: Major
          Found in app/javascript/mastodon/features/audio/index.jsx and 3 other locations - About 3 hrs to fix
          app/javascript/flavours/glitch/features/audio/index.jsx on lines 270..278
          app/javascript/flavours/glitch/features/video/index.jsx on lines 253..261
          app/javascript/mastodon/features/video/index.jsx on lines 250..258

          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

            handleMouseUp = () => {
              document.removeEventListener('mousemove', this.handleMouseMove, true);
              document.removeEventListener('mouseup', this.handleMouseUp, true);
              document.removeEventListener('touchmove', this.handleMouseMove, true);
              document.removeEventListener('touchend', this.handleMouseUp, true);
          Severity: Major
          Found in app/javascript/flavours/glitch/features/audio/index.jsx and 3 other locations - About 3 hrs to fix
          app/javascript/flavours/glitch/features/video/index.jsx on lines 253..261
          app/javascript/mastodon/features/audio/index.jsx on lines 264..272
          app/javascript/mastodon/features/video/index.jsx on lines 250..258

          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

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

          exports.unicodeToUnifiedName = (str) => {
            let output = '';
          
            for (let i = 0; i < str.length; i += 2) {
              if (i > 0) {
          app/javascript/mastodon/features/emoji/unicode_to_unified_name.js on lines 12..24

          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

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

          exports.unicodeToUnifiedName = (str) => {
            let output = '';
          
            for (let i = 0; i < str.length; i += 2) {
              if (i > 0) {
          app/javascript/flavours/glitch/features/emoji/unicode_to_unified_name.js on lines 12..24

          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

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

                    <div className='account__relationship'>
                      <IconButton title={intl.formatMessage(messages.authorize)} icon='check' iconComponent={CheckIcon} onClick={onAuthorize} />
                      <IconButton title={intl.formatMessage(messages.reject)} icon='times' iconComponent={CloseIcon} onClick={onReject} />
                    </div>
          app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx on lines 53..56

          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

          export const fetchNotificationRequest = createDataLoadingThunk(
            'notificationRequest/fetch',
            async ({ id }: { id: string }) => apiFetchNotificationRequest(id),
            {
              condition: ({ id }, { getState }) =>
          app/javascript/mastodon/actions/notification_requests.ts on lines 77..87

          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

          export const fetchNotificationRequest = createDataLoadingThunk(
            'notificationRequest/fetch',
            async ({ id }: { id: string }) => apiFetchNotificationRequest(id),
            {
              condition: ({ id }, { getState }) =>
          Severity: Major
          Found in app/javascript/mastodon/actions/notification_requests.ts and 1 other location - About 3 hrs to fix
          app/javascript/flavours/glitch/actions/notification_requests.ts on lines 77..87

          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

          Status has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Status extends ImmutablePureComponent {
          
            static contextType = SensitiveMediaContext;
          
            static propTypes = {
          Severity: Minor
          Found in app/javascript/mastodon/components/status.jsx - About 3 hrs to fix

            Class DeleteAccountService has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class DeleteAccountService < BaseService
              include Payloadable
            
              ASSOCIATIONS_ON_SUSPEND = %w(
                account_notes
            Severity: Minor
            Found in app/services/delete_account_service.rb - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language