glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

File interactions.js has 416 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { boostModal, favouriteModal } from 'flavours/glitch/initial_state';

import api, { getLinks } from '../api';

import { fetchRelationships } from './accounts';
Severity: Minor
Found in app/javascript/flavours/glitch/actions/interactions.js - About 6 hrs to fix

    Method purge has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def purge(*domains)
          domains            = domains.map { |domain| TagManager.instance.normalize_domain(domain) }
          account_scope      = Account.none
          domain_block_scope = DomainBlock.none
          emoji_scope        = CustomEmoji.none
    Severity: Minor
    Found in lib/mastodon/cli/domains.rb - About 5 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

    File migration_helpers.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Mastodon
      module MigrationHelpers
        class CorruptionError < StandardError
          attr_reader :index_name
    
    
    Severity: Minor
    Found in lib/mastodon/migration_helpers.rb - About 5 hrs to fix

      File notification.jsx has 407 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';

        File interactions.js has 407 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { boostModal } from 'mastodon/initial_state';
        
        import api, { getLinks } from '../api';
        
        import { fetchRelationships } from './accounts';
        Severity: Minor
        Found in app/javascript/mastodon/actions/interactions.js - About 5 hrs to fix

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

            render () {
              const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props;
          
              const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;
              const filterBarShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show_bar' defaultMessage='Show filter bar' />;

            Function AutosuggestTextarea has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

            const AutosuggestTextarea = forwardRef(({
              value,
              suggestions,
              disabled,
              placeholder,
            Severity: Minor
            Found in app/javascript/flavours/glitch/components/autosuggest_textarea.jsx - About 5 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 AutosuggestTextarea has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

            const AutosuggestTextarea = forwardRef(({
              value,
              suggestions,
              disabled,
              placeholder,
            Severity: Minor
            Found in app/javascript/mastodon/components/autosuggest_textarea.jsx - About 5 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

            File detailed_status.tsx has 404 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable @typescript-eslint/no-unsafe-member-access,
                              @typescript-eslint/no-unsafe-call,
                              @typescript-eslint/no-explicit-any,
                              @typescript-eslint/no-unsafe-assignment */
            
            

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

                render () {
                  const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props;
              
                  const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
                  const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;

                DoodleModal has 41 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class DoodleModal extends ImmutablePureComponent {
                
                  static propTypes = {
                    options: ImmutablePropTypes.map,
                    onClose: PropTypes.func.isRequired,

                  Function HoverCardController has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const HoverCardController: React.FC = () => {
                    const [open, setOpen] = useState(false);
                    const [accountId, setAccountId] = useState<string | undefined>();
                    const [anchor, setAnchor] = useState<HTMLElement | null>(null);
                    const cardRef = useRef<HTMLDivElement | null>(null);
                  Severity: Major
                  Found in app/javascript/flavours/glitch/components/hover_card_controller.tsx - About 5 hrs to fix

                    Function HoverCardController has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const HoverCardController: React.FC = () => {
                      const [open, setOpen] = useState(false);
                      const [accountId, setAccountId] = useState<string | undefined>();
                      const [anchor, setAnchor] = useState<HTMLElement | null>(null);
                      const cardRef = useRef<HTMLDivElement | null>(null);
                    Severity: Major
                    Found in app/javascript/mastodon/components/hover_card_controller.tsx - About 5 hrs to fix

                      Function Conversation has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const Conversation = ({ conversation, scrollKey, onMoveUp, onMoveDown }) => {
                        const id = conversation.get('id');
                        const unread = conversation.get('unread');
                        const lastStatusId = conversation.get('last_status');
                        const accountIds = conversation.get('accounts');

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

                        _updateStatusLinks () {
                          const node = this.contentsNode;
                          const { tagLinks, rewriteMentions } = this.props;
                      
                          if (!node) {
                      Severity: Minor
                      Found in app/javascript/flavours/glitch/components/status_content.jsx - About 5 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 36 (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 status.rb has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        Function render has 135 lines of code (exceeds 25 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: Major
                        Found in app/javascript/flavours/glitch/components/status_action_bar.jsx - About 5 hrs to fix

                          File status_content.jsx has 389 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

                            Video has 40 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Video extends PureComponent {
                            
                              static propTypes = {
                                preview: PropTypes.string,
                                frameRate: PropTypes.string,
                            Severity: Minor
                            Found in app/javascript/flavours/glitch/features/video/index.jsx - About 5 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language