glitch-soc/mastodon

View on GitHub
app/javascript/flavours/glitch/features/compose/index.jsx

Summary

Maintainability
F
4 days
Test Coverage

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

  render () {
    const { multiColumn, showSearch, showNotificationsBadge, unreadNotifications, intl } = this.props;

    const elefriend = [glitchedElephant1, glitchedElephant2, glitchedElephant3, elephantUIPlane][this.state.elefriend];

Severity: Major
Found in app/javascript/flavours/glitch/features/compose/index.jsx - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (multiColumn) {
          const { columns } = this.props;
    
          return (
            <div className='drawer' role='region' aria-label={intl.formatMessage(messages.compose)}>
    Severity: Critical
    Found in app/javascript/flavours/glitch/features/compose/index.jsx - About 1 hr to fix

      Similar blocks of code found in 13 locations. Consider refactoring.
      Open

      const messages = defineMessages({
        start: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
        home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
        notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
        public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 12 other locations - About 6 hrs to fix
      app/javascript/flavours/glitch/features/compose/components/poll_form.jsx on lines 20..31
      app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.jsx on lines 18..29
      app/javascript/flavours/glitch/features/directory/components/account_card.jsx on lines 27..38
      app/javascript/flavours/glitch/features/home_timeline/components/inline_follow_suggestions.jsx on lines 26..37
      app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx on lines 26..37
      app/javascript/flavours/glitch/features/report/category.jsx on lines 14..25
      app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 19..30
      app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 18..29
      app/javascript/mastodon/features/compose/index.jsx on lines 36..47
      app/javascript/mastodon/features/home_timeline/components/inline_follow_suggestions.jsx on lines 26..37
      app/javascript/mastodon/features/notifications/components/notification.jsx on lines 32..43
      app/javascript/mastodon/features/picture_in_picture/components/footer.jsx on lines 26..37

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 172.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  <Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
                    {({ x }) => (
                      <div className='drawer__inner darker' style={{ transform: `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>
                        <SearchResultsContainer />
                      </div>
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 1 other location - About 5 hrs to fix
      app/javascript/mastodon/features/compose/index.jsx on lines 138..144

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

        handleLogoutClick = e => {
          const { dispatch, intl } = this.props;
      
          e.preventDefault();
          e.stopPropagation();
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 1 other location - About 4 hrs to fix
      app/javascript/mastodon/features/compose/index.jsx on lines 74..91

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 129.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  {!columns.some(column => column.get('id') === 'PUBLIC') && (
                    <Link to='/public' className='drawer__tab' title={intl.formatMessage(messages.public)} aria-label={intl.formatMessage(messages.public)}><Icon id='globe' icon={PublicIcon} /></Link>
                  )}
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 6 other locations - About 3 hrs to fix
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 142..144
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 153..155
      app/javascript/mastodon/features/compose/index.jsx on lines 111..113
      app/javascript/mastodon/features/compose/index.jsx on lines 114..116
      app/javascript/mastodon/features/compose/index.jsx on lines 117..119
      app/javascript/mastodon/features/compose/index.jsx on lines 120..122

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  {!columns.some(column => column.get('id') === 'COMMUNITY') && (
                    <Link to='/public/local' className='drawer__tab' title={intl.formatMessage(messages.community)} aria-label={intl.formatMessage(messages.community)}><Icon id='users' icon={PeopleIcon} /></Link>
                  )}
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 6 other locations - About 3 hrs to fix
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 142..144
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 156..158
      app/javascript/mastodon/features/compose/index.jsx on lines 111..113
      app/javascript/mastodon/features/compose/index.jsx on lines 114..116
      app/javascript/mastodon/features/compose/index.jsx on lines 117..119
      app/javascript/mastodon/features/compose/index.jsx on lines 120..122

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  {!columns.some(column => column.get('id') === 'HOME') && (
                    <Link to='/home' className='drawer__tab' title={intl.formatMessage(messages.home_timeline)} aria-label={intl.formatMessage(messages.home_timeline)}><Icon id='home' icon={HomeIcon} /></Link>
                  )}
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 6 other locations - About 3 hrs to fix
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 153..155
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 156..158
      app/javascript/mastodon/features/compose/index.jsx on lines 111..113
      app/javascript/mastodon/features/compose/index.jsx on lines 114..116
      app/javascript/mastodon/features/compose/index.jsx on lines 117..119
      app/javascript/mastodon/features/compose/index.jsx on lines 120..122

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          return (
            <Column onFocus={this.onFocus}>
              <ComposeFormContainer />
      
              <Helmet>
      Severity: Major
      Found in app/javascript/flavours/glitch/features/compose/index.jsx and 1 other location - About 1 hr to fix
      app/javascript/mastodon/features/compose/index.jsx on lines 150..158

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status