Showing 4 of 107 total issues

Class Client has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Client
    attr_reader :version

    def initialize(options)
      @base_url   = options.fetch(:url)
Severity: Minor
Found in lib/dhis2/client.rb - About 5 hrs to fix

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

            def fetch_paginated_data(client, params = {}, options = {})
              raise InvalidMethodError, "this collection is not paginated" unless paginated
              options = { raw: false, with_pager: false }.merge(options)
              Enumerator.new do |yielder|
                params[:page] ||= 1
    Severity: Minor
    Found in lib/dhis2/api/listable.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 deep_change has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.deep_change(obj, type)
          raise CaseError, deep_change_error(type) unless SUPPORTER_CASE_CHANGES.include?(type)
          case obj
          when Array then obj.map { |v| deep_change(v, type) }
          when Hash
    Severity: Minor
    Found in lib/dhis2/case.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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(method_name:, url:, query_params: {}, payload: nil, raw: false, raw_input: false)
          computed_payload = compute_payload(payload, raw_input)
    
          start_tracking = Process.clock_gettime(Process::CLOCK_MONOTONIC)
          raw_response = RestClient::Request.execute(
    Severity: Minor
    Found in lib/dhis2/client.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