dblock/ruby-link-checker

View on GitHub

Showing 9 of 9 total issues

Method _handle_result has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _handle_result(result)
      @result = result
      retry_text = " (#{_retries_left_s})" if retry? && (result.error? || result.failure?)
      logger.info "#{' ' * (redirects.count - 1)}#{result}#{retry_text}"
      result! result
Severity: Minor
Found in lib/ruby-link-checker/tasks.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def execute!
      if retry?
        @retries_left -= 1
        retry! @result
        _queue_task(uri, method, original_uri || uri, options)
Severity: Minor
Found in lib/ruby-link-checker/tasks.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(uri, method, original_uri, request, response, options)
Severity: Minor
Found in lib/ruby-link-checker/net/http/result.rb - About 45 mins to fix

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

            def initialize(uri, method, original_uri, request, response, options)
    Severity: Minor
    Found in lib/ruby-link-checker/typhoeus/hydra/result.rb - About 45 mins to fix

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

          def initialize(checker, task_klass, uri, methods, options = {})
      Severity: Minor
      Found in lib/ruby-link-checker/tasks.rb - About 35 mins to fix

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

            def initialize(uri, method, original_uri, error, options = {})
        Severity: Minor
        Found in lib/ruby-link-checker/result.rb - About 35 mins to fix

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

              def initialize(checker, uri, method, original_uri, options = {})
          Severity: Minor
          Found in lib/ruby-link-checker/task.rb - About 35 mins to fix

            Method to_s has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def to_s
                  status_s = if success?
                               'OK'
                             elsif failure?
                               'FAIL'
            Severity: Minor
            Found in lib/ruby-link-checker/result.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

            Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(options = {})
                  LinkChecker::Config::ATTRIBUTES.each do |key|
                    send("#{key}=", options[key] || LinkChecker.config.send(key))
                  end
                  raise ArgumentError, "Missing methods." if methods&.none?
            Severity: Minor
            Found in lib/ruby-link-checker/checker.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