artirix/artirix_data_models

View on GitHub

Showing 24 of 35 total issues

File model.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ArtirixDataModels
  module Model
    extend ActiveSupport::Concern

    included do
Severity: Minor
Found in lib/artirix_data_models/model.rb - About 6 hrs to fix

    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 ADMRegistry has 29 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class ArtirixDataModels::ADMRegistry
        @instance_mutex = Mutex.new
      
        def self.instance_mutex
          ArtirixDataModels::ADMRegistry.instance_variable_get :@instance_mutex
      Severity: Minor
      Found in lib/artirix_data_models/adm_registry.rb - About 3 hrs to fix

        Class BasicModelDAO has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ArtirixDataModels::BasicModelDAO
          include ArtirixDataModels::DAOConcerns::WithResponseAdaptors
          include ArtirixDataModels::WithADMRegistry
        
          attr_reader :model_name, :model_class, :paths_factory, :fake_mode_factory, :gateway_factory
        Severity: Minor
        Found in lib/artirix_data_models/daos/basic_model_dao.rb - About 3 hrs to fix

          Method build has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def build
                  model = self.model
                  null  = Naught.build do |config|
                    config.impersonate model
                    config.predicates_return false
          Severity: Major
          Found in lib/artirix_data_models/active_null.rb - About 2 hrs to fix

            File basic_model_dao.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class ArtirixDataModels::BasicModelDAO
              include ArtirixDataModels::DAOConcerns::WithResponseAdaptors
              include ArtirixDataModels::WithADMRegistry
            
              attr_reader :model_name, :model_class, :paths_factory, :fake_mode_factory, :gateway_factory
            Severity: Minor
            Found in lib/artirix_data_models/daos/basic_model_dao.rb - About 2 hrs to fix

              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

                Class EsCollection has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class EsCollection
                
                    DEFAULT_SIZE                = 10
                    CACHE_KEY_SECTION_SEPARATOR = '/'.freeze
                    CACHE_KEY_RESULT_SEPARATOR  = '\\'.freeze
                Severity: Minor
                Found in lib/artirix_data_models/es_collection.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 mock_gateway_response has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def mock_gateway_response(response:,
                                              method:,
                                              path:,
                                              body: nil,
                                              json_body: true,
                    Severity: Minor
                    Found in lib/artirix_data_models/spec_support/gateway_mock.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 locate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.locate(comparator, object, result = [])
                          if object.is_a?(::Enumerable)
                            if object.any? { |value| match_comparator?(value, comparator, object) }
                              result.push object
                            else # DO NOT LOOK DEEPER ONCE FOUND IF THE VALUE FOUND IS A HASH (this will prevent us from properly recognising nested aggregations)!
                    Severity: Minor
                    Found in lib/artirix_data_models/raw_aggregation_data_normaliser.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 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 get_cached_result has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def get_cached_result
                          return nil unless enabled?
                      
                          c = cache_read
                          return nil unless c.present?
                      Severity: Minor
                      Found in lib/artirix_data_models/cached_action_adaptor.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 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

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

                          def normalise_element(name, value)
                            return unless Hash === value
                      
                            if value.key?(:buckets)
                              add_normalised_buckets_element_to_list(name, value)
                      Severity: Minor
                      Found in lib/artirix_data_models/raw_aggregation_data_normaliser.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 set_options_from_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.set_options_from_config(service)
                          options = ArtirixDataModels.configuration.try(:cache_options)
                          if options
                            options = options.to_hash if options.respond_to?(:to_hash) && !options.respond_to?(:each)
                            options.each do |name, opts|
                      Severity: Minor
                      Found in lib/artirix_data_models/cache_service.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

                      Severity
                      Category
                      Status
                      Source
                      Language