mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

Class Activity has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class ActivityPub::Activity
  include JsonLdHelper
  include Redisable
  include Lockable

Severity: Minor
Found in app/lib/activitypub/activity.rb - About 2 hrs to fix

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

      render () {
        const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction } = this.props;
    
        if (!account) {
          return <div />;
    Severity: Major
    Found in app/javascript/mastodon/components/account.js - About 2 hrs to fix

      Function makeMapStateToProps has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const makeMapStateToProps = () => {
        const getStatus = makeGetStatus();
        const getPictureInPicture = makeGetPictureInPicture();
      
        const getAncestorsIds = createSelector([
      Severity: Major
      Found in app/javascript/mastodon/features/status/index.js - About 2 hrs to fix

        Function translationEndpointCallback has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        const translationEndpointCallback = async (request, response) => {
          const body = request.body;
        
          const { content, to, status, edit } = body;
        
        
        Severity: Minor
        Found in translation/index.js - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
        Open

          render () {
            const { selectedFilter, advancedMode, intl } = this.props;
            const renderedElement = !advancedMode ? (
              <div className='notification__filter-bar'>
                <button

        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 build_signed_string has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def build_signed_string
            signed_headers.map do |signed_header|
              if signed_header == Request::REQUEST_TARGET
                "#{Request::REQUEST_TARGET}: #{request.method.downcase} #{request.path}"
              elsif signed_header == '(created)'
        Severity: Minor
        Found in app/controllers/concerns/signature_verification.rb - About 2 hrs 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 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render () {
            const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props;
            const { fullscreen } = this.state;
            const childrenCount = React.Children.count(children);
        
        
        Severity: Major
        Found in app/javascript/mastodon/components/scrollable_list.js - About 2 hrs to fix

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

            render () {
              const { hasUnread, columnId, multiColumn, list, intl } = this.props;
              const { id } = this.props.params;
              const pinned = !!columnId;
              const title  = list ? list.get('title') : id;
          Severity: Major
          Found in app/javascript/mastodon/features/list_timeline/index.js - About 2 hrs to fix

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

              render () {
                const { filter, contextType } = this.props;
            
                let expiredMessage = null;
                if (filter.get('expires_at') && filter.get('expires_at') < new Date()) {
            Severity: Major
            Found in app/javascript/mastodon/features/filters/added_to_filter.js - About 2 hrs to fix

              Class ProcessStatusUpdateService has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ActivityPub::ProcessStatusUpdateService < BaseService
                include JsonLdHelper
                include Redisable
                include Lockable
              
              
              Severity: Minor
              Found in app/services/activitypub/process_status_update_service.rb - About 2 hrs to fix

                Function exports has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = (api) => {
                  const env = api.env();
                
                  const reactOptions = {
                    development: false,
                Severity: Major
                Found in babel.config.js - About 2 hrs to fix

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

                    render () {
                      const { media, intl, sensitive, height, defaultWidth, standalone, autoplay, quote } = this.props;
                      const { visible } = this.state;
                  
                      const size     = media.take(9).size;
                  Severity: Minor
                  Found in app/javascript/mastodon/components/media_gallery.js - About 2 hrs 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 cached_filters_for has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.cached_filters_for(account_id)
                      active_filters = Rails.cache.fetch("filters:v3:#{account_id}") do
                        filters_hash = {}
                  
                        scope = CustomFilterKeyword.includes(:custom_filter).where(custom_filter: { account_id: account_id }).where(Arel.sql('expires_at IS NULL OR expires_at > NOW()'))
                  Severity: Minor
                  Found in app/models/custom_filter.rb - About 2 hrs 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 attempt_oembed has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def call(body, account, **options)
                      @account = account
                      @json    = original_json = Oj.load(body, mode: :strict)
                      @options = options
                  
                  
                  Severity: Minor
                  Found in app/services/activitypub/process_collection_service.rb - About 2 hrs 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 renderOption has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    renderOption (option, optionIndex, showResults) {
                      const { poll, disabled, intl } = this.props;
                      const pollVotesCount  = poll.get('voters_count') || poll.get('votes_count');
                      const percent         = pollVotesCount === 0 ? 0 : (option.get('votes_count') / pollVotesCount) * 100;
                      const leading         = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') >= other.get('votes_count'));
                  Severity: Major
                  Found in app/javascript/mastodon/components/poll.js - About 2 hrs to fix

                    Function emojify has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const emojify = (str, customEmojis = {}) => {
                      const tagCharsWithoutEmojis = '<&';
                      const tagCharsWithEmojis = Object.keys(customEmojis).length ? '<&:' : '<&';
                      let rtn = '', tagChars = tagCharsWithEmojis, invisible = 0;
                      for (;;) {
                    Severity: Major
                    Found in app/javascript/mastodon/features/emoji/emoji.js - About 2 hrs to fix

                      File media_cli.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require_relative '../../config/boot'
                      require_relative '../../config/environment'
                      require_relative 'cli_helper'
                      
                      module Mastodon
                      Severity: Minor
                      Found in lib/mastodon/media_cli.rb - About 2 hrs to fix

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

                          render () {
                            const { status, width, height } = this.props;
                            const mediaAttachments = status.get('media_attachments');
                        
                            if (mediaAttachments.size === 0) {
                        Severity: Major
                        Found in app/javascript/mastodon/components/media_attachments.js - About 2 hrs to fix

                          Class AccountAction has 22 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Admin::AccountAction
                            include ActiveModel::Model
                            include AccountableConcern
                            include Authorization
                          
                          
                          Severity: Minor
                          Found in app/models/admin/account_action.rb - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language