Showing 720 of 1,785 total issues
Method filter_from_home?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def filter_from_home?(status, receiver_id, crutches)
return false if receiver_id == status.account_id
return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?)
check_for_blocks = crutches[:active_mentions][status.id] || []
- 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 add_to_feed
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_to_feed(timeline_type, account_id, status, aggregate_reblogs: true)
timeline_key = key(timeline_type, account_id)
reblog_key = key(timeline_type, account_id, 'reblogs')
if status.reblog? && (aggregate_reblogs.nil? || aggregate_reblogs)
- 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 blocked?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def blocked?
blocked = @recipient.suspended?
blocked ||= from_self? && @notification.type != :poll
return blocked if message? && from_staff?
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { isLoading, results } = this.props;
const { type } = this.state;
let filteredResults = ImmutableList();
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { type, src, currentTime, accountId, statusId } = this.props;
if (!currentTime) {
return null;
Method advanced_search_for_sql_template
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def advanced_search_for_sql_template(following)
if following
<<-SQL.squish
WITH first_degree AS (
SELECT target_account_id
Method meta
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def meta
store = {
streaming_api_base_url: Rails.configuration.x.streaming_api_base_url,
access_token: object.token,
locale: I18n.locale,
Method create
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(username)
role_id = nil
if options[:role]
role = UserRole.find_by(name: options[:role])
Function connectStream
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
const streamingAPIBaseURL = getState().getIn(['meta', 'streaming_api_base_url']);
const accessToken = getState().getIn(['meta', 'access_token']);
const { onConnect, onReceive, onDisconnect } = callbacks(dispatch, getState);
Function announcementsReducer
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function announcementsReducer(state = initialState, action) {
switch(action.type) {
case ANNOUNCEMENTS_TOGGLE_SHOW:
return state.withMutations(map => {
map.set('show', !map.get('show'));
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { draggingOver } = this.state;
const { children, isComposing, location, dropdownMenuIsOpen, layout } = this.props;
const handlers = {
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { hasUnread, columnId, multiColumn, tag, intl } = this.props;
const { id, local } = this.props.params;
const pinned = !!columnId;
Method merge_with!
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge_with!(other_account)
# Since it's the same remote resource, the remote resource likely
# already believes we are following/blocking, so it's safe to
# re-attribute the relationships too. However, during the presence
# of the index bug users could have *also* followed the reference
Method set_descendants
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_descendants
@max_descendant_thread_id = params[:max_descendant_thread_id]&.to_i
@since_descendant_thread_id = params[:since_descendant_thread_id]&.to_i
descendants = cache_collection(
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, multiColumn, isSearching, layout } = this.props;
return (
<Column bindToDocument={!multiColumn} ref={this.setRef} label={intl.formatMessage(messages.title)}>
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { isLoading, accountIds, intl, columnId, multiColumn, domain } = this.props;
const { order, local } = this.getParams(this.props, this.state);
const pinned = !!columnId;
Method parallelize_with_progress
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parallelize_with_progress(scope)
if options[:concurrency] < 1
say('Cannot run with this concurrency setting, must be at least 1', :red)
exit(1)
end
Function handlePush
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handlePush = (event) => {
const { access_token, notification_id, preferred_locale, title, body, icon } = event.data.json();
// Placeholder until more information can be loaded
event.waitUntil(
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { intl, accountIds, hasMore, multiColumn, locked, domain, isLoading } = this.props;
if (!accountIds) {
return (
Method to_s
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s
return html if custom_emojis.empty? || html.blank?
i = -1
tag_open_index = nil