greglook / cljstyle

A tool for formatting Clojure code
Eclipse Public License 1.0
293 stars 39 forks source link

Bug: blank error message for a missing newline at end of file #48

Closed roryokane closed 4 years ago

roryokane commented 4 years ago

Problem

If I accidentally edit a file so it has no newline, cljstyle check reports the problem like this:


1 files formatted incorrectly

That’s the whole output.

I was able to use cljstyle check --verbose to find the file the problem was in, parser.cljc, but the output still didn’t communicate the actual problem:

Using default cljstyle configuration for .
Source file src/cljsjs/marked.cljs is formatted correctly
[…]
Source file src/cljs/athens/core.cljs is formatted correctly
Source file src/cljc/athens/parser.cljc is formatted incorrectly

Source file src/cljs/athens/page.cljs is formatted correctly
[…]
{:files {:unrelated 9620, :correct 22, :incorrect 1}, :total 9643, :elapsed 544.152959}
Checked 9643 files in 544 ms
  9620 unrelated
    22 correct
     1 incorrect
1 files formatted incorrectly

I was only able to figure out this was a newline problem by running cljstyle fix and checking git diff.

I’m using cljstyle 0.12.1, installed with brew cask install cljstyle.

Expected result

Since cljstyle check normally reports differences as diffs, I would expect the output to be more like this:

--- a/src/cljc/athens/parser.cljc
+++ b/src/cljc/athens/parser.cljc
@@ -62,4 +62,4 @@
 (defn parse-to-ast
   "Converts a string of block syntax to an abstract syntax tree for Athens markup."
   [string]
-  (transform-to-ast (block-parser string)))
\ No newline at end of file
+  (transform-to-ast (block-parser string)))
1 files formatted incorrectly
greglook commented 4 years ago

Thanks for reporting this, it should definitely be printing out something for these errors. 🤔