pmahoney/process_shared

View on GitHub

Showing 6 of 6 total issues

Class SharedMemoryIO has 62 methods (exceeds 20 allowed). Consider refactoring.
Open

  class SharedMemoryIO

    attr_accessor :pos
    attr_reader :mem

Severity: Major
Found in lib/process_shared/shared_memory_io.rb - About 1 day to fix

    Method error_check_bootstrap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.error_check_bootstrap(*syms, &is_err)
          unless block_given?
            is_err = lambda { |v| (v != KERN_SUCCESS) }
          end
    
    
    Severity: Minor
    Found in lib/mach/functions.rb - About 1 hr 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(type_or_count = 1, count = 1)
          super(type_or_count, count)
    
          # See https://github.com/ffi/ffi/issues/118
          ffi_type = FFI.find_type(self.type)
    Severity: Minor
    Found in lib/process_shared/shared_array.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 try_wait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def try_wait(timeout = nil)
            secs = timeout ? timeout : 0
            begin
              # TODO catch and convert exceptions...
              timedwait(secs)
    Severity: Minor
    Found in lib/process_shared/mach/semaphore.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 error_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def error_check(*syms, &is_err)
            unless block_given?
              is_err = lambda { |v| (v == -1) }
            end
    
    
    Severity: Minor
    Found in lib/process_shared/posix/errno.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 error_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.error_check(*syms, &is_err)
          unless block_given?
            is_err = lambda { |v| (v != KERN_SUCCESS) }
          end
    
    
    Severity: Minor
    Found in lib/mach/functions.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