Showing 628 of 1,682 total issues
Avoid deeply nested control flow statements. Open
elsif node.kind_of? Arel::Nodes::NodeExpression
# Generic case, go through left and right
modify_conditions(node.left) if node.respond_to?(:left) && node.left
modify_conditions(node.right) if node.respond_to?(:right) && node.right
Method new_start_date
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new_start_date
current_start_date = work_package.start_date || work_package.due_date
return unless current_start_date && work_package.schedule_automatically?
- 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 call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call
if repository.managed? && repository.manageable?
##
# We want to move this functionality in a Delayed Job,
- 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 at_timestamp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def at_timestamp(timestamp)
unless timestamp.kind_of? Timestamp or timestamp.kind_of? ActiveSupport::TimeWithZone or timestamp.kind_of? DateTime
raise ArgumentError, "Expected timestamp to be a Timestamp, an ActiveSupport::TimeWithZone, or a DateTime"
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 parse_qvalues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_qvalues(value)
tmp = []
if value
parts = value.split(/,\s*/)
parts.each do |part|
- 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
Avoid deeply nested control flow statements. Open
if node.name == "id"
# ID needs to be pulled from the Journal table
node.relation = Journal.arel_table
node.name = "journable_id"
else
Method set_templated_description
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_templated_description
# We only set this if the work package is new
return unless work_package.new_record?
# And the type was 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 prepareInputFromFactory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
prepareInputFromFactory: function (input, fieldId, fieldName, fieldOrder, maxTabIndex, fieldEditable) {
Method set_default_requested_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_default_requested_attributes # rubocop:disable Metrics/AbcSize,Metrics/PerceivedComplexity
model.requested_login_attribute ||= first_mapping(Saml::Defaults::MAIL_MAPPING)
model.requested_mail_attribute ||= first_mapping(Saml::Defaults::MAIL_MAPPING)
model.requested_firstname_attribute ||= first_mapping(Saml::Defaults::FIRSTNAME_MAPPING)
model.requested_lastname_attribute ||= first_mapping(Saml::Defaults::LASTNAME_MAPPING)
- 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 Reporting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
window.Reporting = (function($) {
var onload = function (func) {
$(document).ready(func);
};
- 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 page_param
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def page_param(options = params)
page = if options[:page]
options[:page].to_i
elsif options[:offset] && options[:limit]
begin
- 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 csv_row
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def csv_row(work_package)
return super unless with_descriptions
super.tap do |row|
if row.any?
- 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 allowed_values_subset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def allowed_values_subset
grid_configs_of_values
.filter_map do |value, config|
next unless config && config[:class]
- 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
Avoid deeply nested control flow statements. Open
elsif days >= days_per_month
months = (days / days_per_month).to_i
days = (days % days_per_month).to_i
Function drop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async drop(el:Element, target:Element, _source:Element|null, _sibling:Element|null) {
const dropUrl = el.getAttribute('data-drop-url');
let targetPosition = Array.from(target.children).indexOf(el);
if (target.children.length > 0 && target.children[0].getAttribute('data-empty-list-item') === 'true') {
- 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_hours
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_hours
s = dup
s.strip!
if s =~ %r{^(\d+([.,]\d+)?)h?$}
s = $1
- 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 destroy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def destroy
render_404 and return unless @cost_entry
render_403 and return unless @cost_entry.editable_by?(User.current)
@cost_entry.destroy
- 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
Avoid deeply nested control flow statements. Open
if days >= days_per_week
weeks = (days / days_per_week).to_i
days = (days % days_per_week).to_i
if weeks >= FULL_WEEKS_PER_MONTH
months = (weeks / FULL_WEEKS_PER_MONTH).to_i
Function untouchFieldsWhenWorkIsEdited
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private untouchFieldsWhenWorkIsEdited() {
if (this.areBothTouched('remaining_hours', 'done_ratio')) {
if (this.isValueEmpty('done_ratio') && this.isValueEmpty('remaining_hours')) {
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 batch_aware_status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def batch_aware_status
batch = GoodJob::Job.find_by(id: represented.job_id)&.batch
return represented.status unless batch
unless batch.finished?
- 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"