dmendel/bindata

View on GitHub
lib/bindata/sanitize.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Class SanitizedParameters has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  class SanitizedParameters < Hash
    # Memoized constants
    BIG_ENDIAN    = SanitizedBigEndian.new
    LITTLE_ENDIAN = SanitizedLittleEndian.new

Severity: Minor
Found in lib/bindata/sanitize.rb - About 2 hrs to fix

    File sanitize.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'bindata/registry'
    
    module BinData
    
      # Subclasses of this are sanitized
    Severity: Minor
    Found in lib/bindata/sanitize.rb - About 2 hrs to fix

      Method must_be_integer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def must_be_integer(*keys)
            keys.each do |key|
              if has_parameter?(key)
                parameter = self[key]
                unless Symbol === parameter ||
      Severity: Minor
      Found in lib/bindata/sanitize.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(choices, hints)
            @choices = {}
            choices.each_pair do |key, val|
              if SanitizedParameter === val
                prototype = val
      Severity: Minor
      Found in lib/bindata/sanitize.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(obj_type, obj_params, hints)
            raw_hints = hints.dup
            if raw_hints[:endian].respond_to?(:endian)
              raw_hints[:endian] = raw_hints[:endian].endian
            end
      Severity: Minor
      Found in lib/bindata/sanitize.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

      There are no issues that match your filters.

      Category
      Status