glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Method import has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def import(path)
      imported = 0
      skipped  = 0
      failed   = 0
      category = options[:category] ? CustomEmojiCategory.find_or_create_by(name: options[:category]) : nil
Severity: Minor
Found in lib/mastodon/cli/emoji.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 ColumnHeader has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export const ColumnHeader: React.FC<Props> = ({
  title,
  icon,
  iconComponent,
  active,
Severity: Minor
Found in app/javascript/flavours/glitch/components/column_header.tsx - 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 ColumnHeader has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export const ColumnHeader: React.FC<Props> = ({
  title,
  icon,
  iconComponent,
  active,
Severity: Minor
Found in app/javascript/mastodon/components/column_header.tsx - 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { handleChange } = this;
    const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props;
    let enabled = !disabled;

    File notifications.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable';
    
    import { blockDomainSuccess } from 'flavours/glitch/actions/domain_blocks';
    import { timelineDelete } from 'flavours/glitch/actions/timelines_typed';
    
    
    Severity: Minor
    Found in app/javascript/flavours/glitch/reducers/notifications.js - About 3 hrs to fix

      File index.tsx has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { useCallback, useEffect, useMemo, useRef } from 'react';
      
      import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
      
      import { Helmet } from 'react-helmet';
      Severity: Minor
      Found in app/javascript/flavours/glitch/features/notifications_v2/index.tsx - About 3 hrs to fix

        File index.tsx has 294 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { useCallback, useEffect, useMemo, useRef } from 'react';
        
        import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
        
        import { Helmet } from 'react-helmet';
        Severity: Minor
        Found in app/javascript/mastodon/features/notifications_v2/index.tsx - About 3 hrs to fix

          File media_gallery.jsx has 293 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import PropTypes from 'prop-types';
          import { PureComponent } from 'react';
          
          import { FormattedMessage } from 'react-intl';
          
          
          Severity: Minor
          Found in app/javascript/mastodon/components/media_gallery.jsx - About 3 hrs to fix

            File profile.tsx has 293 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { useState, useMemo, useCallback, createRef } from 'react';
            
            import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
            
            import classNames from 'classnames';
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/onboarding/profile.tsx - About 3 hrs to fix

              File profile.tsx has 293 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { useState, useMemo, useCallback, createRef } from 'react';
              
              import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
              
              import classNames from 'classnames';
              Severity: Minor
              Found in app/javascript/mastodon/features/onboarding/profile.tsx - About 3 hrs to fix

                File inline_follow_suggestions.tsx has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { useEffect, useCallback, useRef, useState } from 'react';
                
                import { FormattedMessage, useIntl, defineMessages } from 'react-intl';
                
                import { Link } from 'react-router-dom';

                  File inline_follow_suggestions.tsx has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { useEffect, useCallback, useRef, useState } from 'react';
                  
                  import { FormattedMessage, useIntl, defineMessages } from 'react-intl';
                  
                  import { Link } from 'react-router-dom';

                    Function emojifyTextNode has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const emojifyTextNode = (node, customEmojis) => {
                      const VS15 = 0xFE0E;
                      const VS16 = 0xFE0F;
                    
                      let str = node.textContent;
                    Severity: Major
                    Found in app/javascript/flavours/glitch/features/emoji/emoji.js - About 3 hrs to fix

                      Function emojifyTextNode has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const emojifyTextNode = (node, customEmojis) => {
                        const VS15 = 0xFE0E;
                        const VS16 = 0xFE0F;
                      
                        let str = node.textContent;
                      Severity: Major
                      Found in app/javascript/mastodon/features/emoji/emoji.js - About 3 hrs to fix

                        Class AccountSerializer has 26 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class REST::AccountSerializer < ActiveModel::Serializer
                          include RoutingHelper
                          include FormattingHelper
                        
                          # Please update `app/javascript/mastodon/api_types/accounts.ts` when making changes to the attributes
                        Severity: Minor
                        Found in app/serializers/rest/account_serializer.rb - About 3 hrs to fix

                          File dropdown_menu.jsx has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import PropTypes from 'prop-types';
                          import { PureComponent, cloneElement, Children } from 'react';
                          
                          import classNames from 'classnames';
                          import { withRouter } from 'react-router-dom';
                          Severity: Minor
                          Found in app/javascript/flavours/glitch/components/dropdown_menu.jsx - About 3 hrs to fix

                            File dropdown_menu.jsx has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import PropTypes from 'prop-types';
                            import { PureComponent, cloneElement, Children } from 'react';
                            
                            import classNames from 'classnames';
                            import { withRouter } from 'react-router-dom';
                            Severity: Minor
                            Found in app/javascript/mastodon/components/dropdown_menu.jsx - About 3 hrs to fix

                              Function submitCompose has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function submitCompose() {
                                return function (dispatch, getState) {
                                  const status   = getState().getIn(['compose', 'text'], '');
                                  const media    = getState().getIn(['compose', 'media_attachments']);
                                  const statusId = getState().getIn(['compose', 'id'], null);
                              Severity: Major
                              Found in app/javascript/mastodon/actions/compose.js - About 2 hrs to fix

                                Function setupMetrics has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function setupMetrics(channels, pgPool) {
                                  // Collect metrics from Node.js
                                  metrics.collectDefaultMetrics();
                                
                                  new metrics.Gauge({
                                Severity: Major
                                Found in streaming/metrics.js - About 2 hrs to fix

                                  Method remove_orphans has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def remove_orphans
                                        progress        = create_progress_bar(nil)
                                        reclaimed_bytes = 0
                                        removed         = 0
                                        prefix          = options[:prefix]
                                  Severity: Major
                                  Found in lib/mastodon/cli/media.rb - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language