Showing 1,278 of 4,906 total issues
Method process_response
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def process_response(response, terminal = false)
@response_code = response.code
return nil if response.code != 200
if valid_activitypub_content_type?(response)
- 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 pam_get_user
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.pam_get_user(attributes = {})
return nil unless attributes[:email]
resource = if Devise.check_at_sign && !attributes[:email].index('@')
joins(:account).find_by(accounts: { username: attributes[:email] })
- 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 create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create(username)
role_id = nil
if options[:role]
role = UserRole.find_by(name: options[:role])
- 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 renderItem
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderItem (account, size, index) {
const { animate } = this.props;
let width = 50;
let height = 100;
File language_dropdown.jsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { injectIntl, defineMessages } from 'react-intl';
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;
const pinned = !!columnId;
const { signedIn } = this.props.identity;
const banners = [];
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { multiColumn, showNotificationsBadge, unreadNotifications, intl } = this.props;
const elefriend = [glitchedElephant1, glitchedElephant2, glitchedElephant3, elephantUIPlane][this.state.elefriend];
Function renderItem
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderItem (account, size, index) {
const { animate } = this.props;
let width = 50;
let height = 100;
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;
const pinned = !!columnId;
const { signedIn } = this.props.identity;
const banners = [];
File language_dropdown.jsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { injectIntl, defineMessages } from 'react-intl';
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { draggingOver } = this.state;
const { children, isWide, location, layout, moved } = this.props;
const className = classNames('ui', {
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { hasUnread, columnId, multiColumn, list } = this.props;
const { id } = this.props.params;
const pinned = !!columnId;
const title = list ? list.get('title') : id;
Function normalizeStatus
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function normalizeStatus(status, normalOldStatus) {
const normalStatus = { ...status };
normalStatus.account = status.account.id;
if (status.reblog && status.reblog.id) {
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { hasUnread, columnId, multiColumn, list } = this.props;
const { id } = this.props.params;
const pinned = !!columnId;
const title = list ? list.get('title') : id;
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, myAccount, multiColumn, unreadFollowRequests } = this.props;
const { signedIn, permissions } = this.props.identity;
const navItems = [];
File compose_form.jsx
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import PropTypes from 'prop-types';
import { createRef } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
StatusActionBar
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class StatusActionBar extends ImmutablePureComponent {
static propTypes = {
identity: identityContextPropShape,
status: ImmutablePropTypes.map.isRequired,
onReply: PropTypes.func,
Notification
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Notification extends ImmutablePureComponent {
static propTypes = {
notification: ImmutablePropTypes.map.isRequired,
hidden: PropTypes.bool,
onMoveUp: PropTypes.func.isRequired,
ComposeForm
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ComposeForm extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
text: PropTypes.string.isRequired,
suggestions: ImmutablePropTypes.list,
Class SessionsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Auth::SessionsController < Devise::SessionsController
include Redisable
MAX_2FA_ATTEMPTS_PER_HOUR = 10