mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

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

      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

        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);

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

                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 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 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 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 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 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 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 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 { 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

                            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 { 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 { 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

                            Severity
                            Category
                            Status
                            Source
                            Language