Showing 146 of 242 total issues
Function extendSimilar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function extendSimilar(klass, set, fn, instance, polyfill, override) {
Method create_with_topic
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.create_with_topic(user_id, attributes)
topic = ArgumentTopic.find_or_create_by_name attributes[:topic_name]
if topic.valid?
argumentable_id = if attributes[:argumentable_name].present?
- 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 updateDate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateDate(d, params, reset, advance, prefer, weekdayForward) {
Function abbreviateNumber
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function abbreviateNumber(num, roundTo, str, mid, limit, bytes) {
Consider simplifying this complex logical expression. Open
if (obj.start && obj.end) {
return obj.start >= this.start && obj.start <= this.end &&
obj.end >= this.start && obj.end <= this.end;
} else {
return obj >= this.start && obj <= this.end;
Function extend
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function extend(klass, methods, instance, polyfill, override) {
Function runTagReplacements
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function runTagReplacements(str, reg, strip, replacementFn, fullString) {
Function setDelay
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setDelay(fn, ms, after, scope, args) {
Function truncateString
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function truncateString(str, length, from, ellipsis, split) {
Function addFormat
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
addFormat: function(src, allowsTime, match, variant, iso) {
Function createDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function createDate(contextDate, f, localeCode, prefer, forceUTC) {
Function getExtendedDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getExtendedDate(contextDate, f, localeCode, prefer, forceUTC) {
Function compareDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function compareDate(d, find, localeCode, buffer, forceUTC) {
Function entryAtIndex
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function entryAtIndex(obj, length, index, overshoot, isString) {
Method next
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def next
story = Story.find(params[:story_id])
task = story.next_task_for_user(current_user)
product_id = story.product_id.blank? ? 'no-name' : story.product_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 access_denied
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def access_denied
message = I18n.t('general.exceptions.access_denied')
if request.format.try('json?') || request.xhr?
render status: 403, json: { error: message } and return
- 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 build_result
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_result
result_params = params[:task] ? params[:task].delete(:result_attributes) : nil
result_params = result_params || {}
unless resource.result_id.present?
- 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 languages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.languages(query = nil)
options = []
AVAILABLE_LANGUAGES.merge(OTHER_LANGUAGES).each do |locale, language|
next if query && !language.downcase.match(query.downcase)
- 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 exception_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def exception_action(exception)
@exception_catched = true
if Rails.env == 'production'
notify_airbrake(exception)
- 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 search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.search(term, known_things)
begin
JSON.parse(
HTTParty.get(
"https://www.wikidata.org/w/api.php?action=wbsearchentities&search=" +
- 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"