mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

Class MaintenanceCLI has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class MaintenanceCLI < Thor
    include CLIHelper

    def self.exit_on_failure?
      true
Severity: Minor
Found in lib/mastodon/maintenance_cli.rb - About 3 hrs to fix

    Class ActorSerializer has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ActivityPub::ActorSerializer < ActivityPub::Serializer
      include RoutingHelper
      include FormattingHelper
    
      context :security
    Severity: Minor
    Found in app/serializers/activitypub/actor_serializer.rb - About 3 hrs to fix

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

        render () {
          const { intl, results, suggestions, dismissSuggestion, searchTerm } = this.props;
      
          if (searchTerm === '' && !suggestions.isEmpty()) {
            return (
      Severity: Major
      Found in app/javascript/mastodon/features/compose/components/search_results.js - About 3 hrs to fix

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

          render () {
            const { intl, notifications, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId, canMarkAsRead, needsNotificationPermission } = this.props;
            const pinned = !!columnId;
            const emptyMessage = <FormattedMessage id='empty_column.notifications' defaultMessage="You don't have any notifications yet. When other people interact with you, you will see it here." />;
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/notifications/index.js - About 3 hrs to fix

          File dropdown_menu.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import PropTypes from 'prop-types';
          import ImmutablePropTypes from 'react-immutable-proptypes';
          import IconButton from './icon_button';
          import Overlay from 'react-overlays/lib/Overlay';
          Severity: Minor
          Found in app/javascript/mastodon/components/dropdown_menu.js - About 3 hrs to fix

            Function mapDispatchToProps has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            const mapDispatchToProps = (dispatch, { intl }) => ({
            
              onFollow (account) {
                if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
                  if (unfollowModal) {

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

                def parallelize_with_progress(scope)
                  if options[:concurrency] < 1
                    say('Cannot run with this concurrency setting, must be at least 1', :red)
                    exit(1)
                  end
            Severity: Minor
            Found in lib/mastodon/cli_helper.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

            ScrollableList has 27 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default @connect(mapStateToProps, null, null, { forwardRef: true })
            class ScrollableList extends PureComponent {
            
              static contextTypes = {
                router: PropTypes.object,
            Severity: Minor
            Found in app/javascript/mastodon/components/scrollable_list.js - About 3 hrs to fix

              Class NotifyService has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class NotifyService < BaseService
                include Redisable
              
                def call(recipient, type, activity)
                  @recipient    = recipient
              Severity: Minor
              Found in app/services/notify_service.rb - About 3 hrs to fix

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

                  render () {
                    const { selectedFilter, advancedMode, intl } = this.props;
                    const renderedElement = !advancedMode ? (
                      <div className='notification__filter-bar'>
                        <button

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

                    render () {
                      const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, editable, blurhash } = this.props;
                      const { quote } = this.props;
                      // const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, link, editable, blurhash, quote } = this.props;
                      const { containerWidth, currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state;
                  Severity: Minor
                  Found in app/javascript/mastodon/features/video/index.js - 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

                  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/emoji_cli.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

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

                      def refresh
                        dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
                  
                        if options[:status]
                          scope = MediaAttachment.where(status_id: options[:status])
                  Severity: Minor
                  Found in lib/mastodon/media_cli.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

                  File scrollable_list.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { PureComponent } from 'react';
                  import ScrollContainer from 'mastodon/containers/scroll_container';
                  import PropTypes from 'prop-types';
                  import IntersectionObserverArticleContainer from '../containers/intersection_observer_article_container';
                  import LoadMore from './load_more';
                  Severity: Minor
                  Found in app/javascript/mastodon/components/scrollable_list.js - About 3 hrs to fix

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

                    import api from '../api';
                    import { importFetchedAccounts } from './importer';
                    import { showAlertForError } from './alerts';
                    
                    export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST';
                    Severity: Minor
                    Found in app/javascript/mastodon/actions/lists.js - About 3 hrs to fix

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

                        render () {
                          const { attachment, displayWidth } = this.props;
                          const { visible, loaded } = this.state;
                      
                          const width  = `${Math.floor((displayWidth - 4) / 3) - 4}px`;

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

                        class MediaAttachment < ApplicationRecord
                          self.inheritance_column = nil
                        
                          include Attachmentable
                        
                        
                        Severity: Minor
                        Found in app/models/media_attachment.rb - About 3 hrs to fix

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

                          class FeedManager
                            include Singleton
                            include Redisable
                          
                            # Maximum number of items stored in a single feed
                          Severity: Minor
                          Found in app/lib/feed_manager.rb - About 3 hrs to fix

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

                            class PostStatusService < BaseService
                              include Redisable
                              include LanguagesHelper
                            
                              MIN_SCHEDULE_OFFSET = 5.minutes.freeze
                            Severity: Minor
                            Found in app/services/post_status_service.rb - About 3 hrs to fix

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

                                render () {
                                  const { intl, onPaste, showSearch } = this.props;
                                  const disabled = this.props.isSubmitting;
                              
                                  let publishText = '';
                              Severity: Major
                              Found in app/javascript/mastodon/features/compose/components/compose_form.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language