maa123/mastodon

View on GitHub

Showing 793 of 1,813 total issues

Method perform has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    return if under_load?

    budget = compute_budget

Severity: Minor
Found in app/workers/scheduler/accounts_statuses_cleanup_scheduler.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

Function render has 93 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." />;
    const { signedIn } = this.context.identity;
Severity: Major
Found in app/javascript/mastodon/features/notifications/index.jsx - About 3 hrs to fix

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

      render () {
        const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
        const isLoading = server.get('isLoading');
    
        return (
    Severity: Major
    Found in app/javascript/mastodon/features/about/index.jsx - About 3 hrs to fix

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

        render () {
          const { loading, data } = this.state;
          const { frequency } = this.props;
      
          let content;
      Severity: Major
      Found in app/javascript/mastodon/components/admin/Retention.jsx - About 3 hrs to fix

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

          render () {
            const { router } = this.context;
            const { title, icon, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, placeholder, appendContent, collapseIssues } = this.props;
            const { collapsed, animating } = this.state;
        
        
        Severity: Minor
        Found in app/javascript/mastodon/components/column_header.jsx - 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

        Function timeAgoString has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        export const timeAgoString = (
          intl: IntlShape,
          date: Date,
          now: number,
          year: number,
        Severity: Minor
        Found in app/javascript/mastodon/components/relative_timestamp.tsx - 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 status_action_bar.jsx has 315 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          File create.rb has 314 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class ActivityPub::Activity::Create < ActivityPub::Activity
            include FormattingHelper
          
            def perform
              @account.schedule_refresh_if_stale!
          Severity: Minor
          Found in app/lib/activitypub/activity/create.rb - About 3 hrs to fix

            Function channelNameToIds has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const channelNameToIds = (req, name, params) => new Promise((resolve, reject) => {
                switch (name) {
                case 'user':
                  resolve({
                    channelIds: channelsForUserStream(req),
            Severity: Major
            Found in streaming/index.js - About 3 hrs to fix

              Class ActorSerializer has 29 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

                Class NoteSerializer has 29 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class ActivityPub::NoteSerializer < ActivityPub::Serializer
                  include FormattingHelper
                
                  context_extensions :atom_uri, :conversation, :sensitive, :voters_count
                
                
                Severity: Minor
                Found in app/serializers/activitypub/note_serializer.rb - About 3 hrs to fix

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

                    render () {
                      const {
                        accountId,
                        account,
                        intl,
                  Severity: Major
                  Found in app/javascript/mastodon/features/ui/components/report_modal.jsx - About 3 hrs to fix

                    File search.jsx has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

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

                        render () {
                          const { account, intl, hidden, withBio, onActionClick, actionIcon, actionTitle, defaultAction, size, minimal } = this.props;
                      
                          if (!account) {
                            return <EmptyAccount size={size} minimal={minimal} />;
                      Severity: Major
                      Found in app/javascript/mastodon/components/account.jsx - About 3 hrs to fix

                        Function renderItem has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          renderItem (account, size, index) {
                            const { animate } = this.props;
                        
                            let width  = 50;
                            let height = 100;
                        Severity: Minor
                        Found in app/javascript/mastodon/components/avatar_composite.jsx - 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

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

                          render () {
                            const { account, intl, hidden, withBio, onActionClick, actionIcon, actionTitle, defaultAction, size, minimal } = this.props;
                        
                            if (!account) {
                              return <EmptyAccount size={size} minimal={minimal} />;
                        Severity: Minor
                        Found in app/javascript/mastodon/components/account.jsx - 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

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

                          render () {
                            const { card } = this.props;
                            const { embedded, revealed } = this.state;
                        
                            if (card === null) {
                        Severity: Minor
                        Found in app/javascript/mastodon/features/status/components/card.jsx - 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 signed_request_actor has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def signed_request_actor
                            return @signed_request_actor if defined?(@signed_request_actor)
                        
                            raise SignatureVerificationError, 'Request not signed' unless signed_request?
                            raise SignatureVerificationError, 'Incompatible request signature. keyId and signature are required' if missing_required_signature_parameters?
                        Severity: Minor
                        Found in app/controllers/concerns/signature_verification.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 patch_for_forwarding! has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def patch_for_forwarding!(original, compacted)
                            original.without('@context', 'signature').each do |key, value|
                              next if value.nil? || !compacted.key?(key)
                        
                              compacted_value = compacted[key]
                        Severity: Minor
                        Found in app/helpers/jsonld_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

                        Method call has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def call(query, account, limit, options = {})
                            @query     = query&.strip&.gsub(QUOTE_EQUIVALENT_CHARACTERS, '"')
                            @account   = account
                            @options   = options
                            @limit     = limit.to_i
                        Severity: Minor
                        Found in app/services/search_service.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

                        Severity
                        Category
                        Status
                        Source
                        Language