mashirozx/mastodon

View on GitHub

Showing 1,785 of 1,785 total issues

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

          <div className={`privacy-dropdown__dropdown ${placement}`} style={{ ...style, opacity: opacity, transform: mounted ? `scale(${scaleX}, ${scaleY})` : null, zIndex: 2 }} role='listbox' ref={this.setRef}>
            {items.map(item => (
              <div role='option' tabIndex='0' key={item.value} data-index={item.value} onKeyDown={this.handleKeyDown} onClick={this.handleClick} className={classNames('privacy-dropdown__option', { active: item.value === value })} aria-selected={item.value === value} ref={item.value === value ? this.setFocusRef : null}>
                <div className='privacy-dropdown__option__icon'>
                  <Icon id={item.icon} fixedWidth />
app/javascript/mastodon/features/compose/components/privacy_dropdown.js on lines 130..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 234.

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

class Status < ApplicationRecord
  before_destroy :unlink_from_conversations

  include Discard::Model
  include Paginable
Severity: Major
Found in app/models/status.rb - About 1 day to fix

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

    export function expandFollowing(id) {
      return (dispatch, getState) => {
        const url = getState().getIn(['user_lists', 'following', id, 'next']);
    
        if (url === null) {
    Severity: Major
    Found in app/javascript/mastodon/actions/accounts.js and 1 other location - About 1 day to fix
    app/javascript/mastodon/actions/accounts.js on lines 404..424

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

    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 function expandFollowers(id) {
      return (dispatch, getState) => {
        const url = getState().getIn(['user_lists', 'followers', id, 'next']);
    
        if (url === null) {
    Severity: Major
    Found in app/javascript/mastodon/actions/accounts.js and 1 other location - About 1 day to fix
    app/javascript/mastodon/actions/accounts.js on lines 491..511

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

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

    class Account < ApplicationRecord
      self.ignored_columns = %w(
        subscription_expires_at
        secret
        remote_url
    Severity: Major
    Found in app/models/account.rb - About 1 day to fix

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

        render () {
          const { attachment, index, size, standalone, displayWidth, visible } = this.props;
      
          let width  = 50;
          let height = 100;
      Severity: Major
      Found in app/javascript/mastodon/components/media_gallery.js - About 1 day to fix

        Class User has 64 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class User < ApplicationRecord
          self.ignored_columns = %w(
            remember_created_at
            remember_token
            current_sign_in_ip
        Severity: Major
        Found in app/models/user.rb - About 1 day to fix

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

          export function expandMutes() {
            return (dispatch, getState) => {
              const url = getState().getIn(['user_lists', 'mutes', 'next']);
          
              if (url === null) {
          Severity: Major
          Found in app/javascript/mastodon/actions/mutes.js and 1 other location - About 1 day to fix
          app/javascript/mastodon/actions/blocks.js on lines 50..67

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

          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 function expandBlocks() {
            return (dispatch, getState) => {
              const url = getState().getIn(['user_lists', 'blocks', 'next']);
          
              if (url === null) {
          Severity: Major
          Found in app/javascript/mastodon/actions/blocks.js and 1 other location - About 1 day to fix
          app/javascript/mastodon/actions/mutes.js on lines 52..69

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

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

          import Immutable from 'immutable';
          import React from 'react';
          import { connect } from 'react-redux';
          import PropTypes from 'prop-types';
          import classNames from 'classnames';
          Severity: Major
          Found in app/javascript/mastodon/features/status/index.js - About 1 day to fix

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

                if (size === 2) {
                  if (index === 0) {
                    right = '2px';
                  } else {
                    left = '2px';
            Severity: Major
            Found in app/javascript/mastodon/components/media_gallery.js and 1 other location - About 1 day to fix
            app/javascript/mastodon/components/avatar_composite.js on lines 36..68

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

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

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

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

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

            Refactorings

            Further Reading

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

                if (size === 2) {
                  if (index === 0) {
                    right = '1px';
                  } else {
                    left = '1px';
            Severity: Major
            Found in app/javascript/mastodon/components/avatar_composite.js and 1 other location - About 1 day to fix
            app/javascript/mastodon/components/media_gallery.js on lines 99..131

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

            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 225 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render () {
                const status = (this.props.status && this.props.status.get('reblog')) ? this.props.status.get('reblog') : this.props.status;
                const outerStyle = { boxSizing: 'border-box' };
                const { intl, compact, pictureInPicture } = this.props;
            
            
            Severity: Major
            Found in app/javascript/mastodon/features/status/components/detailed_status.js - About 1 day to fix

              Similar blocks of code found in 2 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 1 other location - About 1 day to fix
              app/javascript/mastodon/actions/favourites.js on lines 54..72

              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

              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 1 other location - About 1 day to fix
              app/javascript/mastodon/actions/bookmarks.js on lines 51..69

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

              import React from 'react';
              import PropTypes from 'prop-types';
              import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
              import { is } from 'immutable';
              import { throttle, debounce } from 'lodash';
              Severity: Major
              Found in app/javascript/mastodon/features/video/index.js - About 1 day to fix

                File compose.js has 530 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                  COMPOSE_MOUNT,
                  COMPOSE_UNMOUNT,
                  COMPOSE_CHANGE,
                  COMPOSE_REPLY,
                Severity: Major
                Found in app/javascript/mastodon/reducers/compose.js - About 1 day to fix

                  File maintenance_cli.rb has 525 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'tty-prompt'
                  require_relative '../../config/boot'
                  require_relative '../../config/environment'
                  require_relative 'cli_helper'
                  
                  
                  Severity: Major
                  Found in lib/mastodon/maintenance_cli.rb - About 1 day to fix

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

                      onFollow(account) {
                        if (
                          account.getIn(['relationship', 'following']) ||
                          account.getIn(['relationship', 'requested'])
                        ) {
                    app/javascript/mastodon/containers/account_container.js on lines 34..48
                    app/javascript/mastodon/features/account_timeline/containers/header_container.js on lines 44..58

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 205.

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

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

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

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

                    Refactorings

                    Further Reading

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

                      onFollow (account) {
                        if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
                          if (unfollowModal) {
                            dispatch(openModal('CONFIRM', {
                              message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
                    app/javascript/mastodon/containers/account_container.js on lines 34..48
                    app/javascript/mastodon/features/directory/components/account_card.js on lines 45..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 205.

                    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