glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

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

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

  render () {
    const { media, statusId, lang, intl, onClose } = this.props;
    const { navigationHidden, zoomedIn, viewportWidth, viewportHeight } = this.state;

    const index = this.getIndex();
Severity: Major
Found in app/javascript/flavours/glitch/features/ui/components/media_modal.jsx - About 4 hrs to fix

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

      render () {
        let ancestors, descendants, remoteHint;
        const { isLoading, status, ancestorsIds, descendantsIds, intl, domain, multiColumn, pictureInPicture } = this.props;
        const { fullscreen } = this.state;
    
    
    Severity: Major
    Found in app/javascript/mastodon/features/status/index.jsx - About 4 hrs to fix

      File public.tsx has 342 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { createRoot } from 'react-dom/client';
      
      import '@/entrypoints/public-path';
      
      import { IntlMessageFormat } from 'intl-messageformat';
      Severity: Minor
      Found in app/javascript/flavours/glitch/entrypoints/public.tsx - About 4 hrs to fix

        File public.tsx has 342 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { createRoot } from 'react-dom/client';
        
        import './public-path';
        
        import { IntlMessageFormat } from 'intl-messageformat';
        Severity: Minor
        Found in app/javascript/entrypoints/public.tsx - About 4 hrs to fix

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

            render () {
              const { attachment, lang, index, size, standalone, letterbox, displayWidth, visible } = this.props;
          
              let badges = [], thumbnail;
          
          
          Severity: Major
          Found in app/javascript/flavours/glitch/components/media_gallery.jsx - About 4 hrs to fix

            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

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

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

                Class FeedManager has 33 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 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 { attachment, lang, index, size, standalone, displayWidth, visible } = this.props;
                    
                        let badges = [], thumbnail;
                    
                    
                    Severity: Major
                    Found in app/javascript/mastodon/components/media_gallery.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

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

                          render () {
                            const { card } = this.props;
                            const { embedded, revealed } = this.state;
                        
                            if (card === null) {
                        Severity: Major
                        Found in app/javascript/flavours/glitch/features/status/components/card.jsx - About 4 hrs to fix

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

                            render () {
                              const { card } = this.props;
                              const { embedded, revealed } = this.state;
                          
                              if (card === null) {
                          Severity: Major
                          Found in app/javascript/mastodon/features/status/components/card.jsx - About 4 hrs to fix

                            Function getData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getData(emoji, skin, set) {
                              let emojiData = {};
                            
                              if (typeof emoji === 'string') {
                                let matches = emoji.match(COLONS_REGEX);
                            Severity: Minor
                            Found in app/javascript/flavours/glitch/features/emoji/emoji_utils.js - 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

                            Function getData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getData(emoji, skin, set) {
                              let emojiData = {};
                            
                              if (typeof emoji === 'string') {
                                let matches = emoji.match(COLONS_REGEX);
                            Severity: Minor
                            Found in app/javascript/mastodon/features/emoji/emoji_utils.js - 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

                            Function AccountCard has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const AccountCard: React.FC<{ accountId: string }> = ({ accountId }) => {
                              const intl = useIntl();
                              const account = useAppSelector((s) => getAccount(s, accountId));
                              const dispatch = useAppDispatch();
                            
                            

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

                            }> = ({ accountId }) => {
                              const intl = useIntl();
                              const dispatch = useAppDispatch();
                              const { signedIn } = useIdentity();
                              const account = useAppSelector((state) =>
                            Severity: Minor
                            Found in app/javascript/mastodon/components/follow_button.tsx - 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

                            Function AccountCard has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const AccountCard: React.FC<{ accountId: string }> = ({ accountId }) => {
                              const intl = useIntl();
                              const account = useAppSelector((s) => getAccount(s, accountId));
                              const dispatch = useAppDispatch();
                            
                            

                            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 102 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render () {
                                const { status, relationship, intl } = this.props;
                                const { signedIn, permissions } = this.props.identity;
                            
                                const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
                            Severity: Major
                            Found in app/javascript/mastodon/features/status/components/action_bar.jsx - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language