buren/wayback_archiver

View on GitHub

Showing 6 of 6 total issues

Method get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def self.get(
      uri,
      max_redirects: MAX_REDIRECTS,
      raise_on_http_error: false,
      follow_redirects: true
Severity: Minor
Found in lib/wayback_archiver/request.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 urls has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.urls(url: nil, xml: nil, visited: Set.new)
      if visited.include?(url)
        WaybackArchiver.logger.debug "Already visited #{url} skipping.."
        return []
      end
Severity: Minor
Found in lib/wayback_archiver/sitemapper.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 get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.get(
      uri,
      max_redirects: MAX_REDIRECTS,
      raise_on_http_error: false,
      follow_redirects: true
Severity: Minor
Found in lib/wayback_archiver/request.rb - About 1 hr to fix

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

        def self.autodiscover(url)
          WaybackArchiver.logger.info 'Looking for Sitemap(s) in /robots.txt'
          robots = Robots.new(WaybackArchiver.user_agent)
          sitemaps = robots.other_values(url)['Sitemap']
    
    
    Severity: Minor
    Found in lib/wayback_archiver/sitemapper.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 post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.post(urls, concurrency: WaybackArchiver.concurrency, limit: WaybackArchiver.max_limit)
          WaybackArchiver.logger.info "Total URLs to be sent: #{urls.length}"
          WaybackArchiver.logger.info "Request are sent with up to #{concurrency} parallel threads"
    
          urls_queue = if limit == -1
    Severity: Minor
    Found in lib/wayback_archiver/archive.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 crawl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.crawl(source, hosts: [], concurrency: WaybackArchiver.concurrency, limit: WaybackArchiver.max_limit)
          WaybackArchiver.logger.info "Request are sent with up to #{concurrency} parallel threads"
    
          posted_urls = Concurrent::Array.new
          pool = ThreadPool.build(concurrency)
    Severity: Minor
    Found in lib/wayback_archiver/archive.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