Showing 1,278 of 4,906 total issues
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 account--minimal') do
content_tag(:div, class: 'account__wrapper') do
section = if account.nil?
content_tag(:div, class: 'account__display-name') do
Method calculate_scores
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_scores(preview_cards, at_time)
items = preview_cards.map do |preview_card|
expected = preview_card.history.get(at_time - 1.day).accounts.to_f
expected = 1.0 if expected.zero?
observed = preview_card.history.get(at_time).accounts.to_f
Method import_bookmarks!
has 28 lines of code (exceeds 25 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?
Method to_s
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s
return html if custom_emojis.empty? || html.blank?
tree = Nokogiri::HTML5.fragment(html)
tree.xpath('./text()|.//text()[not(ancestor[@class="invisible"])]').to_a.each do |node|
Method default_filter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_filter
{
bool: {
should: [
{
Method add
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add(*addresses)
fail_with_message 'No IP(s) given' if addresses.empty?
skipped = 0
processed = 0
Method meta
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def meta
store = default_meta_store
if object.current_account
store[:me] = object.current_account.id.to_s
Method rewrite_follows!
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rewrite_follows!
num_moved = 0
# First, approve pending follow requests for the new account,
# this allows correctly processing list memberships with pending
Method refresh
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def refresh(*usernames)
if options[:domain] || options[:all]
scope = Account.remote
scope = scope.where(domain: options[:domain]) if options[:domain]
Method deduplicate_local_accounts!
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deduplicate_local_accounts!(scope)
accounts = scope.order(id: :desc).includes(:account_stat, :user).to_a
say "Multiple local accounts were found for username '#{accounts.first.username}'.", :yellow
say 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.', :yellow
Function showAlertForError
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const showAlertForError = (error: unknown, skipNotFound = false) => {
if (error instanceof AxiosError && error.response) {
const { status, statusText, headers } = error.response;
const { data } = error.response as AxiosResponse<ApiErrorResponse>;
Function showAlertForError
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const showAlertForError = (error: unknown, skipNotFound = false) => {
if (error instanceof AxiosError && error.response) {
const { status, statusText, headers } = error.response;
const { data } = error.response as AxiosResponse<ApiErrorResponse>;
Function onChangeRegistrationMode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onChangeRegistrationMode = (target: HTMLSelectElement) => {
const enabled = target.value === 'approved';
document
.querySelectorAll<HTMLElement>(
Function onChangeRegistrationMode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onChangeRegistrationMode = (target: HTMLSelectElement) => {
const enabled = target.value === 'approved';
document
.querySelectorAll<HTMLElement>(
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
const isLoading = server.get('isLoading');
return (
- 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 makeMapStateToProps
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const getPictureInPicture = makeGetPictureInPicture();
const mapStateToProps = (state, 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
Function getNextOpen
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getNextOpen(now) {
var days = [[0, 14], [4, 18], [8, 22], [12], [2, 16], [6, 20], [10]]
var nowday = now.getUTCDay();
var nour = now.getUTCHours();
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { media, lang, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props;
const { visible } = this.state;
const size = media.size;
const uncached = media.every(attachment => attachment.get('type') === 'unknown');
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { handleChange } = this;
const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props;
let enabled = !disabled;
- 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 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"