Showing 146 of 242 total issues
Avoid deeply nested control flow statements. Open
unless (@task.new_record? rescue true)
Function extendSimilar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function extendSimilar(klass, set, fn, instance, polyfill, override) {
Avoid deeply nested control flow statements. Open
if (set.offsetSign === '-') {
set.offsetMinutes *= -1;
}
Method cache_associations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cache_associations
self.story_id = task.story_id if task_id.present? && (task rescue nil)
self.offeror_id = task.offeror_id if task_id.present? && (task rescue nil) && task.story.with_offeror
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
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 createDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function createDate(contextDate, f, localeCode, prefer, forceUTC) {
Function entryAtIndex
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function entryAtIndex(obj, length, index, overshoot, isString) {
Function truncateString
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function truncateString(str, length, from, ellipsis, split) {
Function getExtendedDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getExtendedDate(contextDate, f, localeCode, prefer, forceUTC) {
Function setDelay
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setDelay(fn, ms, after, scope, args) {
Function runTagReplacements
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function runTagReplacements(str, reg, strip, replacementFn, fullString) {
Function addFormat
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
addFormat: function(src, allowsTime, match, variant, iso) {
Function extend
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function extend(klass, methods, instance, polyfill, override) {
Function compareDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function compareDate(d, find, localeCode, buffer, forceUTC) {
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 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 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"