glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

File detailed_status.tsx has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @typescript-eslint/no-unsafe-member-access,
                  @typescript-eslint/no-unsafe-call,
                  @typescript-eslint/no-explicit-any,
                  @typescript-eslint/no-unsafe-assignment */

    Method crawl has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def crawl(start = nil)
          stats           = Concurrent::Hash.new
          processed       = Concurrent::AtomicFixnum.new(0)
          failed          = Concurrent::AtomicFixnum.new(0)
          start_at        = Time.now.to_f
    Severity: Minor
    Found in lib/mastodon/cli/domains.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.jsx has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import { PureComponent } from 'react';
    
    import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
    
    

      File focal_point_modal.jsx has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import PropTypes from 'prop-types';
      import { PureComponent } from 'react';
      
      import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
      
      
      Severity: Minor
      Found in app/javascript/mastodon/features/ui/components/focal_point_modal.jsx - About 4 hrs to fix

        Class LinkDetailsExtractor has 35 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class LinkDetailsExtractor
          include ActionView::Helpers::TagHelper
          include LanguagesHelper
        
          # Some publications wrap their JSON-LD data in their <script> tags
        Severity: Minor
        Found in app/lib/link_details_extractor.rb - About 4 hrs to fix

          File emoji_picker_dropdown.jsx has 353 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import PropTypes from 'prop-types';
          import { PureComponent } from 'react';
          
          import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
          
          

            File feed_manager.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'singleton'
            
            class FeedManager
              include Singleton
              include Redisable
            Severity: Minor
            Found in app/lib/feed_manager.rb - About 4 hrs to fix

              Function UploadForm has 111 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const UploadForm: React.FC = () => {
                const dispatch = useAppDispatch();
                const intl = useIntl();
                const mediaIds = useAppSelector(
                  (state) =>

                File emoji_picker_dropdown.jsx has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import PropTypes from 'prop-types';
                import { PureComponent } from 'react';
                
                import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
                
                

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

                    def signed_request_actor
                      return @signed_request_actor if defined?(@signed_request_actor)
                  
                      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

                  File header.jsx has 350 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import PropTypes from 'prop-types';
                  
                  import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
                  
                  import classNames from 'classnames';
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/account/components/header.jsx - About 4 hrs to fix

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

                      render () {
                        let ancestors, descendants, remoteHint;
                        const { isLoading, status, settings, ancestorsIds, descendantsIds, intl, domain, multiColumn, pictureInPicture } = this.props;
                        const { fullscreen } = this.state;
                    
                    
                    Severity: Major
                    Found in app/javascript/flavours/glitch/features/status/index.jsx - About 4 hrs to fix

                      Function UploadForm has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const UploadForm: React.FC = () => {
                        const dispatch = useAppDispatch();
                        const intl = useIntl();
                        const mediaIds = useAppSelector(
                          (state) =>
                      Severity: Major
                      Found in app/javascript/mastodon/features/compose/components/upload_form.tsx - About 4 hrs to fix

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

                          render () {
                            const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
                            const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
                            const progress = Math.min((currentTime / duration) * 100, 100);
                            const muted = this.state.muted || volume === 0;
                        Severity: Major
                        Found in app/javascript/flavours/glitch/features/video/index.jsx - About 4 hrs to fix

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

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

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

                              render () {
                                const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
                                const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
                                const progress = Math.min((currentTime / duration) * 100, 100);
                                const muted = this.state.muted || volume === 0;
                            Severity: Major
                            Found in app/javascript/mastodon/features/video/index.jsx - About 4 hrs to fix

                              File index.jsx has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import PropTypes from 'prop-types';
                              import React from 'react';
                              
                              import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
                              
                              
                              Severity: Minor
                              Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 4 hrs to fix

                                File index.jsx has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import PropTypes from 'prop-types';
                                import React from 'react';
                                
                                import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
                                
                                
                                Severity: Minor
                                Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 4 hrs to fix

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

                                    def call(uri, prefetched_body: nil, break_on_redirect: false, only_key: false, suppress_errors: true, request_id: nil)
                                      return if domain_not_allowed?(uri)
                                      return ActivityPub::TagManager.instance.uri_to_actor(uri) if ActivityPub::TagManager.instance.local_uri?(uri)
                                  
                                      @json = begin
                                  Severity: Minor
                                  Found in app/services/activitypub/fetch_remote_actor_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 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language