glitch-soc/mastodon

View on GitHub

Showing 1,231 of 4,614 total issues

File focal_point_modal.jsx has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';

Severity: Minor
Found in app/javascript/mastodon/features/ui/components/focal_point_modal.jsx - About 4 hrs to fix

    File emoji_picker_dropdown.jsx has 353 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import { PureComponent } from 'react';
    
    import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
    
    

      File header.jsx has 351 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: Minor
      Found in app/javascript/flavours/glitch/features/account/components/header.jsx - About 4 hrs to fix

        File emoji_picker_dropdown.jsx has 351 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import PropTypes from 'prop-types';
        import { PureComponent } from 'react';
        
        import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
        
        

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

            render () {
              const { intl, hidden, featured, unread, showThread, scrollKey, pictureInPicture, previousId, nextInReplyToId, rootId } = this.props;
          
              let { status, account, ...other } = this.props;
          
          
          Severity: Minor
          Found in app/javascript/mastodon/components/status.jsx - About 4 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 30 (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 4 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 user.rb has 349 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class User < ApplicationRecord
            self.ignored_columns += %w(
              remember_created_at
              remember_token
              current_sign_in_ip
          Severity: Minor
          Found in app/models/user.rb - About 4 hrs to fix

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

              render () {
                const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
                const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
                const progress = Math.min((currentTime / duration) * 100, 100);
                const muted = this.state.muted || volume === 0;
            Severity: Major
            Found in app/javascript/flavours/glitch/features/video/index.jsx - About 4 hrs to fix

              Function Profile has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const Profile = () => {
                const account = useAppSelector(state => state.getIn(['accounts', me]));
                const [displayName, setDisplayName] = useState(account.get('display_name'));
                const [note, setNote] = useState(unescapeHTML(account.get('note')));
                const [avatar, setAvatar] = useState(null);
              Severity: Major
              Found in app/javascript/flavours/glitch/features/onboarding/profile.jsx - About 4 hrs to fix

                Function Profile has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const Profile = () => {
                  const account = useAppSelector(state => state.getIn(['accounts', me]));
                  const [displayName, setDisplayName] = useState(account.get('display_name'));
                  const [note, setNote] = useState(unescapeHTML(account.get('note')));
                  const [avatar, setAvatar] = useState(null);
                Severity: Major
                Found in app/javascript/mastodon/features/onboarding/profile.jsx - About 4 hrs to fix

                  File feed_manager.rb has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'singleton'
                  
                  class FeedManager
                    include Singleton
                    include Redisable
                  Severity: Minor
                  Found in app/lib/feed_manager.rb - About 4 hrs to fix

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

                      render () {
                        const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
                        const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
                        const progress = Math.min((currentTime / duration) * 100, 100);
                        const muted = this.state.muted || volume === 0;
                    Severity: Major
                    Found in app/javascript/mastodon/features/video/index.jsx - About 4 hrs to fix

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

                      const mapDispatchToProps = (dispatch, { intl }) => ({
                      
                        onReply (status, router) {
                          dispatch((_, getState) => {
                            let state = getState();

                      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 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def call(uri, prefetched_body: nil, break_on_redirect: false, only_key: false, suppress_errors: true, request_id: nil)
                          return if domain_not_allowed?(uri)
                          return ActivityPub::TagManager.instance.uri_to_actor(uri) if ActivityPub::TagManager.instance.local_uri?(uri)
                      
                          @json = begin
                      Severity: Minor
                      Found in app/services/activitypub/fetch_remote_actor_service.rb - About 4 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 update_column_in_batches has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def update_column_in_batches(table_name, column, value)
                            if transaction_open?
                              raise 'update_column_in_batches can not be run inside a transaction, ' \
                                'you can disable transactions by calling disable_ddl_transaction! ' \
                                'in the body of your migration class'
                      Severity: Minor
                      Found in lib/mastodon/migration_helpers.rb - About 4 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 parallelize_with_progress has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def parallelize_with_progress(scope)
                            fail_with_message 'Cannot run with this concurrency setting, must be at least 1' if options[:concurrency] < 1
                      
                            reset_connection_pools!
                      
                      
                      Severity: Minor
                      Found in lib/mastodon/cli/progress_helper.rb - About 4 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

                      Status has 33 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Status extends ImmutablePureComponent {
                      
                        static contextType = SensitiveMediaContext;
                      
                        static propTypes = {
                      Severity: Minor
                      Found in app/javascript/flavours/glitch/components/status.jsx - About 4 hrs to fix

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

                          render () {
                            const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props;
                            const { paused, volume, currentTime, duration, buffer, dragging, revealed } = this.state;
                            const progress = Math.min((currentTime / duration) * 100, 100);
                            const muted = this.state.muted || volume === 0;
                        Severity: Major
                        Found in app/javascript/flavours/glitch/features/audio/index.jsx - About 4 hrs to fix

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

                            render () {
                              const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props;
                              const { paused, volume, currentTime, duration, buffer, dragging, revealed } = this.state;
                              const progress = Math.min((currentTime / duration) * 100, 100);
                              const muted = this.state.muted || volume === 0;
                          Severity: Major
                          Found in app/javascript/mastodon/features/audio/index.jsx - About 4 hrs to fix

                            File index.jsx has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import PropTypes from 'prop-types';
                            import React from 'react';
                            
                            import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
                            
                            
                            Severity: Minor
                            Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language