Skip to content

Commit

Permalink
Fix for #61
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Apr 8, 2019
1 parent e3a439c commit bf14173
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/clj_kondo/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[clj-kondo.impl.vars :refer [fn-call-findings]]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.stacktrace :refer [print-stack-trace]]
[clojure.string :as str
:refer [starts-with?
ends-with?]])
Expand All @@ -26,7 +25,11 @@
:when (if (= :debug type)
print-debug?
true)]
(println (str filename ":" row ":" col ": " (name level) ": " message))))
(try
(println (str filename ":" row ":" col ": " (name level) ": " message))
(catch Throwable e
(println "Could not print finding:" (str finding ".")
"Please report an issue.")))))

(defn- print-version []
(println (str "clj-kondo v" version)))
Expand Down Expand Up @@ -219,10 +222,13 @@ Options:
;;;; summary

(defn- summarize [findings]
(reduce (fn [acc fd]
(update acc (:level fd) inc))
{:error 0 :warning 0}
findings))
(try
(reduce (fn [acc fd]
(update acc (:level fd) inc))
{:error 0 :warning 0 :info 0}
findings)
(catch Throwable e
(println "Could not summarize findings. Please report an issue.") nil)))

;;;; main

Expand Down Expand Up @@ -266,7 +272,10 @@ Options:
(let [exit-code
(try (apply main options)
(catch Throwable e
(print-stack-trace e)
;; can't use clojure.stacktrace here, due to
;; https://dev.clojure.org/jira/browse/CLJ-2502
(println "Unexpected error. Please report an issue.")
(.printStackTrace e)
;; unexpected error
124))]
(flush)
Expand Down

0 comments on commit bf14173

Please sign in to comment.