glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

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

  render () {
    const { status, intl, withDismiss, withCounters, showReplyCount, scrollKey } = this.props;
    const { permissions, signedIn } = this.props.identity;

    const mutingConversation = status.get('muted');
Severity: Minor
Found in app/javascript/flavours/glitch/components/status_action_bar.jsx - About 1 day 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 index.jsx has 546 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';

Severity: Major
Found in app/javascript/flavours/glitch/features/video/index.jsx - About 1 day to fix

    Class Status has 62 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Status < ApplicationRecord
      include Cacheable
      include Discard::Model
      include Paginable
      include RateLimitable
    Severity: Major
    Found in app/models/status.rb - About 1 day to fix

      File notification_groups.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { createReducer, isAnyOf } from '@reduxjs/toolkit';
      
      import {
        authorizeFollowRequestSuccess,
        blockAccountSuccess,
      Severity: Major
      Found in app/javascript/flavours/glitch/reducers/notification_groups.ts - About 1 day to fix

        File notification_groups.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { createReducer, isAnyOf } from '@reduxjs/toolkit';
        
        import {
          authorizeFollowRequestSuccess,
          blockAccountSuccess,
        Severity: Major
        Found in app/javascript/mastodon/reducers/notification_groups.ts - About 1 day to fix

          File index.jsx has 538 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';
          
          
          Severity: Major
          Found in app/javascript/mastodon/features/video/index.jsx - About 1 day to fix

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

              render () {
                const { account, hidden, intl } = this.props;
                const { signedIn, permissions } = this.props.identity;
            
                if (!account) {
            Severity: Major
            Found in app/javascript/mastodon/features/account/components/header.jsx - About 1 day to fix

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

                render () {
                  const { status, intl } = this.props;
                  const { signedIn, permissions } = this.props.identity;
              
                  const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));

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

                render () {
                  const { intl, hidden, featured, unfocusable, unread, pictureInPicture, previousId, nextInReplyToId, rootId, skipPrepend, avatarSize = 46 } = this.props;
              
                  const {
                    parseClick,
              Severity: Minor
              Found in app/javascript/flavours/glitch/components/status.jsx - About 1 day 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 compose.js has 502 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
              
              import { timelineDelete } from 'mastodon/actions/timelines_typed';
              
              import {
              Severity: Major
              Found in app/javascript/mastodon/reducers/compose.js - About 1 day to fix

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

                  render () {
                    const { account, hidden, intl } = this.props;
                    const { signedIn, permissions } = this.props.identity;
                
                    if (!account) {
                Severity: Major
                Found in app/javascript/flavours/glitch/features/account/components/header.jsx - About 1 day to fix

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

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

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

                    //  Package imports
                    import PropTypes from 'prop-types';
                    import { PureComponent } from 'react';
                    
                    import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/features/local_settings/page/index.jsx - About 7 hrs to fix

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

                      require_relative 'base'
                      
                      module Mastodon::CLI
                        class Accounts < Base
                          option :all, type: :boolean
                      Severity: Minor
                      Found in lib/mastodon/cli/accounts.rb - About 7 hrs to fix

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

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

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

                            render () {
                              const { intl, hidden, featured, unfocusable, unread, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId, skipPrepend, avatarSize = 46 } = this.props;
                          
                              let { status, account, ...other } = this.props;
                          
                          
                          Severity: Major
                          Found in app/javascript/mastodon/components/status.jsx - About 7 hrs to fix

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

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

                              File status.jsx has 484 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import PropTypes from 'prop-types';
                              
                              import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
                              
                              import classNames from 'classnames';
                              Severity: Minor
                              Found in app/javascript/mastodon/components/status.jsx - About 7 hrs to fix

                                Function emojifyTextNode has a Cognitive Complexity of 49 (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 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 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/flavours/glitch/reducers/notification_groups.ts - About 7 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language