glitch-soc/mastodon

View on GitHub

Showing 1,230 of 4,529 total issues

File accounts.rb has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'set'
require_relative 'base'

module Mastodon::CLI
  class Accounts < Base
Severity: Minor
Found in lib/mastodon/cli/accounts.rb - About 7 hrs to fix

    Function render has 185 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 { compact, pictureInPicture, expanded, onToggleHidden, settings } = this.props;
    
    

      Method call has a Cognitive Complexity of 47 (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 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

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

      class Status extends ImmutablePureComponent {
      
        static contextTypes = {
          identity: PropTypes.object,
        };
      Severity: Minor
      Found in app/javascript/mastodon/features/status/index.jsx - About 7 hrs to fix

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

        class Status extends ImmutablePureComponent {
        
          static contextTypes = {
            identity: PropTypes.object,
          };
        Severity: Minor
        Found in app/javascript/flavours/glitch/features/status/index.jsx - About 6 hrs to fix

          Function emojifyTextNode has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

          const emojifyTextNode = (node, customEmojis) => {
            const VS15 = 0xFE0E;
            const VS16 = 0xFE0F;
          
            let str = node.textContent;
          Severity: Minor
          Found in app/javascript/flavours/glitch/features/emoji/emoji.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"
          
                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 interactions.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import api, { getLinks } from '../api';
          
          import { fetchRelationships } from './accounts';
          import { importFetchedAccounts, importFetchedStatus } from './importer';
          
          
          Severity: Minor
          Found in app/javascript/flavours/glitch/actions/interactions.js - About 6 hrs to fix

            File interactions.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import api, { getLinks } from '../api';
            
            import { fetchRelationships } from './accounts';
            import { importFetchedAccounts, importFetchedStatus } from './importer';
            
            
            Severity: Minor
            Found in app/javascript/mastodon/actions/interactions.js - About 6 hrs to fix

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

                render () {
                  const {
                    parseClick,
                    setCollapsed,
                  } = this;
              Severity: Minor
              Found in app/javascript/flavours/glitch/components/status.jsx - 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 160 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render () {
                  const status = this._properStatus();
                  const outerStyle = { boxSizing: 'border-box' };
                  const { compact, pictureInPicture } = this.props;
              
              

                File header.jsx has 432 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/mastodon/features/account/components/header.jsx - About 6 hrs to fix

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

                  class Audio extends PureComponent {
                  
                    static propTypes = {
                      src: PropTypes.string.isRequired,
                      alt: PropTypes.string,
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/audio/index.jsx - About 6 hrs to fix

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

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

                      File doodle_modal.jsx has 428 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import PropTypes from 'prop-types';
                      
                      import classNames from 'classnames';
                      
                      import ImmutablePropTypes from 'react-immutable-proptypes';

                        Method remove has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def remove
                              fail_with_message '--prune-profiles and --remove-headers should not be specified simultaneously' if options[:prune_profiles] && options[:remove_headers]
                        
                              fail_with_message '--include-follows can only be used with --prune-profiles or --remove-headers' if options[:include_follows] && !(options[:prune_profiles] || options[:remove_headers])
                              time_ago = options[:days].days.ago
                        Severity: Minor
                        Found in lib/mastodon/cli/media.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

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

                          render () {
                            const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission, notificationPolicy } = 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' />;

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

                            render () {
                              const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission, notificationPolicy } = this.props;
                          
                              const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
                              const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;

                            Class Maintenance has 45 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                              class Maintenance < Base
                                MIN_SUPPORTED_VERSION = 2019_10_01_213028
                                MAX_SUPPORTED_VERSION = 2023_10_23_105620
                            
                                # Stubs to enjoy ActiveRecord queries while not depending on a particular
                            Severity: Minor
                            Found in lib/mastodon/cli/maintenance.rb - About 6 hrs to fix

                              Function render has 153 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 6 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language