Skip to content

Commit

Permalink
Fix rendering of JSON output
Browse files Browse the repository at this point in the history
`json` output now renders as JSON.
`json` & `sarif` output (both are JSON) now pretty-printed.

Closes #116
  • Loading branch information
lread committed Aug 22, 2024
1 parent a8a219f commit 1f3549e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

* Unreleased
* Fix: `--output json` now renders correctly & JSON output now pretty-printed [#116](https://github.com/clj-holmes/clj-watson/issues/116)

* v6.0.0 cb02879 -- 2024-08-20
* Fix: show score and severity in dependency-check findings [#58](https://github.com/clj-holmes/clj-watson/issues/58)
* Bump deps [#75](https://github.com/clj-holmes/clj-watson/issues/75)
Expand Down
4 changes: 2 additions & 2 deletions src/clj_watson/controller/output.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
(println (logic.template/generate {:vulnerable-dependencies dependencies} template))))

(defmethod ^:private generate* :json [dependencies & _]
(-> dependencies json/generate-string pprint/pprint))
(-> dependencies (json/generate-string {:pretty true}) println))

(defmethod ^:private generate* :edn [dependencies & _]
(pprint/pprint dependencies))

(defmethod ^:private generate* :sarif [dependencies deps-edn-path & _]
(-> dependencies (logic.sarif/generate deps-edn-path) json/generate-string println))
(-> dependencies (logic.sarif/generate deps-edn-path) (json/generate-string {:pretty true}) println))

(defn generate [dependencies deps-edn-path kind]
(generate* dependencies deps-edn-path kind))

0 comments on commit 1f3549e

Please sign in to comment.