Merge pull request #37 from tsdh/master

Use check-file instead of check-reader.
This commit is contained in:
Jonas Enlund 2012-05-31 06:30:25 -07:00
commit 710e67188a
3 changed files with 13 additions and 14 deletions

View file

@ -226,5 +226,5 @@
:rules rules
:guard guard
:resolution resolution)]
(reporter simplify-map)))))
(reporter (assoc simplify-map :file source-file))))))

View file

@ -28,9 +28,9 @@
(defn cli-reporter
"Print a check-map to `*out*`"
[check-map]
(let [{:keys [line expr alt]} check-map]
(do
(printf "[%s] Consider:\n" line)
(let [{:keys [file line expr alt]} check-map]
(do
(printf "At %s:%s:\nConsider using:\n" file line)
(pprint-code alt)
(println "instead of:")
(pprint-code expr)

View file

@ -11,15 +11,14 @@
(let [paths (or (:source-paths project) [(:source-path project)])
source-files (mapcat #(-> % io/file clj-ns/find-clojure-sources-in-dir) paths)]
(doseq [source-file source-files]
(with-open [reader (io/reader source-file)]
(printf "== %s ==\n" (or (second (clj-ns/read-file-ns-decl source-file)) source-file))
(try
(->> (kibit/check-reader reader)
#_(filter #(contains? % :alt))
(map reporters/cli-reporter)
doall)
(catch Exception e
(println "Check failed -- skipping rest of file")
(println (.getMessage e))))))))
(printf "== %s ==\n" (or (second (clj-ns/read-file-ns-decl source-file)) source-file))
(try
(->> (kibit/check-file source-file)
#_(filter #(contains? % :alt))
(map reporters/cli-reporter)
doall)
(catch Exception e
(println "Check failed -- skipping rest of file")
(println (.getMessage e)))))))