Showing 329 of 2,363 total issues
Method authenticate_user_with_pam
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_user_with_pam(username, password)
# Check the username and password
return false unless File.exist? HAWK_CHKPWD
return false unless File.executable? HAWK_CHKPWD
return false if username.blank?
- 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 create
normalize_params! params[:location].permit!
@title = _('Create Location Constraint')
@location = Location.new params[:location].permit!
- 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 primitive_type_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def primitive_type_options(selected)
options = [].tap do |result|
::Primitive.options.each do |clazz, providers|
providers.each do |provider, types|
types.each do |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 generate_and_store_token_for_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_and_store_token_for_user(username)
api_token = SecureRandom.hex[0,12]
expiry_date = 1.month.from_now.to_i
# Store the username, token and expiry date in a yaml store
api_token_entry = ApiTokenEntry.new(username, api_token, expiry_date)
- 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 ensure_home_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_home_for(user)
old_home = ENV['HOME']
ENV['HOME'] = begin
require 'etc'
Etc.getpwnam(user)['dir']
- 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 unstring
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unstring(v, default = nil)
v ||= default
['true', 'false'].include?(v.class == String ? v.downcase : v) ? v.downcase == 'true' : v
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 fudge_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fudge_error(exitstatus, stderr)
if exitstatus == 0 && stderr.index("WARNING: Creating rsc_location constraint") && !stderr.index("ERROR")
# Special case for "crm resource migrate" with no node specified, to squash
# warning about persistent location constraint (remember my *sigh* in the
# comment above?)
- 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 err_lines
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def err_lines
err = []
begin
File.new(@errfile).read.split(/\n/).each do |e|
next if e.empty?
- 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 fields_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fields_for(record_name, record_object = nil, args = {}, &block)
unless options.fetch(:bootstrap, true)
return super
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"