glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

export const apiReblog = (statusId: string, visibility: StatusVisibility) =>
  apiRequestPost<{ reblog: Status }>(`v1/statuses/${statusId}/reblog`, {
    visibility,
  });
Severity: Major
Found in app/javascript/mastodon/api/interactions.ts and 1 other location - About 1 hr to fix
app/javascript/flavours/glitch/api/interactions.ts on lines 4..7

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

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

      statusIds.map((statusId, index) => {
        switch(statusId) {
        case TIMELINE_SUGGESTIONS:
          return (
            <InlineFollowSuggestions
Severity: Minor
Found in app/javascript/flavours/glitch/components/status_list.jsx - About 1 hr to fix

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

      render() {
        const { hasError, copied, errorMessage } = this.state;
    
        if (!hasError) {
          return this.props.children;
    Severity: Minor
    Found in app/javascript/flavours/glitch/components/error_boundary.jsx - About 1 hr to fix

      Function componentDidMount has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        componentDidMount () {
          const { node } = this;
          const {
            status,
            settings,
      Severity: Minor
      Found in app/javascript/flavours/glitch/components/status.jsx - About 1 hr to fix

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

          render() {
            const { hasError, copied, errorMessage } = this.state;
        
            if (!hasError) {
              return this.props.children;
        Severity: Minor
        Found in app/javascript/mastodon/components/error_boundary.jsx - About 1 hr to fix

          Function listEditorReducer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function listEditorReducer(state = initialState, action) {
            switch(action.type) {
            case PINNED_ACCOUNTS_EDITOR_RESET:
              return initialState;
            case PINNED_ACCOUNTS_FETCH_REQUEST:
          Severity: Minor
          Found in app/javascript/flavours/glitch/reducers/pinned_accounts_editor.js - About 1 hr to fix

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

              render () {
                const { intl, lists, multiColumn } = this.props;
            
                if (!lists) {
                  return (
            Severity: Minor
            Found in app/javascript/mastodon/features/lists/index.jsx - About 1 hr to fix

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

                render () {
                  const { status, checked } = this.props;
              
                  if (status.get('reblog')) {
                    return null;

                Method privatize_media_attachments! has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def privatize_media_attachments!
                    attachment_names = MediaAttachment.attachment_definitions.keys
                
                    @account.media_attachments.find_each do |media_attachment|
                      attachment_names.each do |attachment_name|
                Severity: Minor
                Found in app/services/suspend_account_service.rb - About 1 hr to fix

                  Method import has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def import
                        authorize :domain_block, :create?
                  
                        @import = Admin::Import.new(import_params)
                        return render :new unless @import.validate
                  Severity: Minor
                  Found in app/controllers/admin/export_domain_blocks_controller.rb - About 1 hr to fix

                    Method signed_request_actor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def signed_request_actor
                        return @signed_request_actor if defined?(@signed_request_actor)
                    
                        raise SignatureVerificationError, 'Request not signed' unless signed_request?
                        raise SignatureVerificationError, 'Incompatible request signature. keyId and signature are required' if missing_required_signature_parameters?
                    Severity: Minor
                    Found in app/controllers/concerns/signature_verification.rb - About 1 hr to fix

                      Method publish_media_attachments! has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def publish_media_attachments!
                          attachment_names = MediaAttachment.attachment_definitions.keys
                      
                          @account.media_attachments.find_each do |media_attachment|
                            attachment_names.each do |attachment_name|
                      Severity: Minor
                      Found in app/services/unsuspend_account_service.rb - About 1 hr to fix

                        Method message has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def message
                            if running_version.blank?
                              Admin::SystemCheck::Message.new(:elasticsearch_running_check)
                            elsif !compatible_version?
                              Admin::SystemCheck::Message.new(
                        Severity: Minor
                        Found in app/lib/admin/system_check/elasticsearch_check.rb - About 1 hr to fix

                          Method rename_column_concurrently has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def rename_column_concurrently(table, old, new, type: nil)
                                if transaction_open?
                                  raise 'rename_column_concurrently can not be run inside a transaction'
                                end
                          
                          
                          Severity: Minor
                          Found in lib/mastodon/migration_helpers.rb - About 1 hr to fix

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

                                def make
                                  return File.open(@file.path) unless needs_convert?
                            
                                  dst = TempfileFactory.new.generate([@basename, @format ? ".#{@format}" : @current_format].join)
                            
                            
                            Severity: Minor
                            Found in lib/paperclip/vips_lazy_thumbnail.rb - About 1 hr to fix

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

                                      <LocalSettingsPageItem
                                        settings={settings}
                                        item={['inline_preview_cards']}
                                        id='mastodon-settings--inline-preview-cards'
                                        onChange={onChange}
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 49..56
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 66..73
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 178..185
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 186..193
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 203..210
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 211..218
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 219..226
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 227..234

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

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

                                      <LocalSettingsPageItem
                                        settings={settings}
                                        item={['show_content_type_choice']}
                                        id='mastodon-settings--show_content_type_choice'
                                        onChange={onChange}
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 49..56
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 66..73
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 178..185
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 186..193
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 203..210
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 211..218
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 227..234
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 462..469

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

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

                                      <LocalSettingsPageItem
                                        settings={settings}
                                        item={['confirm_before_clearing_draft']}
                                        id='mastodon-settings--confirm_before_clearing_draft'
                                        onChange={onChange}
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 49..56
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 66..73
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 178..185
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 186..193
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 203..210
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 219..226
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 227..234
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 462..469

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

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

                                      <LocalSettingsPageItem
                                        settings={settings}
                                        item={['show_published_toast']}
                                        id='mastodon-settings--show_published_toast'
                                        onChange={onChange}
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 49..56
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 66..73
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 178..185
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 186..193
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 203..210
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 211..218
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 219..226
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 462..469

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

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

                                      <LocalSettingsPageItem
                                        settings={settings}
                                        item={['show_reply_count']}
                                        id='mastodon-settings--reply-count'
                                        onChange={onChange}
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 66..73
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 178..185
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 186..193
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 203..210
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 211..218
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 219..226
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 227..234
                              app/javascript/flavours/glitch/features/local_settings/page/index.jsx on lines 462..469

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

                              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