glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

Class DeleteAccountService has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

class DeleteAccountService < BaseService
  include Payloadable

  ASSOCIATIONS_ON_SUSPEND = %w(
    account_notes
Severity: Minor
Found in app/services/delete_account_service.rb - About 3 hrs to fix

    File media_attachment.rb has 319 lines of code (exceeds 250 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

      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/flavours/glitch/components/admin/Retention.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

          File create.rb has 317 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

            File search.jsx has 316 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/flavours/glitch/features/compose/components/search.jsx - About 3 hrs to fix

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

                  render () {
                    const { attachment, lang, index, size, standalone, letterbox, displayWidth, visible } = this.props;
                
                    let badges = [], thumbnail;
                
                
                Severity: Minor
                Found in app/javascript/flavours/glitch/components/media_gallery.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 MediaItem has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                }> = ({ attachment, onOpenMedia }) => {
                  const [visible, setVisible] = useState(
                    (displayMedia !== 'hide_all' &&
                      !attachment.getIn(['status', 'sensitive'])) ||
                      displayMedia === 'show_all',

                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: Pick<IntlShape, 'formatDate' | 'formatMessage'>,
                  date: Date,
                  now: number,
                  year: number,
                Severity: Minor
                Found in app/javascript/flavours/glitch/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

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

                }> = ({ attachment, onOpenMedia }) => {
                  const [visible, setVisible] = useState(
                    (displayMedia !== 'hide_all' &&
                      !attachment.getIn(['status', 'sensitive'])) ||
                      displayMedia === 'show_all',

                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: Pick<IntlShape, 'formatDate' | 'formatMessage'>,
                  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

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

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

                  File admin.tsx has 315 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import '@/entrypoints/public-path';
                  import { createRoot } from 'react-dom/client';
                  
                  import Rails from '@rails/ujs';
                  
                  
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/entrypoints/admin.tsx - About 3 hrs to fix

                    File admin.tsx has 315 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import './public-path';
                    import { createRoot } from 'react-dom/client';
                    
                    import Rails from '@rails/ujs';
                    
                    
                    Severity: Minor
                    Found in app/javascript/entrypoints/admin.tsx - About 3 hrs to fix

                      File statuses.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { browserHistory } from 'flavours/glitch/components/router';
                      
                      import api from '../api';
                      
                      import { ensureComposeIsVisible, setComposeToStatus } from './compose';
                      Severity: Minor
                      Found in app/javascript/flavours/glitch/actions/statuses.js - About 3 hrs to fix

                        File statuses.js has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { browserHistory } from 'mastodon/components/router';
                        
                        import api from '../api';
                        
                        import { ensureComposeIsVisible, setComposeToStatus } from './compose';
                        Severity: Minor
                        Found in app/javascript/mastodon/actions/statuses.js - About 3 hrs to fix

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

                            render () {
                              const {
                                accountId,
                                account,
                                intl,

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

                              render () {
                                const { intl, onPaste, autoFocus, withoutNavigation, maxChars } = this.props;
                                const { highlighted } = this.state;
                                const disabled = this.props.isSubmitting;
                            
                            

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language