jzeni/restool

View on GitHub

Showing 8 of 10 total issues

Method build_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def self.build_request(method, path, params, headers, basic_auth)
        if ['post', 'put', 'patch'].include?(method)
          request = build_base_request(method, path)

          if params && params.is_a?(Hash)
Severity: Minor
Found in lib/restool/service/request_utils.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 execute has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def self.execute(remote_client, operation, path, params, headers,
                      response_handler, representations, basic_auth)
Severity: Major
Found in lib/restool/service/remote_connector.rb - About 1 hr to fix

    Method config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.config
            return @config if @config
    
            files_to_load = Dir['config/restool/*.yml'] + Dir['config/restool/*.yaml'] + ['config/restool.yml', 'config/restool.yaml', 'config/restool.json']
    
    
    Severity: Minor
    Found in lib/restool/settings/loader.rb - About 55 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 make_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def make_request(path, method, request_params, headers, basic_auth)
    Severity: Minor
    Found in lib/restool/service/remote_client.rb - About 35 mins to fix

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

            def self.build_request(method, path, params, headers, basic_auth)
      Severity: Minor
      Found in lib/restool/service/request_utils.rb - About 35 mins to fix

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

            def initialize(http_request, method, path, params, headers)
        Severity: Minor
        Found in lib/restool/service/operation_request.rb - About 35 mins to fix

          Method log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def log(request, &http_request)
                log_request(request) if log?
                response = http_request.call
                log_response(response) if log?
          
          
          Severity: Minor
          Found in lib/restool/logger/request_logger.rb - About 35 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 map_response_to_representation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.map_response_to_representation(representation, request_response, object, representations)
                  representation.fields.each do |field|
                    value = request_response[field.key.to_s] || request_response[field.key.to_sym]
          
                    object.class.__send__(:attr_accessor, var_name(field))
          Severity: Minor
          Found in lib/restool/traversal/converter.rb - About 35 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