maa123/mastodon

View on GitHub

Showing 1,813 of 1,813 total issues

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

    if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) {
      info.push(<span key='followed_by' className='relationship-tag'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>);
    } else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
      info.push(<span key='blocked' className='relationship-tag'><FormattedMessage id='account.blocked' defaultMessage='Blocked' /></span>);
    }
app/javascript/mastodon/features/account/components/header.jsx on lines 254..258

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 165.

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

Audio has 46 functions (exceeds 20 allowed). Consider refactoring.
Open

class Audio extends PureComponent {

  static propTypes = {
    src: PropTypes.string.isRequired,
    alt: PropTypes.string,
Severity: Minor
Found in app/javascript/mastodon/features/audio/index.jsx - About 6 hrs to fix

    Method remove has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove
          if options[:prune_profiles] && options[:remove_headers]
            say('--prune-profiles and --remove-headers should not be specified simultaneously', :red, true)
            exit(1)
          end
    Severity: Minor
    Found in lib/mastodon/cli/media.rb - About 6 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

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

      _selectChild (index, align_top) {
        const container = this.column.node;
        const element = container.querySelector(`article:nth-of-type(${index + 1}) .focusable`);
    
        if (element) {
    Severity: Major
    Found in app/javascript/mastodon/features/notifications/index.jsx and 2 other locations - About 6 hrs to fix
    app/javascript/mastodon/components/status_list.jsx on lines 67..79
    app/javascript/mastodon/features/direct_timeline/components/conversations_list.jsx on lines 33..45

    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 157.

    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 3 locations. Consider refactoring.
    Open

      onReply (status, router) {
        dispatch((_, getState) => {
          let state = getState();
    
          if (state.getIn(['compose', 'text']).trim().length !== 0) {
    Severity: Major
    Found in app/javascript/mastodon/containers/status_container.jsx and 2 other locations - About 6 hrs to fix
    app/javascript/mastodon/features/direct_timeline/containers/conversation_container.js on lines 39..56
    app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 59..75

    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 157.

    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 3 locations. Consider refactoring.
    Open

      reply (status, router) {
        dispatch((_, getState) => {
          let state = getState();
    
          if (state.getIn(['compose', 'text']).trim().length !== 0) {
    app/javascript/mastodon/containers/status_container.jsx on lines 80..96
    app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 59..75

    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 157.

    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 3 locations. Consider refactoring.
    Open

      onReply (status, router) {
        dispatch((_, getState) => {
          let state = getState();
          if (state.getIn(['compose', 'text']).trim().length !== 0) {
            dispatch(openModal({
    app/javascript/mastodon/containers/status_container.jsx on lines 80..96
    app/javascript/mastodon/features/direct_timeline/containers/conversation_container.js on lines 39..56

    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 157.

    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 3 locations. Consider refactoring.
    Open

      _selectChild (index, align_top) {
        const container = this.node.node;
        const element = container.querySelector(`article:nth-of-type(${index + 1}) .focusable`);
    
        if (element) {
    Severity: Major
    Found in app/javascript/mastodon/components/status_list.jsx and 2 other locations - About 6 hrs to fix
    app/javascript/mastodon/features/direct_timeline/components/conversations_list.jsx on lines 33..45
    app/javascript/mastodon/features/notifications/index.jsx on lines 169..181

    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 157.

    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 3 locations. Consider refactoring.
    Open

      _selectChild (index, align_top) {
        const container = this.node.node;
        const element = container.querySelector(`article:nth-of-type(${index + 1}) .focusable`);
    
        if (element) {
    app/javascript/mastodon/components/status_list.jsx on lines 67..79
    app/javascript/mastodon/features/notifications/index.jsx on lines 169..181

    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 157.

    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

    const messages = defineMessages({
      option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Choice {number}' },
      add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add a choice' },
      remove_option: { id: 'compose_form.poll.remove_option', defaultMessage: 'Remove this choice' },
      poll_duration: { id: 'compose_form.poll.duration', defaultMessage: 'Poll duration' },
    app/javascript/mastodon/components/account.jsx on lines 24..34
    app/javascript/mastodon/containers/status_container.jsx on lines 53..63
    app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 15..25
    app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36
    app/javascript/mastodon/features/notifications/components/notification.jsx on lines 22..32
    app/javascript/mastodon/features/video/index.jsx on lines 18..28

    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 156.

    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

    const messages = defineMessages({
      play: { id: 'video.play', defaultMessage: 'Play' },
      pause: { id: 'video.pause', defaultMessage: 'Pause' },
      mute: { id: 'video.mute', defaultMessage: 'Mute sound' },
      unmute: { id: 'video.unmute', defaultMessage: 'Unmute sound' },
    Severity: Major
    Found in app/javascript/mastodon/features/video/index.jsx and 6 other locations - About 6 hrs to fix
    app/javascript/mastodon/components/account.jsx on lines 24..34
    app/javascript/mastodon/containers/status_container.jsx on lines 53..63
    app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 15..25
    app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 15..25
    app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36
    app/javascript/mastodon/features/notifications/components/notification.jsx on lines 22..32

    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 156.

    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

    const messages = defineMessages({
      follow: { id: 'account.follow', defaultMessage: 'Follow' },
      unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
      cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Withdraw follow request' },
      unblock: { id: 'account.unblock_short', defaultMessage: 'Unblock' },
    Severity: Major
    Found in app/javascript/mastodon/components/account.jsx and 6 other locations - About 6 hrs to fix
    app/javascript/mastodon/containers/status_container.jsx on lines 53..63
    app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 15..25
    app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 15..25
    app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36
    app/javascript/mastodon/features/notifications/components/notification.jsx on lines 22..32
    app/javascript/mastodon/features/video/index.jsx on lines 18..28

    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 156.

    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

    const messages = defineMessages({
      public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
      public_long: { id: 'privacy.public.long', defaultMessage: 'Visible for all' },
      unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' },
      unlisted_long: { id: 'privacy.unlisted.long', defaultMessage: 'Visible for all, but opted-out of discovery features' },
    app/javascript/mastodon/components/account.jsx on lines 24..34
    app/javascript/mastodon/containers/status_container.jsx on lines 53..63
    app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 15..25
    app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36
    app/javascript/mastodon/features/notifications/components/notification.jsx on lines 22..32
    app/javascript/mastodon/features/video/index.jsx on lines 18..28

    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 156.

    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

    const messages = defineMessages({
      favourite: { id: 'notification.favourite', defaultMessage: '{name} favorited your status' },
      follow: { id: 'notification.follow', defaultMessage: '{name} followed you' },
      ownPoll: { id: 'notification.own_poll', defaultMessage: 'Your poll has ended' },
      poll: { id: 'notification.poll', defaultMessage: 'A poll you have voted in has ended' },
    app/javascript/mastodon/components/account.jsx on lines 24..34
    app/javascript/mastodon/containers/status_container.jsx on lines 53..63
    app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 15..25
    app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 15..25
    app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36
    app/javascript/mastodon/features/video/index.jsx on lines 18..28

    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 156.

    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

    const messages = defineMessages({
      deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
      deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
      redraftConfirm: { id: 'confirmations.redraft.confirm', defaultMessage: 'Delete & redraft' },
      redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this status and re-draft it? Favorites and boosts will be lost, and replies to the original post will be orphaned.' },
    Severity: Major
    Found in app/javascript/mastodon/containers/status_container.jsx and 6 other locations - About 6 hrs to fix
    app/javascript/mastodon/components/account.jsx on lines 24..34
    app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 15..25
    app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 15..25
    app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36
    app/javascript/mastodon/features/notifications/components/notification.jsx on lines 22..32
    app/javascript/mastodon/features/video/index.jsx on lines 18..28

    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 156.

    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

    const messages = defineMessages({
      unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
      follow: { id: 'account.follow', defaultMessage: 'Follow' },
      cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Withdraw follow request' },
      cancelFollowRequestConfirm: { id: 'confirmations.cancel_follow_request.confirm', defaultMessage: 'Withdraw request' },
    app/javascript/mastodon/components/account.jsx on lines 24..34
    app/javascript/mastodon/containers/status_container.jsx on lines 53..63
    app/javascript/mastodon/features/compose/components/poll_form.jsx on lines 15..25
    app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx on lines 15..25
    app/javascript/mastodon/features/notifications/components/notification.jsx on lines 22..32
    app/javascript/mastodon/features/video/index.jsx on lines 18..28

    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 156.

    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

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

      render () {
        const { intl, multiColumn } = this.props;
    
        return (
          <Column>
    Severity: Major
    Found in app/javascript/mastodon/features/keyboard_shortcuts/index.jsx - About 5 hrs to fix

      Function emojifyTextNode has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

      const emojifyTextNode = (node, customEmojis) => {
        const VS15 = 0xFE0E;
        const VS16 = 0xFE0F;
      
        let str = node.textContent;
      Severity: Minor
      Found in app/javascript/mastodon/features/emoji/emoji.js - About 5 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 purge has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          def purge(*domains)
            domains            = domains.map { |domain| TagManager.instance.normalize_domain(domain) }
            account_scope      = Account.none
            domain_block_scope = DomainBlock.none
            emoji_scope        = CustomEmoji.none
      Severity: Minor
      Found in lib/mastodon/cli/domains.rb - About 5 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 header.jsx has 411 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/mastodon/features/account/components/header.jsx - About 5 hrs to fix
        Severity
        Category
        Status
        Source
        Language