Showing 720 of 1,785 total issues
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, accountIds, multiColumn } = this.props;
if (!accountIds) {
return (
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { value, intl, disabled } = this.props;
const { open, placement } = this.state;
const valueOption = this.options.find(item => item.value === value);
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { status, checked } = this.props;
if (status.get('reblog')) {
return null;
Method show
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
respond_to do |format|
format.html do
expires_in 0, public: true unless user_signed_in?
Method process_attachments
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_attachments
return [] if @object['attachment'].nil?
media_attachments = []
Method update_media_attachments!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_media_attachments!
previous_media_attachments = @status.media_attachments.to_a
previous_media_attachments_ids = @status.ordered_media_attachment_ids || previous_media_attachments.map(&:id)
next_media_attachments = []
Method import!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import!
# The idea is that instead of iterating over all statuses in the database
# and calculating the searchable_by for each of them (majority of which
# would be empty), we approach the index from the other end
Method rename_column_concurrently
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rename_column_concurrently(table, old, new, type: nil)
if transaction_open?
raise 'rename_column_concurrently can not be run inside a transaction'
end
Method upgrade_storage_filesystem
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade_storage_filesystem(progress, attachment, style)
previous_storage_schema_version = attachment.storage_schema_version
previous_path = attachment.path(style)
success = true
Function _updateLinks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_updateLinks () {
const node = this.node;
if (!node) {
return;
Function relationships
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function relationships(state = initialState, action) {
switch(action.type) {
case ACCOUNT_FOLLOW_REQUEST:
return state.getIn([action.id, 'following']) ? state : state.setIn([action.id, action.locked ? 'requested' : 'following'], true);
case ACCOUNT_FOLLOW_FAIL:
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, hidden, report, account } = this.props;
if (!report) {
return null;
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { emoji, emojiMap, hovered } = this.props;
if (unicodeMapping[emoji]) {
const { filename, shortCode } = unicodeMapping[this.props.emoji];
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, value, submitted } = this.props;
const { expanded } = this.state;
const hasValue = value.length > 0 || submitted;
Method account_link_to
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def account_link_to(account, button = '', path: nil)
content_tag(:div, class: 'account') do
content_tag(:div, class: 'account__wrapper') do
section = if account.nil?
content_tag(:div, class: 'account__display-name') do
Method lookup
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def lookup(url)
path = Addressable::URI.parse(url).path
path_segments = path.split('/')[2..-1]
path_segments.delete('cache')
Method refresh
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def refresh(username = nil)
dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
if options[:domain] || options[:all]
scope = Account.remote
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { announcement } = this.props;
const { unread } = this.state;
const startsAt = announcement.get('starts_at') && new Date(announcement.get('starts_at'));
const endsAt = announcement.get('ends_at') && new Date(announcement.get('ends_at'));
- Read upRead up
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 statuses_to_delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def statuses_to_delete(limit = 50, max_id = nil, min_id = nil)
scope = account.statuses
scope.merge!(old_enough_scope(max_id))
scope = scope.where(Status.arel_table[:id].gteq(min_id)) if min_id.present?
scope.merge!(without_popular_scope) unless min_favs.nil? && min_reblogs.nil?
- Read upRead up
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 validate_target_account
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_target_account
if target_account.nil?
errors.add(:acct, I18n.t('migrations.errors.not_found'))
else
errors.add(:acct, I18n.t('migrations.errors.missing_also_known_as')) unless target_account.also_known_as.include?(ActivityPub::TagManager.instance.uri_for(account))
- Read upRead up
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"