elentras/dm_cloud

View on GitHub

Showing 5 of 5 total issues

Method embed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.embed(media_id, options = {}, security = {})
        raise StandardError, "missing :media_id in params" unless media_id
        
        skin_id = options[:skin_id] ? options[:skin_id]  : 'modern1'
        width   = options[:width]   ? options[:width].to_s    : '848'
Severity: Minor
Found in lib/dm_cloud/streaming.rb - About 45 mins to fix

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 sign has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.sign(stream, security_datas = nil)
      raise StandardError, "missing :stream in params" unless stream
      sec_level = security(DmCloud.config[:security_level])
      sec_data = security_data(DmCloud.config[:security_level], security_datas) unless security_datas.nil?

Severity: Minor
Found in lib/dm_cloud/signing.rb - About 45 mins to fix

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 info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.info(media_id, assets_names = ['source'], fields = {})
        raise StandardError, "missing :media_id in params" unless media_id
        request = Hash.new

        # the media id
Severity: Minor
Found in lib/dm_cloud/builder/media.rb - About 35 mins to fix

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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.url(media_id, asset_name, asset_extension = nil, security = {})
        raise StandardError, "missing :media_id in params" unless media_id
        raise StandardError, "missing :asset_name in params" unless asset_name
        asset_extension = asset_name.split('_').first unless asset_extension

Severity: Minor
Found in lib/dm_cloud/streaming.rb - About 25 mins to fix

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 self.create(url = '', assets_names = [], meta = {})
        request = Hash.new

        request['url'] = url

Severity: Minor
Found in lib/dm_cloud/builder/media.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language