PoseBiz/stretcher

View on GitHub

Showing 6 of 6 total issues

Class Index has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Index < EsComponent
    attr_reader :server, :name, :logger

    def initialize(server, name, options={})
      @server = server
Severity: Minor
Found in lib/stretcher/index.rb - About 3 hrs to fix

    Method request has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def request(method, path=nil, params={}, body=nil, headers={}, options={}, &block)
    Severity: Major
    Found in lib/stretcher/es_component.rb - About 50 mins to fix

      Method request has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def request(method, path, params={}, body=nil, headers={}, options={}, &block)
      Severity: Major
      Found in lib/stretcher/server.rb - About 50 mins to fix

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

            def bulk_action(action, documents, options={})
              action=action.to_sym
              
              body = documents.reduce("") {|post_data, d_raw|
                d = Hashie::Mash.new(d_raw)
        Severity: Minor
        Found in lib/stretcher/index.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 check_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_response(res, options)
              if res.status >= 200 && res.status <= 299
                if(options[:mashify] && res.body.instance_of?(Hash))
                  Hashie::Mash.new(res.body)
                else
        Severity: Minor
        Found in lib/stretcher/server.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 build_client has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.build_client(uri_components, options={})
              http = Faraday.new(:url => uri_components) do |builder|
                builder.response :json, :content_type => /\bjson$/
        
                builder.request :json
        Severity: Minor
        Found in lib/stretcher/server.rb - About 25 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