glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

Method rewrite_follows! has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rewrite_follows!
    num_moved = 0

    # First, approve pending follow requests for the new account,
    # this allows correctly processing list memberships with pending
Severity: Minor
Found in app/workers/move_worker.rb - About 1 hr to fix

    Method to_s has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def to_s
        return html if custom_emojis.empty? || html.blank?
    
        tree = Nokogiri::HTML5.fragment(html)
        tree.xpath('./text()|.//text()[not(ancestor[@class="invisible"])]').to_a.each do |node|
    Severity: Minor
    Found in app/lib/emoji_formatter.rb - About 1 hr to fix

      Method meta has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def meta
          store = default_meta_store
      
          if object.current_account
            store[:me]                = object.current_account.id.to_s
      Severity: Minor
      Found in app/serializers/initial_state_serializer.rb - About 1 hr to fix

        Method default_filter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def default_filter
              {
                bool: {
                  should: [
                    {
        Severity: Minor
        Found in app/lib/search_query_transformer.rb - About 1 hr to fix

          Method refresh has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def refresh(*usernames)
                if options[:domain] || options[:all]
                  scope  = Account.remote
                  scope  = scope.where(domain: options[:domain]) if options[:domain]
          
          
          Severity: Minor
          Found in lib/mastodon/cli/accounts.rb - About 1 hr to fix

            Method add has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def add(*addresses)
                  fail_with_message 'No IP(s) given' if addresses.empty?
            
                  skipped   = 0
                  processed = 0
            Severity: Minor
            Found in lib/mastodon/cli/ip_blocks.rb - About 1 hr to fix

              Method deduplicate_local_accounts! has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def deduplicate_local_accounts!(scope)
                    accounts = scope.order(id: :desc).includes(:account_stat, :user).to_a
              
                    say "Multiple local accounts were found for username '#{accounts.first.username}'.", :yellow
                    say 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.', :yellow
              Severity: Minor
              Found in lib/mastodon/cli/maintenance.rb - About 1 hr to fix

                Function onChangeRegistrationMode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const onChangeRegistrationMode = (target: HTMLSelectElement) => {
                  const enabled = target.value === 'approved';
                
                  document
                    .querySelectorAll<HTMLElement>(
                Severity: Minor
                Found in app/javascript/flavours/glitch/entrypoints/admin.tsx - About 1 hr to fix

                  Function onChangeRegistrationMode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const onChangeRegistrationMode = (target: HTMLSelectElement) => {
                    const enabled = target.value === 'approved';
                  
                    document
                      .querySelectorAll<HTMLElement>(
                  Severity: Minor
                  Found in app/javascript/entrypoints/admin.tsx - About 1 hr to fix

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

                      handleHotkeyOpenProfile = () => {
                        this.props.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
                      };
                    Severity: Major
                    Found in app/javascript/flavours/glitch/features/status/index.jsx and 2 other locations - About 1 hr to fix
                    app/javascript/flavours/glitch/components/status.jsx on lines 470..472
                    app/javascript/mastodon/features/status/index.jsx on lines 465..467

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

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

                      handleHotkeyOpenProfile = () => {
                        this.props.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
                      };
                    Severity: Major
                    Found in app/javascript/flavours/glitch/components/status.jsx and 2 other locations - About 1 hr to fix
                    app/javascript/flavours/glitch/features/status/index.jsx on lines 484..486
                    app/javascript/mastodon/features/status/index.jsx on lines 465..467

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

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

                      handleHotkeyOpenProfile = () => {
                        this.props.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
                      };
                    Severity: Major
                    Found in app/javascript/mastodon/features/status/index.jsx and 2 other locations - About 1 hr to fix
                    app/javascript/flavours/glitch/components/status.jsx on lines 470..472
                    app/javascript/flavours/glitch/features/status/index.jsx on lines 484..486

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

                    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

                    export const expandLinkTimeline            = (url, { maxId } = {}) => expandTimeline(`link:${url}`, `/api/v1/timelines/link`, { url, max_id: maxId });
                    Severity: Major
                    Found in app/javascript/flavours/glitch/actions/timelines.js and 1 other location - About 1 hr to fix
                    app/javascript/mastodon/actions/timelines.js on lines 155..155

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

                    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

                    const mapDispatchToProps = (dispatch, { id }) => ({
                      onAuthorize () {
                        dispatch(authorizeFollowRequest(id));
                      },
                    
                    
                    app/javascript/flavours/glitch/features/follow_requests/containers/account_authorize_container.js on lines 17..25
                    app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js on lines 18..26
                    app/javascript/mastodon/features/notifications/containers/follow_request_container.js on lines 18..26

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

                    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

                    const removeSubscription = subscription => {
                      const index = subscriptions.indexOf(subscription);
                    
                      if (index !== -1) {
                        subscriptions.splice(index, 1);
                    Severity: Major
                    Found in app/javascript/mastodon/stream.js and 1 other location - About 1 hr to fix
                    app/javascript/flavours/glitch/stream.js on lines 47..53

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

                    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

                            <EmbeddedStatusContent
                              className='reply-indicator__content translate'
                              content={status.get('contentHtml')}
                              language={status.get('language')}
                              mentions={status.get('mentions')}
                    app/javascript/flavours/glitch/features/compose/components/edit_indicator.jsx on lines 50..55
                    app/javascript/mastodon/features/compose/components/edit_indicator.jsx on lines 51..56
                    app/javascript/mastodon/features/compose/components/reply_indicator.jsx on lines 36..41

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

                    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

                    const mapDispatchToProps = (dispatch, { id }) => ({
                      onAuthorize () {
                        dispatch(authorizeFollowRequest(id));
                      },
                    
                    
                    app/javascript/flavours/glitch/features/follow_requests/containers/account_authorize_container.js on lines 17..25
                    app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js on lines 18..26
                    app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js on lines 17..25

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

                    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

                    export const makeGetNotification = () => createSelector([
                      (_, base)             => base,
                      (state, _, accountId) => state.getIn(['accounts', accountId]),
                    ], (base, account) => base.set('account', account));
                    Severity: Major
                    Found in app/javascript/mastodon/selectors/index.js and 3 other locations - About 1 hr to fix
                    app/javascript/flavours/glitch/selectors/index.js on lines 96..99
                    app/javascript/flavours/glitch/selectors/index.js on lines 101..104
                    app/javascript/mastodon/selectors/index.js on lines 100..103

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

                    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

                    export const makeGetReport = () => createSelector([
                      (_, base) => base,
                      (state, _, targetAccountId) => state.getIn(['accounts', targetAccountId]),
                    ], (base, targetAccount) => base.set('target_account', targetAccount));
                    Severity: Major
                    Found in app/javascript/mastodon/selectors/index.js and 3 other locations - About 1 hr to fix
                    app/javascript/flavours/glitch/selectors/index.js on lines 96..99
                    app/javascript/flavours/glitch/selectors/index.js on lines 101..104
                    app/javascript/mastodon/selectors/index.js on lines 95..98

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

                    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={classNames('account__header', { inactive: !!account.get('moved') })} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
                            {!(suspended || hidden || account.get('moved')) && account.getIn(['relationship', 'requested_by']) && <FollowRequestNoteContainer account={account} />}
                    
                            <div className='account__header__image'>
                              <div className='account__header__info'>
                    app/javascript/flavours/glitch/features/account/components/header.jsx on lines 334..409

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language