<commit_before>(ns qualityclj.routes.home
  (:require [qualityclj.views.layout :as layout]
            [clojure.java.io :as io]
            [clygments.core :refer [highlight]]
            [compojure.core :refer :all]))

#_(defn read-kibit-report-from-file
  "Reads in a plain-text kibit-report-to-file."
  [file]
  (with-open [rdr (io/reader (io/resource file))]
    (doseq [line (line-seq rdr)]
      (println line))))

#_(defn write-kibit-report-to-file
  "Write a check-map in plain text to specified file."
  [output-file check-map]
  (let [{:keys [file line expr alt]} check-map]
    (with-open [wrtr (io/writer (io/file output-file))]
      (.write wrtr (pr-str check-map))
      (.write wrtr (str "\n")))))

#_(defn run-kibit-over-file
  "Run kibit over the provided source file and output to the provided
  file location. For now, both must be located in resources"
  [source-file output-file]
  (check/check-file (io/resource source-file)
                    :reporter (partial write-kibit-report-to-file
                                       (io/resource output-file))))

(defn clygmatize [source-file]
  (highlight (slurp (io/resource source-file)) :clojure :html))

(defn home []
  (layout/common
   [:div#jumbo]
   [:div.container-fluid
    [:h2 "Sample"]]
   [:div#file-header.container-fluid]
   [:div.container-fluid
    [:div.row
     [:div#source.col-xs-8 (clygmatize "analyze/prob5.clj")]
     [:div#notes.col-xs-4]]]))

(defn about []
  (layout/common
   [:div#header.container-fluid
    [:h2 "About"]
    [:p "Quality Clojure will take a Clojure git repository, import it
    into Codeq, and run a series of linters against it. The linters
    include kibit, eastwood, and bikeshed. There's also the capability
    to add user comments to different parts of the file, or to other
    notes generated by a linter. Users can flag a note or comment for
    various reasons as well."]
    [:p "Quality Clojure was envisioned as a contender for the 2014
   Clojure Cup, but sadly was not finished in time to show off! The
   team plans on completing the work that they've started, but in the
   meantime, the main page shows an example of what Quality Clojure
   might eventually look like."]
    [:p "This site is (mostly) static, aside from the front-end
    Clojurescript adding information about the file displayed on the
    main page, and putting the note bubbles in the approximately
    correct location."]]  ))

(defroutes home-routes
  (GET "/" [] (home))
  (GET "/about" [] (about)))
<commit_msg>Remove the rest of the clygments code.<commit_after>(ns qualityclj.routes.home
  (:require [qualityclj.views.layout :as layout]
            [clojure.java.io :as io]
            [compojure.core :refer :all]))

#_(defn read-kibit-report-from-file
  "Reads in a plain-text kibit-report-to-file."
  [file]
  (with-open [rdr (io/reader (io/resource file))]
    (doseq [line (line-seq rdr)]
      (println line))))

#_(defn write-kibit-report-to-file
  "Write a check-map in plain text to specified file."
  [output-file check-map]
  (let [{:keys [file line expr alt]} check-map]
    (with-open [wrtr (io/writer (io/file output-file))]
      (.write wrtr (pr-str check-map))
      (.write wrtr (str "\n")))))

#_(defn run-kibit-over-file
  "Run kibit over the provided source file and output to the provided
  file location. For now, both must be located in resources"
  [source-file output-file]
  (check/check-file (io/resource source-file)
                    :reporter (partial write-kibit-report-to-file
                                       (io/resource output-file))))

(defn home []
  (layout/common
   [:div#jumbo]
   [:div.container-fluid
    [:h2 "Sample"]]))

(defn about []
  (layout/common
   [:div#header.container-fluid
    [:h2 "About"]
    [:p "Quality Clojure will take a Clojure git repository, import it
    into Codeq, and run a series of linters against it. The linters
    include kibit, eastwood, and bikeshed. There's also the capability
    to add user comments to different parts of the file, or to other
    notes generated by a linter. Users can flag a note or comment for
    various reasons as well."]
    [:p "Quality Clojure was envisioned as a contender for the 2014
   Clojure Cup, but sadly was not finished in time to show off! The
   team plans on completing the work that they've started, but in the
   meantime, the main page shows an example of what Quality Clojure
   might eventually look like."]
    [:p "This site is (mostly) static, aside from the front-end
    Clojurescript adding information about the file displayed on the
    main page, and putting the note bubbles in the approximately
    correct location."]]  ))

(defroutes home-routes
  (GET "/" [] (home))
  (GET "/about" [] (about)))

{'fraction_non_alphanumeric': 0.11423771524569509, 'fraction_numerical': 0.003149937001259975, 'mean_word_length': 2.989112227805695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4872876', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1502, 'n_words': 549}