mashirozx/mastodon

View on GitHub

Showing 1,785 of 1,785 total issues

Function renderPoll has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderPoll (notification, account) {
    const { intl, unread } = this.props;
    const ownPoll  = me === account.get('id');
    const message  = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll);

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

      render () {
        const { alt, src, width, height, onClick } = this.props;
        const { loading } = this.state;
    
        const className = classNames('image-loader', {
    Severity: Minor
    Found in app/javascript/mastodon/features/ui/components/image_loader.js - About 1 hr to fix

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

        render () {
          const { intl, onClose } = this.props;
          const { oembed } = this.state;
      
          return (
      Severity: Minor
      Found in app/javascript/mastodon/features/ui/components/embed_modal.js - About 1 hr to fix

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

          render () {
            const { value, container, disabled, intl } = this.props;
            const { open, placement } = this.state;
        
            const valueOption = this.options.find(item => item.value === value);

          Method user_settings_params has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def user_settings_params
              params.require(:user).permit(
                :setting_default_privacy,
                :setting_default_sensitive,
                :setting_default_language,
          Severity: Minor
          Found in app/controllers/settings/preferences_controller.rb - About 1 hr to fix

            Method merge_statuses! has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def merge_statuses!(main_status, duplicate_status)
                  owned_classes = [Favourite, Mention, Poll]
                  owned_classes << Bookmark if ActiveRecord::Base.connection.table_exists?(:bookmarks)
                  owned_classes.each do |klass|
                    klass.where(status_id: duplicate_status.id).find_each do |record|
            Severity: Minor
            Found in lib/mastodon/maintenance_cli.rb - About 1 hr to fix

              Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def initialize(path, max_frames = 2)
                  @path      = path
                  @nb_frames = 0
              
                  File.open(path, 'rb') do |s|
              Severity: Minor
              Found in lib/paperclip/gif_transcoder.rb - About 1 hr to fix

                Method modify has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def modify(username)
                      user = Account.find_local(username)&.user
                
                      if user.nil?
                        say('No user with such username', :red)
                Severity: Minor
                Found in lib/mastodon/accounts_cli.rb - About 1 hr to fix

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

                      def import(path)
                        imported = 0
                        skipped  = 0
                        failed   = 0
                        category = options[:category] ? CustomEmojiCategory.find_or_create_by(name: options[:category]) : nil
                  Severity: Minor
                  Found in lib/mastodon/emoji_cli.rb - About 1 hr to fix

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

                        def refresh
                          dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
                    
                          if options[:status]
                            scope = MediaAttachment.where(status_id: options[:status])
                    Severity: Minor
                    Found in lib/mastodon/media_cli.rb - About 1 hr to fix

                      Function buildSearch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const buildSearch = (data) => {
                        const search = [];
                      
                        let addToSearch = (strings, split) => {
                          if (!strings) {
                      Severity: Minor
                      Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function showAlertForError has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function showAlertForError(error, skipNotFound = false) {
                        if (error.response) {
                          const { data, status, statusText, headers } = error.response;
                      
                          if (skipNotFound && (status === 404 || status === 410)) {
                      Severity: Minor
                      Found in app/javascript/mastodon/actions/alerts.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render () {
                          const { others, localDomain } = this.props;
                      
                          let displayName, suffix, account;
                      
                      
                      Severity: Minor
                      Found in app/javascript/mastodon/components/display_name.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render () {
                          const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
                      
                          if (!isAccount) {
                            return (
                      Severity: Minor
                      Found in app/javascript/mastodon/features/followers/index.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render () {
                          const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, blockedBy, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;
                      
                          if (!isAccount) {
                            return (
                      Severity: Minor
                      Found in app/javascript/mastodon/features/account_timeline/index.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render () {
                          const { hasUnread, columnId, multiColumn, tag, intl } = this.props;
                          const { id, local } = this.props.params;
                          const pinned = !!columnId;
                      
                      
                      Severity: Minor
                      Found in app/javascript/mastodon/features/hashtag_timeline/index.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render () {
                          const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
                      
                          if (!isAccount) {
                            return (
                      Severity: Minor
                      Found in app/javascript/mastodon/features/following/index.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Method fields_attributes= has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def fields_attributes=(attributes)
                          fields     = []
                          old_fields = self[:fields] || []
                          old_fields = [] if old_fields.is_a?(Hash)
                      
                      
                      Severity: Minor
                      Found in app/models/account.rb - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Method from_status has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def from_status(status, allow_inlining: true)
                            new.tap do |presenter|
                              presenter.id        = ActivityPub::TagManager.instance.activity_uri_for(status)
                              presenter.type      = status.reblog? ? 'Announce' : 'Create'
                              presenter.actor     = ActivityPub::TagManager.instance.uri_for(status.account)
                      Severity: Minor
                      Found in app/presenters/activitypub/activity_presenter.rb - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def create
                            authorize :email_domain_block, :create?
                      
                            @email_domain_block = EmailDomainBlock.new(resource_params)
                      
                      
                      Severity: Minor
                      Found in app/controllers/admin/email_domain_blocks_controller.rb - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language