Showing 7 of 9 total issues
File windows_constants.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RubySerial
module Win32
extend FFI::Library
ffi_lib 'kernel32'
ffi_convention :stdcall
Method get_until_sep
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_until_sep(sep, limit)
sep = "\n\n" if sep == ''
# This allows the method signature to be (sep) or (limit)
(limit = sep; sep="\n") if sep.is_a? Integer
bytes = []
- 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 get_until_sep
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_until_sep(sep, limit)
sep = "\n\n" if sep == ''
# This allows the method signature to be (sep) or (limit)
(limit = sep; sep="\n") if sep.is_a? Integer
bytes = []
- 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 initialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(address, baude_rate=9600, data_bits=8, parity=:none, stop_bits=1)
file_opts = RubySerial::Win32::GENERIC_READ | RubySerial::Win32::GENERIC_WRITE
@fd = RubySerial::Win32.CreateFileA("\\\\.\\#{address}", file_opts, 0, nil, RubySerial::Win32::OPEN_EXISTING, 0, nil)
err = FFI.errno
if err != 0
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(address, baude_rate=9600, data_bits=8, parity=:none, stop_bits=1)
file_opts = RubySerial::Win32::GENERIC_READ | RubySerial::Win32::GENERIC_WRITE
@fd = RubySerial::Win32.CreateFileA("\\\\.\\#{address}", file_opts, 0, nil, RubySerial::Win32::OPEN_EXISTING, 0, nil)
err = FFI.errno
if err != 0
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(address, baude_rate=9600, data_bits=8, parity=:none, stop_bits=1)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(address, baude_rate=9600, data_bits=8, parity=:none, stop_bits=1)