glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Notification has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Notification extends ImmutablePureComponent {
  static propTypes = {
    notification: ImmutablePropTypes.map.isRequired,
    hidden: PropTypes.bool,
    onMoveUp: PropTypes.func.isRequired,

    Class AccountsController has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class AccountsController < BaseController
        before_action :set_account, except: [:index, :batch]
        before_action :require_remote_account!, only: [:redownload]
        before_action :require_local_account!, only: [:enable, :memorialize, :approve, :reject]
    
    
    Severity: Minor
    Found in app/controllers/admin/accounts_controller.rb - About 2 hrs to fix

      Class Request has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Request
        REQUEST_TARGET = '(request-target)'
      
        # We enforce a 5s timeout on DNS resolving, 5s timeout on socket opening
        # and 5s timeout on the TLS handshake, meaning the worst case should take
      Severity: Minor
      Found in app/lib/request.rb - About 2 hrs to fix

        Class FanOutOnWriteService has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class FanOutOnWriteService < BaseService
          include Redisable
        
          # Push a status into home and mentions feeds
          # @param [Status] status
        Severity: Minor
        Found in app/services/fan_out_on_write_service.rb - About 2 hrs to fix

          Class UserMailer has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class UserMailer < Devise::Mailer
            layout 'mailer'
          
            helper :accounts
            helper :application
          Severity: Minor
          Found in app/mailers/user_mailer.rb - About 2 hrs to fix

            Class StatusSerializer has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

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

                render () {
                  const { id, options, children, placeholder, value } = this.props;
              
                  if (options && options.length > 0) {
                    const currentValue = value;

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

                  render () {
                    const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other }  = this.props;
                    const { isLoading, isPartial } = other;
                
                    if (isPartial) {
                Severity: Major
                Found in app/javascript/mastodon/components/status_list.jsx - About 2 hrs to fix

                  Function computeHashtagBarForStatus has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function computeHashtagBarForStatus(status: StatusLike): {
                    statusContentProps: { statusContent: string };
                    hashtagsInBar: string[];
                  } {
                    let statusContent = getStatusContent(status);
                  Severity: Major
                  Found in app/javascript/flavours/glitch/components/hashtag_bar.tsx - About 2 hrs to fix

                    Function computeHashtagBarForStatus has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function computeHashtagBarForStatus(status: StatusLike): {
                      statusContentProps: { statusContent: string };
                      hashtagsInBar: string[];
                    } {
                      let statusContent = getStatusContent(status);
                    Severity: Major
                    Found in app/javascript/mastodon/components/hashtag_bar.tsx - About 2 hrs to fix

                      Function PictureInPicture has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const PictureInPicture: React.FC = () => {
                        const dispatch = useAppDispatch();
                      
                        const handleClose = useCallback(() => {
                          dispatch(removePictureInPicture());
                      Severity: Major
                      Found in app/javascript/mastodon/features/picture_in_picture/index.tsx - About 2 hrs to fix

                        File column_header.tsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { useCallback, useState } from 'react';
                        
                        import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
                        
                        import classNames from 'classnames';
                        Severity: Minor
                        Found in app/javascript/flavours/glitch/components/column_header.tsx - About 2 hrs to fix

                          File column_header.tsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { useCallback, useState } from 'react';
                          
                          import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
                          
                          import classNames from 'classnames';
                          Severity: Minor
                          Found in app/javascript/mastodon/components/column_header.tsx - About 2 hrs to fix

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

                              render () {
                                const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other }  = this.props;
                                const { isLoading, isPartial } = other;
                            
                                if (isPartial) {
                            Severity: Major
                            Found in app/javascript/flavours/glitch/components/status_list.jsx - About 2 hrs to fix

                              Function createNotificationGroupFromJSON has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function createNotificationGroupFromJSON(
                                groupJson: ApiNotificationGroupJSON,
                              ): NotificationGroup {
                                const { sample_account_ids: sampleAccountIds, ...group } = groupJson;
                              
                              
                              Severity: Major
                              Found in app/javascript/flavours/glitch/models/notification_group.ts - About 2 hrs to fix

                                Function createNotificationGroupFromJSON has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function createNotificationGroupFromJSON(
                                  groupJson: ApiNotificationGroupJSON,
                                ): NotificationGroup {
                                  const { sample_account_ids: sampleAccountIds, ...group } = groupJson;
                                
                                
                                Severity: Major
                                Found in app/javascript/mastodon/models/notification_group.ts - About 2 hrs to fix

                                  File new.tsx has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { useCallback, useState, useEffect } from 'react';
                                  
                                  import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
                                  
                                  import { Helmet } from 'react-helmet';
                                  Severity: Minor
                                  Found in app/javascript/flavours/glitch/features/lists/new.tsx - About 2 hrs to fix

                                    File new.tsx has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import { useCallback, useState, useEffect } from 'react';
                                    
                                    import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
                                    
                                    import { Helmet } from 'react-helmet';
                                    Severity: Minor
                                    Found in app/javascript/mastodon/features/lists/new.tsx - About 2 hrs to fix

                                      Function normalizeStatus has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export function normalizeStatus(status, normalOldStatus, settings) {
                                        const normalStatus   = { ...status };
                                        normalStatus.account = status.account.id;
                                      
                                        if (status.reblog && status.reblog.id) {
                                      Severity: Minor
                                      Found in app/javascript/flavours/glitch/actions/importer/normalizer.js - About 2 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 request_review! has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        def self.request_review!
                                          return if skip_review? || !enabled?
                                      
                                          links_requiring_review    = links.request_review
                                          tags_requiring_review     = tags.request_review
                                      Severity: Minor
                                      Found in app/models/trends.rb - About 2 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