glitch-soc/mastodon

View on GitHub

Showing 1,294 of 4,908 total issues

Function ColumnLink has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const ColumnLink = ({ icon, activeIcon, iconComponent, activeIconComponent, text, to, onClick, href, method, badge, transparent, optional, ...other }) => {
const match = useRouteMatch(to);
const className = classNames('column-link', { 'column-link--transparent': transparent, 'column-link--optional': optional });
const badgeElement = typeof badge !== 'undefined' ? <span className='column-link__badge'>{badge}</span> : null;
const iconElement = (typeof icon === 'string' || iconComponent) ? <Icon id={icon} icon={iconComponent} className='column-link__icon' /> : icon;

Function _updateLinks has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

_updateLinks () {
const node = this.node;
 
if (!node) {
return;

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

render () {
const { media, statusId, lang, intl, onClose } = this.props;
const { navigationHidden, zoomedIn, viewportWidth, viewportHeight } = this.state;
 
const index = this.getIndex();

Method _insert_record has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _insert_record(connection, 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

Function expandNormalizedTimeline has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, isLoadingRecent, usePendingItems) => {
// This method is pretty tricky because:
// - existing items in the timeline might be out of order
// - the existing timeline may have gaps, most often explicitly noted with a `null` item
// - ideally, we don't want it to reorder existing items of the timeline
Severity: Minor
Found in app/javascript/mastodon/reducers/timelines.js - About 1 hr to fix

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

render () {
const { status, intl, withOpenButton } = this.props;
 
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';

Function _updateLinks has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

_updateLinks () {
const node = this.node;
 
if (!node) {
return;

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

render () {
const { media, statusId, lang, intl, onClose } = this.props;
const { navigationHidden, zoomedIn, viewportWidth, viewportHeight } = this.state;
 
const index = this.getIndex();
Severity: Minor
Found in app/javascript/mastodon/features/ui/components/media_modal.jsx - About 1 hr to fix

Method provides_callback_for has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def self.provides_callback_for(provider)
define_method provider do
@provider = provider
@user = User.find_for_omniauth(request.env['omniauth.auth'], current_user)
 
 
Severity: Minor
Found in app/controllers/auth/omniauth_callbacks_controller.rb - About 1 hr to fix

Method index has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def index
respond_to do |format|
format.html do
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.hour) unless user_signed_in?
end
Severity: Minor
Found in app/controllers/following_accounts_controller.rb - About 1 hr to fix

Method import_bookmarks! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def import_bookmarks!
parse_import_data!(['#uri'])
items = @data.take(ROWS_PROCESSING_LIMIT).map { |row| row['#uri'].strip }
 
if @import.overwrite?
Severity: Minor
Found in app/services/import_service.rb - About 1 hr to fix

Method call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def call(account, params, raise_error: false)
was_locked = account.locked
update_method = raise_error ? :update! : :update
 
account.send(update_method, params).tap do |ret|
Severity: Minor
Found in app/services/update_account_service.rb - About 1 hr to fix

Method collection_items has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def collection_items(collection)
all_items = []
 
collection = fetch_collection(collection['first']) if collection['first'].present?
 
 
Severity: Minor
Found in app/services/activitypub/fetch_featured_tags_collection_service.rb - About 1 hr to fix

Method update_emojis! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def update_emojis!
return if skip_download?
 
@raw_emojis.each do |raw_emoji|
custom_emoji_parser = ActivityPub::Parser::CustomEmojiParser.new(raw_emoji)
Severity: Minor
Found in app/services/activitypub/process_status_update_service.rb - About 1 hr to fix

Method update_poll! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def update_poll!(allow_significant_changes: true)
previous_poll = @status.preloadable_poll
@previous_expires_at = previous_poll&.expires_at
poll_parser = ActivityPub::Parser::PollParser.new(@json)
 
 
Severity: Minor
Found in app/services/activitypub/process_status_update_service.rb - About 1 hr to fix

Method hydrate_reblog_payload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def hydrate_reblog_payload(empty_payload, account_id)
empty_payload.tap do |payload|
payload[:muted] = false
payload[:bookmarked] = false
payload[:pinned] = false if @status.account_id == account_id
Severity: Minor
Found in app/lib/status_cache_hydrator.rb - About 1 hr to fix

Method call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def call(account, options = {})
@account = account
@options = options
@text = @options[:text] || ''
@in_reply_to = @options[:thread]
Severity: Minor
Found in app/services/post_status_service.rb - About 1 hr to fix

Method add_to_feed has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def add_to_feed(timeline_type, account_id, status, aggregate_reblogs: true)
timeline_key = key(timeline_type, account_id)
reblog_key = key(timeline_type, account_id, 'reblogs')
 
if status.reblog? && (aggregate_reblogs.nil? || aggregate_reblogs)
Severity: Minor
Found in app/lib/feed_manager.rb - About 1 hr to fix

Method verify_actor! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def verify_actor!
return unless @json['signature'].is_a?(Hash)
 
type = @json['signature']['type']
creator_uri = @json['signature']['creator']
Severity: Minor
Found in app/lib/activitypub/linked_data_signature.rb - About 1 hr to fix

Method self_destruct has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def self_destruct
if SelfDestructHelper.self_destruct?
say('Self-destruct mode is already enabled for this Mastodon server', :green)
 
pending_accounts = Account.local.without_suspended.count + Account.local.suspended.joins(:deletion_request).count
Severity: Minor
Found in lib/mastodon/cli/federation.rb - About 1 hr to fix
Severity
Category
Status
Source
Language