<commit_before>module Jekyll
  module Commands
    class Doctor < Command
      class << self
        def process(options)
          site = Jekyll::Site.new(options)
          site.read

          if unhealthy(site)
            abort
          else
            Jekyll.logger.info "Your test results", "are in. Everything looks fine."
          end
        end

        def unhealthy(site)
          [
            deprecated_relative_permalinks(site),
            conflicting_urls(site)
          ].any?
        end

        def deprecated_relative_permalinks(site)
          contains_deprecated_pages = false
          site.pages.each do |page|
            if page.uses_relative_permalinks
              Jekyll.logger.warn "Deprecation:", "'#{page.path}' uses relative" +
                                  " permalinks which will be deprecated in" +
                                  " Jekyll v1.2 and beyond."
              contains_deprecated_pages = true
            end
          end
          contains_deprecated_pages
        end

        def conflicting_urls(site)
          conflicting_urls = false
          urls = {}
          urls = collect_urls(urls, site.pages, site.dest)
          urls = collect_urls(urls, site.posts, site.dest)
          urls.each do |url, paths|
            if paths.size > 1
              conflicting_urls = true
              Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" +
                " for the following pages: #{paths.join(", ")}"
            end<commit_msg>Use Doctor#healthy? and ensure _all_ items are checked before process quits.<commit_after>module Jekyll
  module Commands
    class Doctor < Command
      class << self
        def process(options)
          site = Jekyll::Site.new(options)
          site.read

          if healthy?(site)
            Jekyll.logger.info "Your test results", "are in. Everything looks fine."
          else
            abort
          end
        end

        def healthy?(site)
          [
            !deprecated_relative_permalinks(site),
            !conflicting_urls(site)
          ].all?
        end

        def deprecated_relative_permalinks(site)
          contains_deprecated_pages = false
          site.pages.each do |page|
            if page.uses_relative_permalinks
              Jekyll.logger.warn "Deprecation:", "'#{page.path}' uses relative" +
                                  " permalinks which will be deprecated in" +
                                  " Jekyll v1.2 and beyond."
              contains_deprecated_pages = true
            end
          end
          contains_deprecated_pages
        end

        def conflicting_urls(site)
          conflicting_urls = false
          urls = {}
          urls = collect_urls(urls, site.pages, site.dest)
          urls = collect_urls(urls, site.posts, site.dest)
          urls.each do |url, paths|
            if paths.size > 1
              conflicting_urls = true
              Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" +
                " for the following pages: #{paths.join(", ")}"
            end
{'fraction_non_alphanumeric': 0.07993579454253612, 'fraction_numerical': 0.0019261637239165329, 'mean_word_length': 1.5210355987055015, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5298532', 'n_tokens_mistral': 826, 'n_tokens_neox': 832, 'n_words': 211}