mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

Function startWorker has 730 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const startWorker = async (workerId) => {
  log.warn(`Starting worker ${workerId}`);

  const pgConfigs = {
    development: {
Severity: Major
Found in streaming/index.js - About 3 days to fix

    Function startWorker has a Cognitive Complexity of 136 (exceeds 5 allowed). Consider refactoring.
    Open

    const startWorker = async (workerId) => {
      log.warn(`Starting worker ${workerId}`);
    
      const pgConfigs = {
        development: {
    Severity: Minor
    Found in streaming/index.js - About 2 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function render has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File index.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // @ts-check
    
    const os = require('os');
    const throng = require('throng');
    const dotenv = require('dotenv');
    Severity: Major
    Found in streaming/index.js - About 2 days to fix

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

        render () {
          let media = null;
          let statusAvatar, prepend, rebloggedByText, unlistedQuoteText;
      
          const { intl, hidden, featured, unread, showThread, scrollKey, pictureInPicture, contextType } = this.props;
      Severity: Major
      Found in app/javascript/mastodon/components/status.js - About 1 day to fix

        File accounts.js has 655 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import api, { getLinks } from '../api';
        import { importFetchedAccount, importFetchedAccounts } from './importer';
        
        export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
        export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS';
        Severity: Major
        Found in app/javascript/mastodon/actions/accounts.js - About 1 day to fix

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

          import api from '../api';
          import { CancelToken, isCancel } from 'axios';
          import { throttle } from 'lodash';
          import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light';
          import { tagHistory } from '../settings';
          Severity: Major
          Found in app/javascript/mastodon/actions/compose.js - About 1 day to fix

            Method remove_orphans has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
            Open

                def remove_orphans
                  progress        = create_progress_bar(nil)
                  reclaimed_bytes = 0
                  removed         = 0
                  dry_run         = options[:dry_run] ? ' (DRY RUN)' : ''
            Severity: Minor
            Found in lib/mastodon/media_cli.rb - About 1 day to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            File status.js has 617 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import ImmutablePropTypes from 'react-immutable-proptypes';
            import PropTypes from 'prop-types';
            import Avatar from './avatar';
            import AvatarOverlay from './avatar_overlay';
            Severity: Major
            Found in app/javascript/mastodon/components/status.js - About 1 day to fix

              Function search has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
              Open

              function search(value, { emojisToShowFilter, maxResults, include, exclude, custom } = {}) {
                if (custom !== undefined) {
                  if (customEmojisList !== custom)
                    addCustomToPool(custom, originalPool);
                } else {
              Severity: Minor
              Found in app/javascript/mastodon/features/emoji/emoji_mart_search_light.js - About 1 day to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function compose has 262 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function compose(state = initialState, action) {
                switch(action.type) {
                case STORE_HYDRATE:
                  return hydrate(state, action.state.get('compose'));
                case COMPOSE_MOUNT:
              Severity: Major
              Found in app/javascript/mastodon/reducers/compose.js - About 1 day to fix

                Function render has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
                Open

                  render () {
                    const { account, hidden, intl, domain } = this.props;
                
                    if (!account) {
                      return null;
                Severity: Minor
                Found in app/javascript/mastodon/features/account/components/header.js - About 1 day to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                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

                  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

                        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

                          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

                            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
                                Severity
                                Category
                                Status
                                Source
                                Language