mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

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

    File accounts_cli.rb has 508 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File migration_helpers.rb has 508 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Mastodon
        module MigrationHelpers
          class CorruptionError < StandardError
            attr_reader :index_name
      
      
      Severity: Major
      Found in lib/mastodon/migration_helpers.rb - About 1 day to fix

        Function emojify has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
        Open

        const emojify = (str, customEmojis = {}) => {
          const tagCharsWithoutEmojis = '<&';
          const tagCharsWithEmojis = Object.keys(customEmojis).length ? '<&:' : '<&';
          let rtn = '', tagChars = tagCharsWithEmojis, invisible = 0;
          for (;;) {
        Severity: Minor
        Found in app/javascript/mastodon/features/emoji/emoji.js - About 7 hrs 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 189 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

          export default @injectIntl
          @connect(makeMapStateToProps)
          class Status extends ImmutablePureComponent {
          
            static contextTypes = {
          Severity: Major
          Found in app/javascript/mastodon/features/status/index.js - About 7 hrs to fix

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

            import React from 'react';
            import PropTypes from 'prop-types';
            import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
            import { formatTime } from 'mastodon/features/video';
            import Icon from 'mastodon/components/icon';
            Severity: Minor
            Found in app/javascript/mastodon/features/audio/index.js - About 7 hrs to fix

              File status.rb has 464 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class Status < ApplicationRecord
                before_destroy :unlink_from_conversations
              
                include Discard::Model
                include Paginable
              Severity: Minor
              Found in app/models/status.rb - About 7 hrs to fix

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

                import classNames from 'classnames';
                import React from 'react';
                import { HotKeys } from 'react-hotkeys';
                import { defineMessages, injectIntl } from 'react-intl';
                import { connect } from 'react-redux';
                Severity: Minor
                Found in app/javascript/mastodon/features/ui/index.js - About 6 hrs to fix

                  File account.rb has 453 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Function render has a Cognitive Complexity of 43 (exceeds 5 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: Minor
                    Found in app/javascript/mastodon/components/status.js - About 6 hrs 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

                    Method remotable_attachment has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def remotable_attachment(attachment_name, limit, suppress_errors: true, download_on_assign: true, attribute_name: nil)
                          attribute_name ||= "#{attachment_name}_remote_url".to_sym
                    
                          define_method("download_#{attachment_name}!") do |url = nil|
                            url ||= self[attribute_name]
                    Severity: Minor
                    Found in app/models/concerns/remotable.rb - About 6 hrs 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 media_gallery.js has 434 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 { is } from 'immutable';
                    import IconButton from './icon_button';
                    Severity: Minor
                    Found in app/javascript/mastodon/components/media_gallery.js - About 6 hrs to fix

                      Audio has 46 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default @injectIntl
                      class Audio extends React.PureComponent {
                      
                        static propTypes = {
                          src: PropTypes.string.isRequired,
                      Severity: Minor
                      Found in app/javascript/mastodon/features/audio/index.js - About 6 hrs to fix

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

                          render () {
                            const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
                        
                            const anonymousAccess    = !me;
                            const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
                        Severity: Minor
                        Found in app/javascript/mastodon/components/status_action_bar.js - About 6 hrs 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 142 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render () {
                            const { intl, multiColumn } = this.props;
                        
                            return (
                              <Column bindToDocument={!multiColumn} icon='question' heading={intl.formatMessage(messages.heading)}>
                        Severity: Major
                        Found in app/javascript/mastodon/features/keyboard_shortcuts/index.js - About 5 hrs to fix

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

                            render () {
                              const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props;
                          
                              const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;
                              const filterBarShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show_bar' defaultMessage='Show filter bar' />;

                            Method call has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def call(username, domain, json, options = {})
                                return if json['inbox'].blank? || unsupported_uri_scheme?(json['id']) || domain_not_allowed?(domain)
                            
                                @options     = options
                                @json        = json
                            Severity: Minor
                            Found in app/services/activitypub/process_account_service.rb - About 5 hrs 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

                            Method storage_schema has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def storage_schema
                                  progress = create_progress_bar(nil)
                                  dry_run  = dry_run? ? ' (DRY RUN)' : ''
                                  records  = 0
                            
                            
                            Severity: Minor
                            Found in lib/mastodon/upgrade_cli.rb - About 5 hrs 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 Create has 40 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class ActivityPub::Activity::Create < ActivityPub::Activity
                              include FormattingHelper
                            
                              def perform
                                dereference_object!
                            Severity: Minor
                            Found in app/lib/activitypub/activity/create.rb - About 5 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language