whotwagner/mindwave

View on GitHub

Showing 7 of 22 total issues

Method parse_payload has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def parse_payload(payload)
    if not payload.instance_of?Array or payload.nil? or payload.length < 2
        raise "Invalid Argument"
    end

Severity: Major
Found in lib/mindwave.rb - About 4 hrs to fix

    File mindwave.rb has 297 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "mindwave/version"
    
    require 'serialport' 
    require 'bindata'
    require 'logger'
    Severity: Minor
    Found in lib/mindwave.rb - About 3 hrs to fix

      Method parse_payload has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse_payload(payload)
          if not payload.instance_of?Array or payload.nil? or payload.length < 2
              raise "Invalid Argument"
          end
      
      
      Severity: Minor
      Found in lib/mindwave.rb - About 2 hrs 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 run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def run
      
              tmpbyte = 0;
          @runner = true
      
      
      Severity: Minor
      Found in lib/mindwave.rb - About 2 hrs 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

      Class Headset has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Headset
      # -----------------------
      # :section: Request Codes
      # -----------------------
      
      
      Severity: Minor
      Found in lib/mindwave.rb - About 2 hrs to fix

        Method run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def run
        
                tmpbyte = 0;
            @runner = true
        
        
        Severity: Minor
        Found in lib/mindwave.rb - About 1 hr to fix

          Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def initialize(headsetid=nil,device='/dev/ttyUSB0', connectserial=true,rate=115200, log=Logger.new(STDOUT))
          Severity: Minor
          Found in lib/mindwave.rb - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language