mashirozx/mastodon

View on GitHub

Showing 1,785 of 1,785 total issues

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

  render () {
    const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props;
    const { suggestionsHidden } = this.state;

    return [
Severity: Minor
Found in app/javascript/mastodon/components/autosuggest_textarea.js - About 1 hr to fix

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

      render () {
        const { announcements, intl } = this.props;
        const { index } = this.state;
    
        if (announcements.isEmpty()) {

      Function settings has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function settings(state = initialState, action) {
        switch(action.type) {
        case STORE_HYDRATE:
          return hydrate(state, action.state.get('settings'));
        case NOTIFICATIONS_FILTER_SET:
      Severity: Minor
      Found in app/javascript/mastodon/reducers/settings.js - About 1 hr to fix

        Method attempt_oembed has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def attempt_oembed
            service         = FetchOEmbedService.new
            url_domain      = Addressable::URI.parse(@url).normalized_host
            cached_endpoint = Rails.cache.read("oembed_endpoint:#{url_domain}")
        
        
        Severity: Minor
        Found in app/services/fetch_link_card_service.rb - About 1 hr to fix

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

            case BOOKMARK_FAIL:
              return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], false);
          Severity: Major
          Found in app/javascript/mastodon/reducers/statuses.js and 3 other locations - About 1 hr to fix
          app/javascript/mastodon/reducers/statuses.js on lines 49..50
          app/javascript/mastodon/reducers/statuses.js on lines 51..52
          app/javascript/mastodon/reducers/statuses.js on lines 57..58

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

          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

                  <div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}>
                    {suggestions.map(this.renderSuggestion)}
                  </div>
          Severity: Major
          Found in app/javascript/mastodon/components/autosuggest_textarea.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/components/autosuggest_input.js on lines 216..218

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

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

            case REBLOG_FAIL:
              return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false);
          Severity: Major
          Found in app/javascript/mastodon/reducers/statuses.js and 3 other locations - About 1 hr to fix
          app/javascript/mastodon/reducers/statuses.js on lines 49..50
          app/javascript/mastodon/reducers/statuses.js on lines 51..52
          app/javascript/mastodon/reducers/statuses.js on lines 53..54

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

          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

            onMute (account) {
              if (account.getIn(['relationship', 'muting'])) {
                dispatch(unmuteAccount(account.get('id')));
              } else {
                dispatch(initMuteModal(account));
          app/javascript/mastodon/containers/account_container.js on lines 58..64
          app/javascript/mastodon/features/account_timeline/containers/header_container.js on lines 60..66

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

          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

            onBlock (account) {
              if (account.getIn(['relationship', 'blocking'])) {
                dispatch(unblockAccount(account.get('id')));
              } else {
                dispatch(initBlockModal(account));
          app/javascript/mastodon/containers/account_container.js on lines 58..64
          app/javascript/mastodon/features/account_timeline/containers/header_container.js on lines 104..110

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

          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

                  <div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}>
                    {suggestions.map(this.renderSuggestion)}
                  </div>
          Severity: Major
          Found in app/javascript/mastodon/components/autosuggest_input.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/components/autosuggest_textarea.js on lines 226..228

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

          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

            handleOpenVideo = (options) => {
              const status = this._properStatus();
              this.props.onOpenVideo(status.get('id'), status.getIn(['media_attachments', 0]), options);
            }
          Severity: Major
          Found in app/javascript/mastodon/components/status.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/components/status.js on lines 234..237

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

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

            case FAVOURITE_FAIL:
              return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false);
          Severity: Major
          Found in app/javascript/mastodon/reducers/statuses.js and 3 other locations - About 1 hr to fix
          app/javascript/mastodon/reducers/statuses.js on lines 51..52
          app/javascript/mastodon/reducers/statuses.js on lines 53..54
          app/javascript/mastodon/reducers/statuses.js on lines 57..58

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

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

            case BOOKMARK_REQUEST:
              return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], true);
          Severity: Major
          Found in app/javascript/mastodon/reducers/statuses.js and 3 other locations - About 1 hr to fix
          app/javascript/mastodon/reducers/statuses.js on lines 49..50
          app/javascript/mastodon/reducers/statuses.js on lines 53..54
          app/javascript/mastodon/reducers/statuses.js on lines 57..58

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

          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

            onMute (account) {
              if (account.getIn(['relationship', 'muting'])) {
                dispatch(unmuteAccount(account.get('id')));
              } else {
                dispatch(initMuteModal(account));
          Severity: Major
          Found in app/javascript/mastodon/containers/account_container.js and 2 other locations - About 1 hr to fix
          app/javascript/mastodon/features/account_timeline/containers/header_container.js on lines 60..66
          app/javascript/mastodon/features/account_timeline/containers/header_container.js on lines 104..110

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

          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

                  <div className={classNames('privacy-dropdown__value', { active: this.options.indexOf(valueOption) === (placement === 'bottom' ? 0 : (this.options.length - 1)) })}>
                    <IconButton
                      className='privacy-dropdown__value-icon'
                      icon={valueOption.icon}
                      title={intl.formatMessage(messages.change_content_type)}
          app/javascript/mastodon/features/compose/components/privacy_dropdown.js on lines 258..273

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

          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

            handleOpenVideoQuote = (options) => {
              const status = this._properQuoteStatus();
              this.props.onOpenVideo(status.get('id'), status.getIn(['media_attachments', 0]), options);
            }
          Severity: Major
          Found in app/javascript/mastodon/components/status.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/components/status.js on lines 229..232

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

          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

                  <div className={classNames('privacy-dropdown__value', { active: this.options.indexOf(valueOption) === (placement === 'bottom' ? 0 : (this.options.length - 1)) })}>
                    <IconButton
                      className='privacy-dropdown__value-icon'
                      icon={valueOption.icon}
                      title={intl.formatMessage(messages.change_privacy)}
          app/javascript/mastodon/features/compose/components/content_type_dropdown.js on lines 243..257

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

          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

              def deduplicate_unavailable_domains!
                return unless ActiveRecord::Base.connection.table_exists?(:unavailable_domains)
          
                remove_index_if_exists!(:unavailable_domains, 'index_unavailable_domains_on_domain')
          
          
          Severity: Major
          Found in lib/mastodon/maintenance_cli.rb and 1 other location - About 1 hr to fix
          lib/mastodon/maintenance_cli.rb on lines 520..532

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

          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

              def deduplicate_webauthn_credentials!
                return unless ActiveRecord::Base.connection.table_exists?(:webauthn_credentials)
          
                remove_index_if_exists!(:webauthn_credentials, 'index_webauthn_credentials_on_external_id')
          
          
          Severity: Major
          Found in lib/mastodon/maintenance_cli.rb and 1 other location - About 1 hr to fix
          lib/mastodon/maintenance_cli.rb on lines 422..434

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

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

          const checkCanvasReliability = () => new Promise((resolve, reject) => {
            switch(_browser_quirks['canvas-read-unreliable']) {
            case true:
              reject('Canvas reading unreliable');
              break;
          Severity: Minor
          Found in app/javascript/mastodon/utils/resize_image.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language