Showing 267 of 502 total issues
Avoid too many return
statements within this function. Open
return 'group_form.subgroup_privacy_is_closed_description';
Avoid too many return
statements within this function. Open
return 'discussion_edited';
Avoid too many return
statements within this method. Open
return parse(ranges) if ranges.is_a? String
Avoid too many return
statements within this method. Open
return
Function pieSlices
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
pieSlices() {
let slices = [];
if ((this.pollType === 'count') && this.results.find(r => r.icon === 'agree')) {
const agree = this.results.find(r => r.icon === 'agree');
if (agree.score < this.agreeTarget) {
- 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 bestNamedId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
bestNamedId() {
return ((this.id && this) || (this.pollId && this.poll()) || (this.groupId && this.group()) || {namedId() {}}).namedId();
}
- 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 pg_search_insert_statement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.pg_search_insert_statement(id: nil, author_id: nil, discussion_id: nil)
content_str = "regexp_replace(CONCAT_WS(' ', polls.title, polls.details, users.name), E'<[^>]+>', '', 'gi')"
<<~SQL.squish
INSERT INTO pg_search_documents (
searchable_type,
- 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 dump_i18n
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dump_i18n
out = {}
[
:title,
:title_placeholder,
- 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 actions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
actions(comment, vm, event) {
const isOwnComment = comment.authorId === Session.userId;
return {
translate_comment: {
name: 'common.action.translate',
- 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 update_reader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_reader(ranges: nil, volume: nil, participate: false, dismiss: false)
viewed!(ranges, persist: false) if ranges
set_volume!(volume, persist: false) if volume && (volume != :loud || user.email_on_participation?)
dismiss!(persist: false) if dismiss
save! if changed?
- 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 getEmbedLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export var getEmbedLink = function(link) {
link = link || "";
if (link.includes("youtube.com") || link.includes("youtu.be")) {
return getYoutubeEmbedLink(link);
} else if (link.includes("vimeo.com/")) {
- 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 canEdit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
canEdit(model) {
return (model.isA('discussion') && this.canEditThread(model)) ||
(model.isA('comment') && this.canEditComment(model)) ||
(model.isA('poll') && this.canEditPoll(model)) ||
(model.isA('stance') && this.canEditStance(model));
- 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 poll_option_names=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def poll_option_names=(names)
names = Array(names)
existing = Array(poll_options.pluck(:name))
names = names.sort if poll_type == 'meeting'
names.each_with_index do |name, priority|
- 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 buildModelRoute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static buildModelRoute(path, key, name, params, options) {
let result = options.absolute ? AppConfig.baseUrl : "/";
if ((options.namespace || path || "").length > 0) { result += `${options.namespace || path}/`; }
result += `${key}`;
if (!(name == null) && (options.noStub == null)) { result += "/" + this.stub(name); }
- 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 next_position!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def next_position!
return 0 unless (discussion_id and parent_id)
unless SequenceService.seq_present?('events_position', parent_id)
val = Event.where(parent_id: parent_id,
discussion_id: discussion_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 to_ranges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.to_ranges(ranges)
# ranges is supposed to be an array of ranges.
# but it's useful to support
# range set
return [] if ranges.nil?
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def self.create(poll:, actor:, params: {})
actor.ability.authorize! :create, poll
poll.assign_attributes(author: actor)
poll.prioritise_poll_options!
- 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 accept_pending_membership
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def accept_pending_membership
group = @group or (@discussion && @discussion.group) or (@poll && @poll.group)
return unless group
MembershipService.redeem_if_pending!(group.membership_for(current_user))
end
- 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_stances
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_stances(collection)
return [] if exclude_types.include?('stance')
scope[:stances_by_id] ||= {}
scope[:my_stances_by_poll_id] ||= {}
collection.each do |stance|
- 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 visible_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.visible_to(user: LoggedOutUser.new,
chain: start,
group_ids: [],
show_public: false)
- 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"