Showing 720 of 1,785 total issues
Function mapDispatchToProps
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
onReply (status, router) {
dispatch((_, getState) => {
let state = getState();
- 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 35 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { status, relationship, intl } = this.props;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const pinnableStatus = ['public', 'unlisted', 'private'].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
Video
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
export default @injectIntl
class Video extends React.PureComponent {
static propTypes = {
preview: PropTypes.string,
Function streamFrom
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
const streamFrom = (ids, req, output, attachCloseHandler, needsFiltering = false) => {
const accountId = req.accountId || req.remoteAddress;
log.verbose(req.requestId, `Starting stream from ${ids.join(', ')} for ${accountId}`);
Status
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
export default @injectIntl
class Status extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
File notification.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
import { HotKeys } from 'react-hotkeys';
import PropTypes from 'prop-types';
Class ProcessAccountService
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class ActivityPub::ProcessAccountService < BaseService
include JsonLdHelper
include DomainControlHelper
include Redisable
include Lockable
Class UserSettingsDecorator
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class UserSettingsDecorator
attr_reader :user, :settings
def initialize(user)
@user = user
File announcements.js
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import ImmutablePureComponent from 'react-immutable-pure-component';
import ReactSwipeableViews from 'react-swipeable-views';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
Function mapDispatchToProps
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
const mapDispatchToProps = (dispatch, { intl }) => ({
onReply (status, router) {
dispatch((_, getState) => {
let state = getState();
- 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
UI
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
export default @connect(mapStateToProps)
@injectIntl
@withRouter
class UI extends React.PureComponent {
File zoomable_image.js
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import PropTypes from 'prop-types';
import IconButton from 'mastodon/components/icon_button';
import { defineMessages, injectIntl } from 'react-intl';
Function render
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { media, intl, account, onClose, isUploadingThumbnail, description, focusX, focusY, dirty, is_changing_upload } = this.props;
const { dragging, detecting, progress, ocrStatus } = this.state;
const x = (focusX / 2) + .5;
const y = (focusY / -2) + .5;
Function listener
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
const listener = message => {
const json = parseJSON(message, req);
if (!json) return;
Method crawl
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def crawl(start = nil)
stats = Concurrent::Hash.new
processed = Concurrent::AtomicFixnum.new(0)
failed = Concurrent::AtomicFixnum.new(0)
start_at = Time.now.to_f
- 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 translationEndpointCallback
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
const translationEndpointCallback = async (request, response) => {
const body = request.body;
const { content, to, status, edit } = body;
Function render
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, editable, blurhash } = this.props;
const { quote } = this.props;
// const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, link, editable, blurhash, quote } = this.props;
const { containerWidth, currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state;
File user.rb
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
class User < ApplicationRecord
self.ignored_columns = %w(
remember_created_at
remember_token
current_sign_in_ip
Function render
has 112 lines of code (exceeds 25 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'));
File interactions.js
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
import api from '../api';
import { importFetchedAccounts, importFetchedStatus } from './importer';
export const REBLOG_REQUEST = 'REBLOG_REQUEST';
export const REBLOG_SUCCESS = 'REBLOG_SUCCESS';