Showing 720 of 1,785 total issues
File maintenance_cli.rb
has 525 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'tty-prompt'
require_relative '../../config/boot'
require_relative '../../config/environment'
require_relative 'cli_helper'
File accounts_cli.rb
has 508 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'set'
require_relative '../../config/boot'
require_relative '../../config/environment'
require_relative 'cli_helper'
File migration_helpers.rb
has 508 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mastodon
module MigrationHelpers
class CorruptionError < StandardError
attr_reader :index_name
Function emojify
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
const emojify = (str, customEmojis = {}) => {
const tagCharsWithoutEmojis = '<&';
const tagCharsWithEmojis = Object.keys(customEmojis).length ? '<&:' : '<&';
let rtn = '', tagChars = tagCharsWithEmojis, invisible = 0;
for (;;) {
- 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
Function render
has 189 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { account, hidden, intl, domain } = this.props;
if (!account) {
return null;
Status
has 51 functions (exceeds 20 allowed). Consider refactoring. Open
export default @injectIntl
@connect(makeMapStateToProps)
class Status extends ImmutablePureComponent {
static contextTypes = {
File index.js
has 465 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
import { formatTime } from 'mastodon/features/video';
import Icon from 'mastodon/components/icon';
File status.rb
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Status < ApplicationRecord
before_destroy :unlink_from_conversations
include Discard::Model
include Paginable
File index.js
has 455 lines of code (exceeds 250 allowed). Consider refactoring. Open
import classNames from 'classnames';
import React from 'react';
import { HotKeys } from 'react-hotkeys';
import { defineMessages, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
File account.rb
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Account < ApplicationRecord
self.ignored_columns = %w(
subscription_expires_at
secret
remote_url
Function render
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
render () {
let media = null;
let statusAvatar, prepend, rebloggedByText, unlistedQuoteText;
const { intl, hidden, featured, unread, showThread, scrollKey, pictureInPicture, contextType } = this.props;
- 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 remotable_attachment
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def remotable_attachment(attachment_name, limit, suppress_errors: true, download_on_assign: true, attribute_name: nil)
attribute_name ||= "#{attachment_name}_remote_url".to_sym
define_method("download_#{attachment_name}!") do |url = nil|
url ||= self[attribute_name]
- 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
File media_gallery.js
has 434 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { is } from 'immutable';
import IconButton from './icon_button';
Audio
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
export default @injectIntl
class Audio extends React.PureComponent {
static propTypes = {
src: PropTypes.string.isRequired,
Function render
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
const anonymousAccess = !me;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
- 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
Function render
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, multiColumn } = this.props;
return (
<Column bindToDocument={!multiColumn} icon='question' heading={intl.formatMessage(messages.heading)}>
Function render
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props;
const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;
const filterBarShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show_bar' defaultMessage='Show filter bar' />;
Method call
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def call(username, domain, json, options = {})
return if json['inbox'].blank? || unsupported_uri_scheme?(json['id']) || domain_not_allowed?(domain)
@options = options
@json = json
- 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 storage_schema
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def storage_schema
progress = create_progress_bar(nil)
dry_run = dry_run? ? ' (DRY RUN)' : ''
records = 0
- 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
Class Create
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class ActivityPub::Activity::Create < ActivityPub::Activity
include FormattingHelper
def perform
dereference_object!