glitch-soc/mastodon

View on GitHub
app/javascript/mastodon/features/compose/index.jsx

Summary

Maintainability
F
4 days
Test Coverage

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

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

    if (multiColumn) {
      const { columns } = this.props;
Severity: Minor
Found in app/javascript/mastodon/features/compose/index.jsx - About 1 hr 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: Major
    Found in app/javascript/mastodon/features/compose/index.jsx - About 1 hr to fix

      Similar blocks of code found in 14 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/mastodon/features/compose/index.jsx and 13 other locations - About 6 hrs to fix
      app/javascript/flavours/glitch/components/account.jsx on lines 25..36
      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/compose/index.jsx on lines 39..50
      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 25..36
      app/javascript/flavours/glitch/features/report/category.jsx on lines 14..25
      app/javascript/mastodon/components/account.jsx on lines 25..36
      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/home_timeline/components/inline_follow_suggestions.jsx on lines 26..37
      app/javascript/mastodon/features/picture_in_picture/components/footer.jsx on lines 25..36

      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' }}>
                        <SearchResults />
                      </div>
      Severity: Major
      Found in app/javascript/mastodon/features/compose/index.jsx and 1 other location - About 5 hrs to fix
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 183..189

      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/mastodon/features/compose/index.jsx and 1 other location - About 4 hrs to fix
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 90..107

      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') === '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/mastodon/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/flavours/glitch/features/compose/index.jsx on lines 156..158
      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') === 'NOTIFICATIONS') && (
                    <Link to='/notifications' className='drawer__tab' title={intl.formatMessage(messages.notifications)} aria-label={intl.formatMessage(messages.notifications)}><Icon id='bell' icon={NotificationsIcon} /></Link>
                  )}
      Severity: Major
      Found in app/javascript/mastodon/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/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 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') === '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/mastodon/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/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

      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/mastodon/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/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 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/mastodon/features/compose/index.jsx and 1 other location - About 1 hr to fix
      app/javascript/flavours/glitch/features/compose/index.jsx on lines 195..203

      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