glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

Video has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class Video extends PureComponent {

  static propTypes = {
    preview: PropTypes.string,
    frameRate: PropTypes.string,
Severity: Minor
Found in app/javascript/mastodon/features/video/index.jsx - About 5 hrs to fix

    Function render has 132 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 5 hrs to fix

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

        render () {
          const { intl, hidden, featured, unfocusable, unread, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId, skipPrepend, avatarSize = 46 } = this.props;
      
          let { status, account, ...other } = this.props;
      
      
      Severity: Minor
      Found in app/javascript/mastodon/components/status.jsx - 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 remove_files has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

        def remove_files
          keys = []
      
          logger.debug { "Preparing to delete attachments for #{records.size} records" }
      
      
      Severity: Minor
      Found in app/lib/attachment_batch.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

      Function EmbeddedStatus has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      export const EmbeddedStatus: React.FC<{ statusId: string }> = ({
        statusId,
      }) => {
        const history = useHistory();
        const clickCoordinatesRef = useRef<[number, number] | null>();

      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 39 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 5 hrs to fix

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

          render () {
            const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
            const { dragging, detecting, progress, ocrStatus } = this.state;
            const x = (focusX /  2) + .5;
            const y = (focusY / -2) + .5;

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

            render () {
              const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
              const { dragging, detecting, progress, ocrStatus } = this.state;
              const x = (focusX /  2) + .5;
              const y = (focusY / -2) + .5;
          Severity: Major
          Found in app/javascript/mastodon/features/ui/components/focal_point_modal.jsx - About 5 hrs to fix

            Method privatize_media_attachments! has a Cognitive Complexity of 34 (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 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 publish_media_attachments! has a Cognitive Complexity of 34 (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 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 34 (exceeds 5 allowed). Consider refactoring.
            Open

                def storage_schema
                  progress = create_progress_bar(nil)
                  records  = 0
            
                  klasses = [
            Severity: Minor
            Found in lib/mastodon/cli/upgrade.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

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

              render () {
                const {
                  status,
                  media,
                  extraMedia,
            Severity: Major
            Found in app/javascript/flavours/glitch/components/status_content.jsx - About 5 hrs to fix

              Class ProcessAccountService has 38 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ActivityPub::ProcessAccountService < BaseService
                include JsonLdHelper
                include DomainControlHelper
                include Redisable
                include Lockable
              Severity: Minor
              Found in app/services/activitypub/process_account_service.rb - About 5 hrs to fix

                Function configFromEnv has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                export function configFromEnv(env, environment) {
                  /** @type {Record<string, pg.PoolConfig>} */
                  const pgConfigs = {
                    development: {
                      user: env.DB_USER || pg.defaults.user,
                Severity: Minor
                Found in streaming/database.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 merge_with! has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                      def merge_with!(other_account)
                        # Since it's the same remote resource, the remote resource likely
                        # already believes we are following/blocking, so it's safe to
                        # re-attribute the relationships too. However, during the presence
                        # of the index bug users could have *also* followed the reference
                Severity: Minor
                Found in lib/mastodon/cli/maintenance.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 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';
                  
                  

                    UI has 36 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class UI extends PureComponent {
                      static propTypes = {
                        identity: identityContextPropShape,
                        dispatch: PropTypes.func.isRequired,
                        children: PropTypes.node,
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 4 hrs to fix

                      UI has 36 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class UI extends PureComponent {
                        static propTypes = {
                          identity: identityContextPropShape,
                          dispatch: PropTypes.func.isRequired,
                          children: PropTypes.node,
                      Severity: Minor
                      Found in app/javascript/mastodon/features/ui/index.jsx - About 4 hrs to fix

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

                          render () {
                            const { intl, collapseEnabled, multiColumn } = this.props;
                        
                            return (
                              <Column>
                        Severity: Major
                        Found in app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language