code-lever/jeti-log

View on GitHub

Showing 4 of 6 total issues

Method initialize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(uri)

        open(uri, 'rb') do |file|
          lines = file.readlines.map(&:strip).group_by do |line|
            line.start_with?('#') ? :comments : :rows
Severity: Minor
Found in lib/jeti/log/file.rb - About 3 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 File has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

    class File

      attr_reader :name

      # Determines if the file at the given URI is a Jeti telemetry log file.
Severity: Minor
Found in lib/jeti/log/file.rb - About 2 hrs to fix

    Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initialize(uri)
    
            open(uri, 'rb') do |file|
              lines = file.readlines.map(&:strip).group_by do |line|
                line.start_with?('#') ? :comments : :rows
    Severity: Minor
    Found in lib/jeti/log/file.rb - About 1 hr to fix

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

          def self.build(file, clazz, device, primary, *others)
      Severity: Minor
      Found in lib/jeti/log/data/composite_dataset_builder.rb - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language