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 markersReducer = createReducer(initialState, (builder) => {
  builder.addCase(
    submitMarkersAction.fulfilled,
    (state, { payload: { home, notifications } }) => {
      if (home) state.home = home;
Severity: Major
Found in app/javascript/mastodon/reducers/markers.ts and 1 other location - About 1 day to fix
app/javascript/flavours/glitch/reducers/markers.ts on lines 14..41

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

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 markersReducer = createReducer(initialState, (builder) => {
  builder.addCase(
    submitMarkersAction.fulfilled,
    (state, { payload: { home, notifications } }) => {
      if (home) state.home = home;
Severity: Major
Found in app/javascript/flavours/glitch/reducers/markers.ts and 1 other location - About 1 day to fix
app/javascript/mastodon/reducers/markers.ts on lines 11..38

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

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 buildSearch = (data) => {
  const search = [];

  let addToSearch = (strings, split) => {
    if (!strings) {
Severity: Major
Found in app/javascript/flavours/glitch/features/emoji/emoji_utils.js and 1 other location - About 1 day to fix
app/javascript/mastodon/features/emoji/emoji_utils.js on lines 6..31

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

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 buildSearch = (data) => {
  const search = [];

  let addToSearch = (strings, split) => {
    if (!strings) {
Severity: Major
Found in app/javascript/mastodon/features/emoji/emoji_utils.js and 1 other location - About 1 day to fix
app/javascript/flavours/glitch/features/emoji/emoji_utils.js on lines 6..31

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

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 FollowRequestsLink = () => {
  const count = useSelector(state => state.getIn(['user_lists', 'follow_requests', 'items'])?.size ?? 0);
  const intl = useIntl();
  const dispatch = useDispatch();

app/javascript/flavours/glitch/features/ui/components/navigation_panel.jsx on lines 84..106

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

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 FollowRequestsLink = () => {
  const count = useSelector(state => state.getIn(['user_lists', 'follow_requests', 'items'])?.size ?? 0);
  const intl = useIntl();
  const dispatch = useDispatch();

app/javascript/mastodon/features/ui/components/navigation_panel.jsx on lines 83..105

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

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

Class Status has 62 methods (exceeds 20 allowed). Consider refactoring.
Open

class Status < ApplicationRecord
  include Cacheable
  include Discard::Model
  include Paginable
  include RateLimitable
Severity: Major
Found in app/models/status.rb - About 1 day to fix

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

              <Section open title={intl.formatMessage(messages.title)}>
                {extendedDescription.get('isLoading') ? (
                  <>
                    <Skeleton width='100%' />
                    <br />
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/mastodon/features/about/index.jsx on lines 145..164

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

    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

              <Section open title={intl.formatMessage(messages.title)}>
                {extendedDescription.get('isLoading') ? (
                  <>
                    <Skeleton width='100%' />
                    <br />
    Severity: Major
    Found in app/javascript/mastodon/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/flavours/glitch/features/about/index.jsx on lines 145..164

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

    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={classNames('safety-action-modal__bottom')}>
            <div className='safety-action-modal__actions'>
              {!status.get('reblogged') && (
                <PrivacyDropdown
                  noDirect
    app/javascript/flavours/glitch/features/ui/components/boost_modal.tsx on lines 111..143

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

    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={classNames('safety-action-modal__bottom')}>
            <div className='safety-action-modal__actions'>
              {!status.get('reblogged') && (
                <PrivacyDropdown
                  noDirect
    app/javascript/mastodon/features/ui/components/boost_modal.tsx on lines 103..135

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

    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 notification_groups.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { createReducer, isAnyOf } from '@reduxjs/toolkit';
    
    import {
      authorizeFollowRequestSuccess,
      blockAccountSuccess,
    Severity: Major
    Found in app/javascript/flavours/glitch/reducers/notification_groups.ts - About 1 day to fix

      File notification_groups.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { createReducer, isAnyOf } from '@reduxjs/toolkit';
      
      import {
        authorizeFollowRequestSuccess,
        blockAccountSuccess,
      Severity: Major
      Found in app/javascript/mastodon/reducers/notification_groups.ts - About 1 day to fix

        File search.tsx has 540 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { useCallback, useState, useRef } from 'react';
        
        import {
          defineMessages,
          useIntl,
        Severity: Major
        Found in app/javascript/flavours/glitch/features/compose/components/search.tsx - About 1 day to fix

          File search.tsx has 540 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { useCallback, useState, useRef } from 'react';
          
          import {
            defineMessages,
            useIntl,
          Severity: Major
          Found in app/javascript/mastodon/features/compose/components/search.tsx - About 1 day to fix

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

            export function expandFavouritedStatuses() {
              return (dispatch, getState) => {
                const url = getState().getIn(['status_lists', 'favourites', 'next'], null);
            
                if (url === null || getState().getIn(['status_lists', 'favourites', 'isLoading'])) {
            Severity: Major
            Found in app/javascript/flavours/glitch/actions/favourites.js and 3 other locations - About 1 day to fix
            app/javascript/flavours/glitch/actions/bookmarks.js on lines 52..70
            app/javascript/mastodon/actions/bookmarks.js on lines 52..70
            app/javascript/mastodon/actions/favourites.js on lines 55..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 214.

            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

            export function expandFavouritedStatuses() {
              return (dispatch, getState) => {
                const url = getState().getIn(['status_lists', 'favourites', 'next'], null);
            
                if (url === null || getState().getIn(['status_lists', 'favourites', 'isLoading'])) {
            Severity: Major
            Found in app/javascript/mastodon/actions/favourites.js and 3 other locations - About 1 day to fix
            app/javascript/flavours/glitch/actions/bookmarks.js on lines 52..70
            app/javascript/flavours/glitch/actions/favourites.js on lines 55..73
            app/javascript/mastodon/actions/bookmarks.js on lines 52..70

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

            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

            export function expandBookmarkedStatuses() {
              return (dispatch, getState) => {
                const url = getState().getIn(['status_lists', 'bookmarks', 'next'], null);
            
                if (url === null || getState().getIn(['status_lists', 'bookmarks', 'isLoading'])) {
            Severity: Major
            Found in app/javascript/mastodon/actions/bookmarks.js and 3 other locations - About 1 day to fix
            app/javascript/flavours/glitch/actions/bookmarks.js on lines 52..70
            app/javascript/flavours/glitch/actions/favourites.js on lines 55..73
            app/javascript/mastodon/actions/favourites.js on lines 55..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 214.

            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

            export function expandBookmarkedStatuses() {
              return (dispatch, getState) => {
                const url = getState().getIn(['status_lists', 'bookmarks', 'next'], null);
            
                if (url === null || getState().getIn(['status_lists', 'bookmarks', 'isLoading'])) {
            Severity: Major
            Found in app/javascript/flavours/glitch/actions/bookmarks.js and 3 other locations - About 1 day to fix
            app/javascript/flavours/glitch/actions/favourites.js on lines 55..73
            app/javascript/mastodon/actions/bookmarks.js on lines 52..70
            app/javascript/mastodon/actions/favourites.js on lines 55..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 214.

            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

            function uniqueHashtagsWithCaseHandling(hashtags: string[]) {
              const groups = groupBy(hashtags, (tag) =>
                tag.normalize('NFKD').toLowerCase(),
              );
            
            
            Severity: Major
            Found in app/javascript/flavours/glitch/components/hashtag_bar.tsx and 1 other location - About 1 day to fix
            app/javascript/mastodon/components/hashtag_bar.tsx on lines 49..74

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

            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