glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

export const LoadMore: React.FC<Props> = ({
  onClick,
  disabled,
  visible = true,
}) => {
Severity: Major
Found in app/javascript/mastodon/components/load_more.tsx and 1 other location - About 4 hrs to fix
app/javascript/flavours/glitch/components/load_more.tsx on lines 8..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 133.

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

function mergeGapsAround(
  groups: NotificationGroupsState['groups'],
  index: number,
) {
  if (index > 0) {
Severity: Major
Found in app/javascript/mastodon/reducers/notification_groups.ts and 1 other location - About 4 hrs to fix
app/javascript/flavours/glitch/reducers/notification_groups.ts on lines 183..202

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

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

function mergeGapsAround(
  groups: NotificationGroupsState['groups'],
  index: number,
) {
  if (index > 0) {
app/javascript/mastodon/reducers/notification_groups.ts on lines 183..202

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

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

Function render has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
    const { signedIn, permissions } = this.props.identity;

    const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
Severity: Major
Found in app/javascript/mastodon/components/status_action_bar.jsx - About 4 hrs to fix

    File announcements.jsx has 369 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import { PureComponent } from 'react';
    
    import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl';
    
    

      File announcements.jsx has 369 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import PropTypes from 'prop-types';
      import { PureComponent } from 'react';
      
      import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl';
      
      

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

        IOArticleContainerWrapper.propTypes =  {
          id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
          index: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
          listLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
          scrollKey: PropTypes.string.isRequired,
        Severity: Major
        Found in app/javascript/mastodon/components/scrollable_list.jsx and 1 other location - About 4 hrs to fix
        app/javascript/flavours/glitch/components/scrollable_list.jsx on lines 53..61

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

        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

        IOArticleContainerWrapper.propTypes =  {
          id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
          index: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
          listLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
          scrollKey: PropTypes.string.isRequired,
        app/javascript/mastodon/components/scrollable_list.jsx on lines 53..61

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

        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 fetchListSuggestions = q => (dispatch) => {
          const params = {
            q,
            resolve: false,
            limit: 4,
        Severity: Major
        Found in app/javascript/flavours/glitch/actions/lists.js and 1 other location - About 4 hrs to fix
        app/javascript/mastodon/actions/lists.js on lines 237..249

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

        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

                <label>
                  <span style={{ display: 'none' }}>{message}</span>
                  <input
                    key={resetFileKey}
                    ref={this.setRef}
        app/javascript/mastodon/features/compose/components/upload_button.jsx on lines 62..75

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

        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 fetchListSuggestions = q => (dispatch) => {
          const params = {
            q,
            resolve: false,
            limit: 4,
        Severity: Major
        Found in app/javascript/mastodon/actions/lists.js and 1 other location - About 4 hrs to fix
        app/javascript/flavours/glitch/actions/lists.js on lines 237..249

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

        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

                <label>
                  <span style={{ display: 'none' }}>{message}</span>
                  <input
                    key={resetFileKey}
                    ref={this.setRef}
        app/javascript/flavours/glitch/features/compose/components/upload_button.jsx on lines 89..102

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

        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

        Rails.delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
          if (!(target instanceof HTMLInputElement)) return;
        
          const selectAllMatchingElement = document.querySelector(
            '.batch-table__select-all',
        Severity: Major
        Found in app/javascript/flavours/glitch/entrypoints/admin.tsx and 1 other location - About 4 hrs to fix
        app/javascript/entrypoints/admin.tsx on lines 66..86

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

        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

        Rails.delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
          if (!(target instanceof HTMLInputElement)) return;
        
          const selectAllMatchingElement = document.querySelector(
            '.batch-table__select-all',
        Severity: Major
        Found in app/javascript/entrypoints/admin.tsx and 1 other location - About 4 hrs to fix
        app/javascript/flavours/glitch/entrypoints/admin.tsx on lines 66..86

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

        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 Create has 37 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ActivityPub::Activity::Create < ActivityPub::Activity
          include FormattingHelper
        
          def perform
            @account.schedule_refresh_if_stale!
        Severity: Minor
        Found in app/lib/activitypub/activity/create.rb - About 4 hrs to fix

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

          import PropTypes from 'prop-types';
          import { PureComponent } from 'react';
          
          import { defineMessages, injectIntl } from 'react-intl';
          
          

            File zoomable_image.jsx has 367 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/components/zoomable_image.jsx - About 4 hrs to fix

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

                  if (this.props.focusDate && this.props.focusDate !== prevProps.focusDate) {
                    let selectionEnd, selectionStart;
              
                    if (this.props.preselectDate !== prevProps.preselectDate && this.props.isInReply) {
                      selectionEnd   = this.props.text.length;
              app/javascript/flavours/glitch/features/compose/components/compose_form.jsx on lines 199..230

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

              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 subscribe = ({ channelName, params, onConnect }) => {
                const key = channelNameWithInlineParams(channelName, params);
              
                subscriptionCounters[key] = subscriptionCounters[key] || 0;
              
              
              Severity: Major
              Found in app/javascript/flavours/glitch/stream.js and 1 other location - About 4 hrs to fix
              app/javascript/mastodon/stream.js on lines 58..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 131.

              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 subscribe = ({ channelName, params, onConnect }) => {
                const key = channelNameWithInlineParams(channelName, params);
              
                subscriptionCounters[key] = subscriptionCounters[key] || 0;
              
              
              Severity: Major
              Found in app/javascript/mastodon/stream.js and 1 other location - About 4 hrs to fix
              app/javascript/flavours/glitch/stream.js on lines 58..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 131.

              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