mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

Method process_update has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def process_update
    user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
    user.settings['interactions']        = merged_interactions if change?('interactions')
    user.settings['default_privacy']     = default_privacy_preference if change?('setting_default_privacy')
    user.settings['default_sensitive']   = default_sensitive_preference if change?('setting_default_sensitive')
Severity: Minor
Found in app/lib/user_settings_decorator.rb - About 4 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 emoji_picker_dropdown.js has 344 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 { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components';
import Overlay from 'react-overlays/lib/Overlay';

    Function render has a Cognitive Complexity of 29 (exceeds 5 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: Minor
    Found in app/javascript/mastodon/features/status/components/detailed_status.js - About 4 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 update_column_in_batches has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_column_in_batches(table_name, column, value)
          if transaction_open?
            raise 'update_column_in_batches can not be run inside a transaction, ' \
              'you can disable transactions by calling disable_ddl_transaction! ' \
              'in the body of your migration class'
    Severity: Minor
    Found in lib/mastodon/migration_helpers.rb - About 4 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 focal_point_modal.js has 343 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 ImmutablePureComponent from 'react-immutable-pure-component';
    import { connect } from 'react-redux';
    Severity: Minor
    Found in app/javascript/mastodon/features/ui/components/focal_point_modal.js - About 4 hrs to fix

      File detailed_status.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import PropTypes from 'prop-types';
      import ImmutablePropTypes from 'react-immutable-proptypes';
      import Avatar from '../../../components/avatar';
      import DisplayName from '../../../components/display_name';
      Severity: Minor
      Found in app/javascript/mastodon/features/status/components/detailed_status.js - About 4 hrs to fix

        Function getData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        function getData(emoji, skin, set) {
          let emojiData = {};
        
          if (typeof emoji === 'string') {
            let matches = emoji.match(COLONS_REGEX);
        Severity: Minor
        Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 4 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 signed_request_account has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          def signed_request_account
            return @signed_request_account if defined?(@signed_request_account)
        
            raise SignatureVerificationError, 'Request not signed' unless signed_request?
            raise SignatureVerificationError, 'Incompatible request signature. keyId and signature are required' if missing_required_signature_parameters?
        Severity: Minor
        Found in app/controllers/concerns/signature_verification.rb - About 4 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 privatize_media_attachments! has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          def privatize_media_attachments!
            attachment_names = MediaAttachment.attachment_definitions.keys
        
            @account.media_attachments.find_each do |media_attachment|
              attachment_names.each do |attachment_name|
        Severity: Minor
        Found in app/services/suspend_account_service.rb - About 4 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 publish_media_attachments! has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          def publish_media_attachments!
            attachment_names = MediaAttachment.attachment_definitions.keys
        
            @account.media_attachments.find_each do |media_attachment|
              attachment_names.each do |attachment_name|
        Severity: Minor
        Found in app/services/unsuspend_account_service.rb - About 4 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 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render () {
            const { title, icon, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, placeholder, appendContent, collapseIssues } = this.props;
            const { collapsed, animating } = this.state;
        
            const wrapperClassName = classNames('column-header__wrapper', {
        Severity: Major
        Found in app/javascript/mastodon/components/column_header.js - About 4 hrs to fix

          File create.rb has 333 lines of code (exceeds 250 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 4 hrs to fix

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

              render () {
                const { card, maxDescription, compact, quote } = this.props;
                const { width, embedded, revealed } = this.state;
            
                if (card === null) {
            Severity: Minor
            Found in app/javascript/mastodon/features/status/components/card.js - About 3 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 show has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

              def show
                respond_to do |format|
                  format.html do
                    expires_in 0, public: true unless user_signed_in?
            
            
            Severity: Minor
            Found in app/controllers/accounts_controller.rb - About 3 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 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render () {
                const { media, statusId, intl, onClose } = this.props;
                const { navigationHidden } = this.state;
            
                const index = this.getIndex();
            Severity: Major
            Found in app/javascript/mastodon/features/ui/components/media_modal.js - About 3 hrs to fix

              Class NoteSerializer has 31 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ActivityPub::NoteSerializer < ActivityPub::Serializer
                include FormattingHelper
              
                context_extensions :atom_uri, :conversation, :sensitive, :voters_count
              
              
              Severity: Minor
              Found in app/serializers/activitypub/note_serializer.rb - About 3 hrs to fix

                Method remove_orphans has 95 lines of code (exceeds 25 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: Major
                Found in lib/mastodon/media_cli.rb - About 3 hrs to fix

                  File status_action_bar.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import ImmutablePropTypes from 'react-immutable-proptypes';
                  import { connect } from 'react-redux';
                  import PropTypes from 'prop-types';
                  import IconButton from './icon_button';
                  Severity: Minor
                  Found in app/javascript/mastodon/components/status_action_bar.js - About 3 hrs to fix

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

                      render () {
                        const { status, quote } = this.props;
                    
                        const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden;
                        const renderReadMore = this.props.onClick && status.get('collapsed');
                    Severity: Minor
                    Found in app/javascript/mastodon/components/status_content.js - About 3 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 a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render () {
                        const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction } = this.props;
                    
                        if (!account) {
                          return <div />;
                    Severity: Minor
                    Found in app/javascript/mastodon/components/account.js - About 3 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

                    Severity
                    Category
                    Status
                    Source
                    Language