glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Method failures has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def failures
    @bulk_import = current_account.bulk_imports.state_finished.find(params[:id])

    respond_to do |format|
      format.csv do
Severity: Minor
Found in app/controllers/settings/imports_controller.rb - About 1 hr to fix

    Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        authorize @report, :show?
    
        case action_from_button
        when 'delete', 'mark_as_sensitive'
    Severity: Minor
    Found in app/controllers/admin/reports/actions_controller.rb - About 1 hr to fix

      Method call has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def call(body, actor, **options)
          @account = actor
          @json    = original_json = Oj.load(body, mode: :strict)
          @options = options
      
      
      Severity: Minor
      Found in app/services/activitypub/process_collection_service.rb - About 1 hr to fix

        Method add has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def add(*domains)
              fail_with_message 'No domain(s) given' if domains.empty?
        
              skipped = 0
              processed = 0
        Severity: Minor
        Found in lib/mastodon/cli/email_domain_blocks.rb - About 1 hr to fix

          Method cull has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def cull(*domains)
                skip_threshold = 7.days.ago
                skip_domains   = Concurrent::Set.new
          
                query = Account.remote.activitypub
          Severity: Minor
          Found in lib/mastodon/cli/accounts.rb - About 1 hr to fix

            Method perform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def perform
                return if under_load?
            
                budget = compute_budget
            
            
            Severity: Minor
            Found in app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb - About 1 hr to fix

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

                  def refresh
                    if options[:status]
                      scope = MediaAttachment.where(status_id: options[:status])
                    elsif options[:account]
                      username, domain = options[:account].split('@')
              Severity: Minor
              Found in lib/mastodon/cli/media.rb - About 1 hr to fix

                Function markersReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const markersReducer = createReducer(initialState, (builder) => {
                  builder.addCase(
                    submitMarkersAction.fulfilled,
                    (state, { payload: { home, notifications } }) => {
                      if (home) state.home = home;
                Severity: Minor
                Found in app/javascript/flavours/glitch/reducers/markers.ts - About 1 hr to fix

                  Function markersReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const markersReducer = createReducer(initialState, (builder) => {
                    builder.addCase(
                      submitMarkersAction.fulfilled,
                      (state, { payload: { home, notifications } }) => {
                        if (home) state.home = home;
                  Severity: Minor
                  Found in app/javascript/mastodon/reducers/markers.ts - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                      if (normalOldStatus && normalOldStatus.get('content') === normalStatus.content && normalOldStatus.get('spoiler_text') === normalStatus.spoiler_text) {
                        normalStatus.search_index = normalOldStatus.get('search_index');
                        normalStatus.contentHtml = normalOldStatus.get('contentHtml');
                        normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
                        normalStatus.hidden = normalOldStatus.get('hidden');
                    Severity: Major
                    Found in app/javascript/flavours/glitch/actions/importer/normalizer.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          } else if (isLoading || childrenCount > 0 || numPending > 0 || hasMore || !emptyMessage) {
                            scrollableArea = (
                              <div className={classNames('scrollable scrollable--flex', { fullscreen })} ref={this.setRef} onMouseMove={this.handleMouseMove}>
                                <div role='feed' className='item-list'>
                                  {prepend}
                      Severity: Major
                      Found in app/javascript/mastodon/components/scrollable_list.jsx - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if (multiColumn) {
                              const { columns } = this.props;
                        
                              return (
                                <div className='drawer' role='region' aria-label={intl.formatMessage(messages.compose)}>
                        Severity: Major
                        Found in app/javascript/mastodon/features/compose/index.jsx - About 1 hr to fix

                          Function stringFromCodePoint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const stringFromCodePoint = _String.fromCodePoint || function () {
                            let MAX_SIZE = 0x4000;
                            let codeUnits = [];
                            let highSurrogate;
                            let lowSurrogate;
                          Severity: Minor
                          Found in app/javascript/flavours/glitch/features/emoji/emoji_utils.js - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                            render () {
                              const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, footer, emptyMessage, onLoadMore } = this.props;
                              const { fullscreen } = this.state;
                              const childrenCount = Children.count(children);
                          
                          
                          Severity: Minor
                          Found in app/javascript/flavours/glitch/components/scrollable_list.jsx - About 55 mins 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 mapStateToProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = false }) => {
                            const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);
                          
                            if (accountId === null) {
                              return {
                          Severity: Minor
                          Found in app/javascript/flavours/glitch/features/account_timeline/index.jsx - About 55 mins 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 handleNotificationClick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const handleNotificationClick = (event) => {
                            const reactToNotificationClick = new Promise((resolve, reject) => {
                              if (event.action) {
                                if (event.action === 'expand') {
                                  resolve(expandNotification(event.notification));
                          Severity: Minor
                          Found in app/javascript/mastodon/service_worker/web_push_notifications.js - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                            render () {
                              const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, footer, emptyMessage, onLoadMore } = this.props;
                              const { fullscreen } = this.state;
                              const childrenCount = Children.count(children);
                          
                          
                          Severity: Minor
                          Found in app/javascript/mastodon/components/scrollable_list.jsx - About 55 mins 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 stringFromCodePoint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const stringFromCodePoint = _String.fromCodePoint || function () {
                            let MAX_SIZE = 0x4000;
                            let codeUnits = [];
                            let highSurrogate;
                            let lowSurrogate;
                          Severity: Minor
                          Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 55 mins 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 mapStateToProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = false }) => {
                            const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);
                          
                            if (accountId === null) {
                              return {
                          Severity: Minor
                          Found in app/javascript/mastodon/features/account_timeline/index.jsx - About 55 mins 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 calculate_scores has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def calculate_scores(statuses, at_time)
                              items = statuses.map do |status|
                                expected  = 1.0
                                observed  = (status.reblogs_count + status.favourites_count).to_f
                          
                          
                          Severity: Minor
                          Found in app/models/trends/statuses.rb - About 55 mins 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