glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

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

  render () {
    const { account, hidden, intl } = this.props;
    const { signedIn, permissions } = this.props.identity;

    if (!account) {
Severity: Minor
Found in app/javascript/flavours/glitch/features/account/components/header.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 721 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { defineMessages } from 'react-intl';

import axios from 'axios';
import { throttle } from 'lodash';

Severity: Major
Found in app/javascript/flavours/glitch/actions/compose.js - About 1 day to fix

    File compose.js has 688 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { defineMessages } from 'react-intl';
    
    import axios from 'axios';
    import { throttle } from 'lodash';
    
    
    Severity: Major
    Found in app/javascript/mastodon/actions/compose.js - About 1 day to fix

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

      import PropTypes from 'prop-types';
      
      import { injectIntl, FormattedMessage } from 'react-intl';
      
      import classNames from 'classnames';
      Severity: Major
      Found in app/javascript/flavours/glitch/components/status.jsx - About 1 day to fix

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

          render () {
            const { account, hidden, intl } = this.props;
            const { signedIn, permissions } = this.props.identity;
        
            if (!account) {
        Severity: Minor
        Found in app/javascript/mastodon/features/account/components/header.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

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

          render () {
            const { intl, hidden, featured, unfocusable, unread, pictureInPicture, previousId, nextInReplyToId, rootId, skipPrepend, avatarSize = 46 } = this.props;
        
            const {
              parseClick,
        Severity: Major
        Found in app/javascript/flavours/glitch/components/status.jsx - About 1 day to fix

          Function compose has 286 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function compose(state = initialState, action) {
            switch(action.type) {
            case STORE_HYDRATE:
              return hydrate(state, action.state.get('compose'));
            case COMPOSE_MOUNT:
          Severity: Major
          Found in app/javascript/flavours/glitch/reducers/compose.js - About 1 day to fix

            File index.jsx has 629 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: Major
            Found in app/javascript/flavours/glitch/features/status/index.jsx - About 1 day to fix

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

                render () {
                  const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
                  const { signedIn, permissions } = this.props.identity;
              
                  const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
              Severity: Minor
              Found in app/javascript/mastodon/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

              Method remove_orphans has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
              Open

                  def remove_orphans
                    progress        = create_progress_bar(nil)
                    reclaimed_bytes = 0
                    removed         = 0
                    prefix          = options[:prefix]
              Severity: Minor
              Found in lib/mastodon/cli/media.rb - 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 maintenance.rb has 620 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require_relative 'base'
              
              module Mastodon::CLI
                class Maintenance < Base
                  MIN_SUPPORTED_VERSION = 2019_10_01_213028
              Severity: Major
              Found in lib/mastodon/cli/maintenance.rb - About 1 day to fix

                File compose.js has 618 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 'flavours/glitch/actions/timelines_typed';
                
                import {
                Severity: Major
                Found in app/javascript/flavours/glitch/reducers/compose.js - About 1 day to fix

                  Function search has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function search(value, { emojisToShowFilter, maxResults, include, exclude, custom } = {}) {
                    if (custom !== undefined) {
                      if (customEmojisList !== custom)
                        addCustomToPool(custom, originalPool);
                    } else {

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

                  function search(value, { emojisToShowFilter, maxResults, include, exclude, custom } = {}) {
                    if (custom !== undefined) {
                      if (customEmojisList !== custom)
                        addCustomToPool(custom, originalPool);
                    } else {
                  Severity: Minor
                  Found in app/javascript/mastodon/features/emoji/emoji_mart_search_light.js - 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 604 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: Major
                  Found in app/javascript/mastodon/features/status/index.jsx - About 1 day to fix

                    File accounts.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { browserHistory } from 'flavours/glitch/components/router';
                    import { debounceWithDispatchAndArguments } from 'flavours/glitch/utils/debounce';
                    
                    import api, { getLinks } from '../api';
                    
                    
                    Severity: Major
                    Found in app/javascript/flavours/glitch/actions/accounts.js - About 1 day to fix

                      File accounts.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { browserHistory } from 'mastodon/components/router';
                      import { debounceWithDispatchAndArguments } from 'mastodon/utils/debounce';
                      
                      import api, { getLinks } from '../api';
                      
                      
                      Severity: Major
                      Found in app/javascript/mastodon/actions/accounts.js - About 1 day to fix

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

                          render () {
                            const { status, relationship, intl } = this.props;
                            const { signedIn, permissions } = this.props.identity;
                        
                            const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
                        Severity: Minor
                        Found in app/javascript/mastodon/features/status/components/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

                        Function compose has 242 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function compose(state = initialState, action) {
                          switch(action.type) {
                          case STORE_HYDRATE:
                            return hydrate(state, action.state.get('compose'));
                          case COMPOSE_MOUNT:
                        Severity: Major
                        Found in app/javascript/mastodon/reducers/compose.js - About 1 day to fix

                          File index.jsx has 562 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: Major
                          Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language