Showing 1,278 of 4,906 total issues
Method initialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(path, max_frames = 2)
@path = path
@nb_frames = 0
File.open(path, 'rb') do |s|
- 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 refresh
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def refresh(*usernames)
if options[:domain] || options[:all]
scope = Account.remote
scope = scope.where(domain: options[:domain]) if options[:domain]
- 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 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, footer, emptyMessage, onLoadMore } = this.props;
const { fullscreen } = this.state;
const childrenCount = Children.count(children);
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
this.updateSketcherSettings();
return (
<div className='modal-root__modal doodle-modal'>
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, footer, emptyMessage, onLoadMore } = this.props;
const { fullscreen } = this.state;
const childrenCount = Children.count(children);
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl } = this.props;
const { signedIn, disabledAccountId, permissions } = this.props.identity;
let banner = undefined;
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const style = {
...this.props.style,
...(this.props.active ? this.props.activeStyle : {}),
};
File languages_helper.rb
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module LanguagesHelper
ISO_639_1 = {
aa: ['Afar', 'Afaraf'].freeze,
ab: ['Abkhaz', 'аҧсуа бызшәа'].freeze,
ae: ['Avestan', 'avesta'].freeze,
File media.rb
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative 'base'
module Mastodon::CLI
class Media < Base
include ActionView::Helpers::NumberHelper
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { status, width, height, visible } = this.props;
const mediaAttachments = status.get('media_attachments');
const language = status.getIn(['language', 'translation']) || status.get('language') || this.props.lang;
Function makeMapStateToProps
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const getPictureInPicture = makeGetPictureInPicture();
const getAncestorsIds = createSelector([
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { status, width, height, visible } = this.props;
const mediaAttachments = status.get('media_attachments');
const language = status.getIn(['language', 'translation']) || status.get('language') || this.props.lang;
Method update_column_in_batches
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update_column_in_batches(table_name, column, value)
if transaction_open?
raise 'update_column_in_batches can not be run inside a transaction, ' \
'you can disable transactions by calling disable_ddl_transaction! ' \
'in the body of your migration class'
Class ApplicationController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
Class AccountAction
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Admin::AccountAction
include ActiveModel::Model
include AccountableConcern
include Authorization
Function render
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, onOpenSettings } = this.props;
const { signedIn, disabledAccountId, permissions } = this.props.identity;
let banner = undefined;
Function makeMapStateToProps
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const getPictureInPicture = makeGetPictureInPicture();
const getAncestorsIds = createSelector([
Function render
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const style = {
...this.props.style,
...(this.props.active ? this.props.activeStyle : {}),
};
Function _updateStatusLinks
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_updateStatusLinks () {
const node = this.node;
const { tagLinks, rewriteMentions } = this.props;
if (!node) {
Function statuses
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function statuses(state = initialState, action) {
switch(action.type) {
case STATUS_FETCH_REQUEST:
return state.setIn([action.id, 'isLoading'], true);
case STATUS_FETCH_FAIL: