Skip to content

Commit

Permalink
Use platform-independent newline separator in reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcompton committed Feb 11, 2018
1 parent c2d5e48 commit 4a04da2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions kibit/src/kibit/reporters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
(->> (str string-writer)
string/split-lines
(map #(str " " %))
(string/join "\n")
(string/join (System/getProperty "line.separator"))
println)))

(defn cli-reporter
"Print a check-map to `*out*` in plain text."
[check-map]
(let [{:keys [file line expr alt]} check-map]
(printf "At %s:%s:\nConsider using:\n" file line)
(printf "At %s:%s:%nConsider using:%n" file line)
(pprint-code alt)
(println "instead of:")
(pprint-code expr)
Expand All @@ -39,7 +39,7 @@
"Print a check-map to `*out*` in github flavored markdown."
[check-map]
(let [{:keys [file line expr alt]} check-map]
(printf "----\n##### `%s:%s`\nConsider using:\n" file line)
(printf "----%n##### `%s:%s`%nConsider using:%n" file line)
(println "```clojure")
(pprint-code alt)
(println "```")
Expand Down
5 changes: 0 additions & 5 deletions kibit/test/kibit/test/reporters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
[clojure.string :as string]
[clojure.test :refer :all]))

(defn- reported-lines [reporting]
(->> (clojure.string/split reporting #"\n")
(mapv #(clojure.string/replace % "\r" ""))
(filterv (complement clojure.string/blank?))))

(deftest plain
(are [check-map result]
(= (with-out-str (reporters/cli-reporter check-map))
Expand Down

2 comments on commit 4a04da2

@voytech
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielcompton Just to confirm - reporters tests pass on windows machine after those changes ;)

@danielcompton
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up!

Please sign in to comment.