mashirozx/mastodon

View on GitHub

Showing 1,785 of 1,785 total issues

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

  render () {
    const { status, intl, withOpenButton } = this.props;

    if (status === null) return null

    Method process_remote_attachments has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def process_remote_attachments
        # IMAGE: [https://s3.mashiro.top/view/2022/02/24/6f3f209aa55e3083f0659ecb62448fc0.jpg]
        image_array = @text.scan(/IMAGE:\s*\[\s*((?:https|http):\/\/.+?)\s*\](?:\s*\{\s*((?:https|http):\/\/.+?)\s*\})*/)
        video_array = @text.scan(/VIDEO:\s*\[\s*((?:https|http):\/\/.+?)\s*\](?:\s*\{\s*((?:https|http):\/\/.+?)\s*\})*/)
    
    
    Severity: Minor
    Found in app/services/post_status_service.rb - About 1 hr to fix

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

          if (multiColumn || placeholder) {
            return component;
          } else {
            // The portal container and the component may be rendered to the DOM in
            // the same React render pass, so the container might not be available at
      Severity: Major
      Found in app/javascript/mastodon/components/column_header.js and 1 other location - About 1 hr to fix
      app/javascript/mastodon/components/column_back_button.js on lines 35..51

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

      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

          if (multiColumn) {
            return component;
          } else {
            // The portal container and the component may be rendered to the DOM in
            // the same React render pass, so the container might not be available at
      Severity: Major
      Found in app/javascript/mastodon/components/column_back_button.js and 1 other location - About 1 hr to fix
      app/javascript/mastodon/components/column_header.js on lines 196..212

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

      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

        <NavLink className='tabs-bar__link' to='/home' data-preview-title-id='column.home' data-preview-icon='home' ><Icon id='home' fixedWidth /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink>,
      Severity: Major
      Found in app/javascript/mastodon/features/ui/components/tabs_bar.js and 2 other locations - About 1 hr to fix
      app/javascript/mastodon/features/ui/components/tabs_bar.js on lines 13..13
      app/javascript/mastodon/features/ui/components/tabs_bar.js on lines 15..15

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

      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

        <NavLink className='tabs-bar__link optional' to='/explore' data-preview-title-id='tabs_bar.search' data-preview-icon='search' ><Icon id='search' fixedWidth /><FormattedMessage id='tabs_bar.search' defaultMessage='Search' /></NavLink>,
      Severity: Major
      Found in app/javascript/mastodon/features/ui/components/tabs_bar.js and 2 other locations - About 1 hr to fix
      app/javascript/mastodon/features/ui/components/tabs_bar.js on lines 11..11
      app/javascript/mastodon/features/ui/components/tabs_bar.js on lines 13..13

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

      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

        <NavLink className='tabs-bar__link' to='/public/local' data-preview-title-id='column.community' data-preview-icon='users' ><Icon id='users' fixedWidth /><FormattedMessage id='tabs_bar.local_timeline' defaultMessage='Local' /></NavLink>,
      Severity: Major
      Found in app/javascript/mastodon/features/ui/components/tabs_bar.js and 2 other locations - About 1 hr to fix
      app/javascript/mastodon/features/ui/components/tabs_bar.js on lines 11..11
      app/javascript/mastodon/features/ui/components/tabs_bar.js on lines 15..15

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

      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

        api(getState).get('/api/v1/directory', { params: { ...params, limit: 20 } }).then(({ data }) => {
          dispatch(importFetchedAccounts(data));
          dispatch(fetchDirectorySuccess(data));
          dispatch(fetchRelationships(data.map(x => x.id)));
        }).catch(error => dispatch(fetchDirectoryFail(error)));
      Severity: Major
      Found in app/javascript/mastodon/actions/directory.js and 1 other location - About 1 hr to fix
      app/javascript/mastodon/actions/directory.js on lines 42..46

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

      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

        api(getState).get('/api/v1/directory', { params: { ...params, offset: loadedItems, limit: 20 } }).then(({ data }) => {
          dispatch(importFetchedAccounts(data));
          dispatch(expandDirectorySuccess(data));
          dispatch(fetchRelationships(data.map(x => x.id)));
        }).catch(error => dispatch(expandDirectoryFail(error)));
      Severity: Major
      Found in app/javascript/mastodon/actions/directory.js and 1 other location - About 1 hr to fix
      app/javascript/mastodon/actions/directory.js on lines 16..20

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

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

      export const synchronouslySubmitMarkers = () => (dispatch, getState) => {
        const accessToken = getState().getIn(['meta', 'access_token'], '');
        const params      = _buildParams(getState());
      
        if (Object.keys(params).length === 0) {
      Severity: Minor
      Found in app/javascript/mastodon/actions/markers.js - About 1 hr to fix

        Function stringFromCodePoint has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const stringFromCodePoint = _String.fromCodePoint || function () {
          let MAX_SIZE = 0x4000;
          let codeUnits = [];
          let highSurrogate;
          let lowSurrogate;
        Severity: Minor
        Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 1 hr to fix

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

            render () {
              const { limit } = this.props;
              const { loading, data } = this.state;
          
              let content;
          Severity: Minor
          Found in app/javascript/mastodon/components/admin/Trends.js - About 1 hr to fix

            Function searchValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const searchValue = (value) => {
                  let aPool = pool,
                    aIndex = index,
                    length = 0;
            
            
            Severity: Minor
            Found in app/javascript/mastodon/features/emoji/emoji_mart_search_light.js - About 1 hr to fix

              Function getTicks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getTicks (count, size, radius, scaleCoefficient) {
                  const ticks = this.getTickPoints(count);
                  const lesser = 200;
                  const m = [];
                  const bufferLength = this.analyser ? this.analyser.frequencyBinCount : 0;
              Severity: Minor
              Found in app/javascript/mastodon/features/audio/visualizer.js - About 1 hr to fix

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

                  render () {
                    const { category, startedFrom, rules, intl } = this.props;
                
                    const options = rules.size > 0 ? [
                      'dislike',
                Severity: Minor
                Found in app/javascript/mastodon/features/report/category.js - About 1 hr to fix

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

                    render () {
                      const { account, hidden, hideTabs } = this.props;
                  
                      if (account === null) {
                        return null;

                    Method make has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def make
                          metadata = VideoMetadataExtractor.new(@file.path)
                    
                          unless metadata.valid?
                            Paperclip.log("Unsupported file #{@file.path}")
                    Severity: Minor
                    Found in lib/paperclip/transcoder.rb - About 1 hr to fix

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

                          def add(*domains)
                            if domains.empty?
                              say('No domain(s) given', :red)
                              exit(1)
                            end
                      Severity: Minor
                      Found in lib/mastodon/email_domain_blocks_cli.rb - About 1 hr to fix

                        Method remove_orphans_conversations has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def remove_orphans_conversations
                              start_at = Time.now.to_f
                        
                              unless options[:continue] && ActiveRecord::Base.connection.table_exists?('conversations_to_be_deleted')
                                say('Creating temporary database indices...')
                        Severity: Minor
                        Found in lib/mastodon/statuses_cli.rb - About 1 hr to fix

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

                            var ready = function(loaded) {
                              if (['interactive', 'complete'].indexOf(document.readyState) !== -1) {
                                loaded();
                              } else {
                                document.addEventListener('DOMContentLoaded', loaded);
                          Severity: Major
                          Found in public/embed.js and 1 other location - About 1 hr to fix
                          public/plugins/snow.js on lines 4..10

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

                          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