Showing 720 of 1,785 total issues
Method modify
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def modify(username)
user = Account.find_local(username)&.user
if user.nil?
say('No user with such username', :red)
- 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 normalizeWheel
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const normalizeWheel = event => {
// Reasonable defaults
const PIXEL_STEP = 10;
const LINE_HEIGHT = 40;
const PAGE_HEIGHT = 800;
Function notifications
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function notifications(state = initialState, action) {
switch(action.type) {
case MARKERS_FETCH_SUCCESS:
return action.markers.notifications ? recountUnread(state, action.markers.notifications.last_read_id) : state;
case NOTIFICATIONS_MOUNT:
Method crawl
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function register
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function register () {
return (dispatch, getState) => {
dispatch(setBrowserSupport(supportsPushNotifications));
if (supportsPushNotifications) {
Function submitCompose
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function submitCompose(routerHistory) {
return function (dispatch, getState) {
const status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const statusId = getState().getIn(['compose', 'id'], null);
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { loading, style, intl, custom_emojis, skinTone, frequentlyUsedEmojis } = this.props;
if (loading) {
return <div style={{ width: 299 }} />;
Function statusLists
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function statusLists(state = initialState, action) {
switch(action.type) {
case FAVOURITED_STATUSES_FETCH_REQUEST:
case FAVOURITED_STATUSES_EXPAND_REQUEST:
return state.setIn(['favourites', 'isLoading'], true);
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { label, href, target } = this.props;
const { loading, data } = this.state;
let content;
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { index, versions, onClose } = this.props;
const currentVersion = versions.get(index);
const emojiMap = currentVersion.get('emojis').reduce((obj, emoji) => {
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { media, intl, sensitive, height, defaultWidth, standalone, autoplay, quote } = this.props;
const { visible } = this.state;
const size = media.take(9).size;
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, blockedBy, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { status, privacy, intl } = this.props;
const buttonText = status.get('reblogged') ? messages.cancel_reblog : messages.reblog;
const visibilityIconInfo = {
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl } = this.props;
if (!isAccount) {
return (
Method remove_statuses
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def remove_statuses
return if options[:skip_status_remove]
say('Creating temporary database indices...')
Function uploadCompose
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = 9;
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
Function updateNotifications
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function updateNotifications(notification, intlMessages, intlLocale) {
return (dispatch, getState) => {
const activeFilter = getState().getIn(['settings', 'notifications', 'quickFilter', 'active']);
const showInColumn = activeFilter === 'all' ? getState().getIn(['settings', 'notifications', 'shows', notification.type], true) : activeFilter === notification.type;
const showAlert = getState().getIn(['settings', 'notifications', 'alerts', notification.type], true);
Method deduplicate_users!
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def deduplicate_users!
remove_index_if_exists!(:users, 'index_users_on_confirmation_token')
remove_index_if_exists!(:users, 'index_users_on_email')
remove_index_if_exists!(:users, 'index_users_on_remember_token')
remove_index_if_exists!(:users, 'index_users_on_reset_password_token')
Function render
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
render () {
const { src, intl, alt, editable, autoPlay, sensitive, blurhash } = this.props;
const { paused, muted, volume, currentTime, duration, buffer, dragging, revealed } = this.state;
const progress = Math.min((currentTime / duration) * 100, 100);
- 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"