lib/fog/openstack/storage/models/file.rb
Class File
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class File < Fog::OpenStack::Model
identity :key, :aliases => 'name'
attribute :access_control_allow_origin, :aliases => ['Access-Control-Allow-Origin']
attribute :cache_control, :aliases => ['Cache-Control']
Method save
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def save(options = {})
requires :directory, :key
options['Cache-Control'] = cache_control if cache_control
options['Content-Type'] = content_type if content_type
options['Content-Disposition'] = content_disposition if content_disposition
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def copy(target_directory_key, target_file_key, options = {})
requires :directory, :key
options['Content-Type'] ||= content_type if content_type
options['Access-Control-Allow-Origin'] ||= access_control_allow_origin if access_control_allow_origin
options['Origin'] ||= origin if origin
- 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"