glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

  render () {
    const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength, lang, spellCheck } = this.props;
    const { suggestionsHidden } = this.state;

    return (
Severity: Minor
Found in app/javascript/mastodon/components/autosuggest_input.jsx - About 1 hr to fix

    Method load_groups_data has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def load_groups_data(account_id, group_keys, pagination_range: nil)
          return {} if group_keys.empty?
    
          if pagination_range.present?
            binds = [
    Severity: Minor
    Found in app/models/notification_group.rb - About 1 hr to fix

      Function render has 36 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.jsx - About 1 hr to fix

        Method configuration has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def configuration
            {
              urls: {
                streaming: Rails.configuration.x.streaming_api_base_url,
                status: object.status_page_url,
        Severity: Minor
        Found in app/serializers/rest/instance_serializer.rb - About 1 hr to fix

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

            render () {
              const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other }  = this.props;
              const { isLoading, isPartial } = other;
          
              if (isPartial) {
          Severity: Minor
          Found in app/javascript/flavours/glitch/components/status_list.jsx - 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 isLinkMisleading has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const isLinkMisleading = (link) => {
            let linkTextParts = [];
          
            // Reconstruct visible text, as we do not have much control over how links
            // from remote software look, and we can't rely on `innerText` because the
          Severity: Minor
          Found in app/javascript/flavours/glitch/components/status_content.jsx - 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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            render () {
              let ancestors, descendants, remoteHint;
              const { isLoading, status, settings, ancestorsIds, descendantsIds, intl, domain, multiColumn, pictureInPicture } = this.props;
              const { fullscreen } = this.state;
          
          
          Severity: Minor
          Found in app/javascript/flavours/glitch/features/status/index.jsx - 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 unicodeToFilename has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.unicodeToFilename = (str) => {
            let result = '';
            let charCode = 0;
            let p = 0;
            let i = 0;

          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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            render () {
              const { intl, notifications, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId, canMarkAsRead, needsNotificationPermission } = this.props;
              const { notifCleaningActive } = this.props;
              const { animatingNCD } = this.state;
              const pinned = !!columnId;
          Severity: Minor
          Found in app/javascript/flavours/glitch/features/notifications/index.jsx - 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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            render () {
              const { statusIds, featuredStatusIds, onLoadMore, timelineId, ...other }  = this.props;
              const { isLoading, isPartial } = other;
          
              if (isPartial) {
          Severity: Minor
          Found in app/javascript/mastodon/components/status_list.jsx - 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 unicodeToFilename has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.unicodeToFilename = (str) => {
            let result = '';
            let charCode = 0;
            let p = 0;
            let i = 0;
          Severity: Minor
          Found in app/javascript/mastodon/features/emoji/unicode_to_filename.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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            render () {
              const { children, singleColumn } = this.props;
              const { signedIn } = this.props.identity;
              const pathName = this.props.location.pathname;
          
          
          Severity: Minor
          Found in app/javascript/mastodon/features/ui/index.jsx - 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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            render () {
              const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props;
          
              if (!isAccount) {
                return (
          Severity: Minor
          Found in app/javascript/mastodon/features/followers/index.jsx - 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 invalidate_last_inspected has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def invalidate_last_inspected(status, action)
              last_value = last_inspected
              return if last_value.nil? || status.id > last_value || status.account_id != account_id
          
              case action
          Severity: Minor
          Found in app/models/account_statuses_cleanup_policy.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

          Function notifications has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function notifications(state = initialState, action) {
            switch(action.type) {
            case fetchMarkers.fulfilled.type:
              return action.payload.markers.notifications ? recountUnread(state, action.payload.markers.notifications.last_read_id) : state;
            case NOTIFICATIONS_MOUNT:
          Severity: Minor
          Found in app/javascript/mastodon/reducers/notifications.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 _insert_record has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def _insert_record(values, returning)
                return super unless values.is_a?(Hash) && values['reblog_of_id']&.value.present?
          
                primary_key = self.primary_key
                primary_key_value = nil
          Severity: Minor
          Found in app/models/concerns/status/safe_reblog_insert.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

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

            render () {
              const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props;
          
              if (!isAccount) {
                return (
          Severity: Minor
          Found in app/javascript/mastodon/features/following/index.jsx - 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 check_webfinger! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def check_webfinger!
              webfinger                            = webfinger!("acct:#{@username}@#{@domain}")
              confirmed_username, confirmed_domain = split_acct(webfinger.subject)
          
              if @username.casecmp(confirmed_username).zero? && @domain.casecmp(confirmed_domain).zero?
          Severity: Minor
          Found in app/services/activitypub/fetch_remote_actor_service.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 download_media_files! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def download_media_files!
              @next_media_attachments.each do |media_attachment|
                next if media_attachment.skip_download
          
                media_attachment.download_file! if media_attachment.remote_url_previously_changed?
          Severity: Minor
          Found in app/services/activitypub/process_status_update_service.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 render_with_cache has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def render_with_cache(**options)
              raise ArgumentError, 'Only JSON render calls are supported' unless options.key?(:json) || block_given?
          
              key        = options.delete(:key) || [[params[:controller], params[:action]].join('/'), options[:json].respond_to?(:cache_key) ? options[:json].cache_key : nil, options[:fields].nil? ? nil : options[:fields].join(',')].compact.join(':')
              expires_in = options.delete(:expires_in) || 3.minutes
          Severity: Minor
          Found in app/controllers/concerns/cache_concern.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