artirix/artirix_data_models

View on GitHub
lib/artirix_data_models/gateways/data_gateway.rb

Summary

Maintainability
D
2 days
Test Coverage

File data_gateway.rb has 367 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ArtirixDataModels::DataGateway
  attr_reader :connection, :post_as_json

  def initialize(connection: nil,
                 post_as_json: true,
Severity: Minor
Found in lib/artirix_data_models/gateways/data_gateway.rb - About 4 hrs to fix

    Method connect has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      def connect(method,
                  path:,
                  body: nil,
                  json_body: true,
                  timeout: nil,
    Severity: Minor
    Found in lib/artirix_data_models/gateways/data_gateway.rb - About 4 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 DataGateway has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ArtirixDataModels::DataGateway
      attr_reader :connection, :post_as_json
    
      def initialize(connection: nil,
                     post_as_json: true,
    Severity: Minor
    Found in lib/artirix_data_models/gateways/data_gateway.rb - About 2 hrs to fix

      Method connection has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def connection(config: {},
                           url: nil,
                           login: nil,
                           password: nil,
                           bearer_token: nil,
      Severity: Minor
      Found in lib/artirix_data_models/gateways/data_gateway.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 call has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def call(method,
                 path,
                 authorization_bearer: nil,
                 authorization_token_hash: nil,
                 body: nil,
      Severity: Minor
      Found in lib/artirix_data_models/gateways/data_gateway.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 call has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def call(method,
                 path,
                 authorization_bearer: nil,
                 authorization_token_hash: nil,
                 body: nil,
      Severity: Minor
      Found in lib/artirix_data_models/gateways/data_gateway.rb - About 1 hr to fix

        Method connect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def connect(method,
                      path:,
                      body: nil,
                      json_body: true,
                      timeout: nil,
        Severity: Minor
        Found in lib/artirix_data_models/gateways/data_gateway.rb - About 1 hr to fix

          Method parse_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def parse_response(result:, response_adaptor:, path:, method:, json_parse_response: true)
              if result.blank?
                parsed_response = nil
              elsif json_parse_response
                parsed_response = Oj.load result, symbol_keys: true
          Severity: Minor
          Found in lib/artirix_data_models/gateways/data_gateway.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(*args)
                case args.size
                when 0
                  message = nil
                  options = {}
          Severity: Minor
          Found in lib/artirix_data_models/gateways/data_gateway.rb - About 45 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