Class CustomField
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class CustomField < ApplicationRecord
include Redmine::SafeAttributes
include Redmine::SubclassFactory
has_many :enumerations,
File custom_field.rb
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CustomField < ApplicationRecord
include Redmine::SafeAttributes
include Redmine::SubclassFactory
has_many :enumerations,
Method validate_custom_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_custom_value(custom_value)
value = custom_value.value
errs = format.validate_custom_value(custom_value)
unless errs.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 copy_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_from(arg, options={})
return if arg.blank?
custom_field = arg.is_a?(CustomField) ? arg : CustomField.find_by(id: arg.to_s)
self.attributes = custom_field.attributes.dup.except('id', 'name', 'position')
- 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 visibility_by_project_condition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def visibility_by_project_condition(project_key=nil, user=User.current, id_column=nil)
if visible? || user.admin?
"1=1"
elsif user.anonymous?
"1=0"
- 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"