glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

Function notificationGroupsReducer has 188 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  (builder) => {
    builder
      .addCase(fetchNotifications.fulfilled, (state, action) => {
        state.groups = action.payload.map((json) =>
          json.type === 'gap' ? json : createNotificationGroupFromJSON(json),
Severity: Major
Found in app/javascript/mastodon/reducers/notification_groups.ts - About 7 hrs to fix

    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

    Function emojifyTextNode has a Cognitive Complexity of 46 (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/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

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

    class Status extends ImmutablePureComponent {
      static propTypes = {
        identity: identityContextPropShape,
        params: PropTypes.object.isRequired,
        dispatch: PropTypes.func.isRequired,
    Severity: Minor
    Found in app/javascript/mastodon/features/status/index.jsx - About 6 hrs to fix

      Class Account has 48 methods (exceeds 20 allowed). Consider refactoring.
      Open

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

        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

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

        class Status extends ImmutablePureComponent {
          static propTypes = {
            identity: identityContextPropShape,
            params: PropTypes.object.isRequired,
            dispatch: PropTypes.func.isRequired,
        Severity: Minor
        Found in app/javascript/flavours/glitch/features/status/index.jsx - About 6 hrs to fix

          Function loaded has 162 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function loaded() {
            const { messages: localeData } = getLocale();
          
            const locale = document.documentElement.lang;
          
          
          Severity: Major
          Found in app/javascript/flavours/glitch/entrypoints/public.tsx - About 6 hrs to fix

            Function loaded has 162 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function loaded() {
              const { messages: localeData } = getLocale();
            
              const locale = document.documentElement.lang;
            
            
            Severity: Major
            Found in app/javascript/entrypoints/public.tsx - 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

                  Class Maintenance has 46 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

                    File header.jsx has 429 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

                      Function PolicyControls has 157 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const PolicyControls: React.FC = () => {
                        const intl = useIntl();
                        const dispatch = useAppDispatch();
                      
                        const notificationPolicy = useAppSelector(

                        Function PolicyControls has 157 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const PolicyControls: React.FC = () => {
                          const intl = useIntl();
                          const dispatch = useAppDispatch();
                        
                          const notificationPolicy = useAppSelector(

                          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 DetailedStatus has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                            Open

                            }> = ({
                              status,
                              onOpenMedia,
                              onOpenVideo,
                              onTranslate,

                            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 notification.jsx has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

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

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

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