jonase / eastwood

Clojure lint tool
1.09k stars 66 forks source link

Unknown error while linting tools.reader #413

Closed frenchy64 closed 3 years ago

frenchy64 commented 3 years ago

If you try and lint https://github.com/clojure/tools.reader/commit/3b0211b3504e9a8e321bfaa16fe6d5f517fa44be you get the following error:

== Eastwood 0.9.4 Clojure 1.10.0-master-SNAPSHOT JVM 16.0.1 ==
Unknown error: {:type :reader-exception, :ex-kind :reader-error}
Subprocess failed (exit code: 1)

It has something to do with reading an octal number in this file: https://github.com/clojure/tools.reader/blob/3b0211b3504e9a8e321bfaa16fe6d5f517fa44be/src/test/clojure/clojure/tools/common_tests.clj

To work around this in my tools.reader fork, I inlined this file instead of loading it. It would be nice if eastwood gave a little more information, like the specific exception and/or file.

vemv commented 3 years ago

Cheers for the report, I'll make sure to add tools.reader to the git submodules we lint as part of Eastwood's CI pipeline

frenchy64 commented 3 years ago

Turns out by inlining the file, you get a better error message from eastwood. This is the offending line:

https://github.com/clojure/tools.reader/blob/3b0211b3504e9a8e321bfaa16fe6d5f517fa44be/src/test/clojure/clojure/tools/common_tests.clj#L223

These values fail to be read: "\340", "\377".

This is the new error on my fork:

Trace ```clojure == Linting typed-test.clj.reader == Unknown error: [#error { :cause "typed_test/clj/reader.clj [line 245, col 15] Octal escape sequence must be in range [0, 377]." :data {:type :reader-exception, :ex-kind :reader-error, :file "typed_test/clj/reader.clj", :line 245, :col 15} :via [{:type clojure.lang.ExceptionInfo :message "typed_test/clj/reader.clj [line 245, col 15] Octal escape sequence must be in range [0, 377]." :data {:type :reader-exception, :ex-kind :reader-error, :file "typed_test/clj/reader.clj", :line 245, :col 15} :at [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_ex invokeStatic "errors.clj" 34]}] :trace [[eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_ex invokeStatic "errors.clj" 34] [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_ex doInvoke "errors.clj" 24] [clojure.lang.RestFn invoke "RestFn.java" 442] [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$reader_error invokeStatic "errors.clj" 40] ools.reader.impl.errors$reader_error doInvoke "errors.clj" 36] [clojure.lang.RestFn invoke "RestFn.java" 423] [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_bad_octal_number invokeStatic "errors.clj" 158] [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_bad_octal_number invoke "errors.clj" 157] [eastwood.copieddeps.dep10.clojure.tools.reader$escape_char invokeStatic "reader.clj" 287] [eastwood.copieddeps.dep10.clojure.tools.reader$escape_char invoke "reader.clj" 270] [eastwood.copieddeps.dep10.clojure.tools.reader$read_string_STAR_ invokeStatic "reader.clj" 297] [eastwood.copieddeps.dep10.clojure.tools.reader$read_string_STAR_ invoke "reader.clj" 291] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905] [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invokeStatic "reader.clj" 196] clojure.tools.reader$read_delimited invoke "reader.clj" 189] [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invokeStatic "reader.clj" 207] [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invoke "reader.clj" 203] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905] [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invokeStatic "reader.clj" 196] [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invoke "reader.clj" 189] [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invokeStatic "reader.clj" 207] [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invoke "reader.clj" 203] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905] imited invokeStatic "reader.clj" 196]tools.reader$read_del [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invoke "reader.clj" 189] [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invokeStatic "reader.clj" 207] [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invoke "reader.clj" 203] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924] [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905] [eastwood.copieddeps.dep10.clojure.tools.reader$read invokeStatic "reader.clj" 973] [eastwood.copieddeps.dep10.clojure.tools.reader$read invoke "reader.clj" 950] [eastwood.analyze_ns$analyze_file invokeStatic "analyze_ns.clj" 388] [eastwood.analyze_ns$analyze_file doInvoke "analyze_ns.clj" 314] [clojure.lang.RestFn invoke "RestFn.java" 486] [eastwood.analyze_ns$analyze_ns$fn__5089 invoke "analyze_ns.clj" 514] [eastwood.analyze_ns$with_form_writers invokeStatic "analyze_ns.clj" 104] form_writers invoke "analyze_ns.clj" 102] [eastwood.analyze_ns$analyze_ns invokeStatic "analyze_ns.clj" 509] [eastwood.analyze_ns$analyze_ns doInvoke "analyze_ns.clj" 487] [clojure.lang.RestFn invoke "RestFn.java" 439] [eastwood.lint$lint_ns invokeStatic "lint.clj" 321] [eastwood.lint$lint_ns invoke "lint.clj" 300] [eastwood.lint$lint_namespace invokeStatic "lint.clj" 546] [eastwood.lint$lint_namespace invoke "lint.clj" 544] [eastwood.lint$eval8058$fn__8060$fn__8062 invoke "lint.clj" 569] [clojure.lang.PersistentVector reduce "PersistentVector.java" 343] [clojure.core$reduce invokeStatic "core.clj" 6829] [clojure.core$reduce invoke "core.clj" 6812] [eastwood.lint$eval8058$fn__8060 invoke "lint.clj" 567] [clojure.lang.MultiFn invoke "MultiFn.java" 252] [eastwood.lint$eastwood_core invokeStatic "lint.clj" 630] [eastwood.lint$eastwood_core invoke "lint.clj" 590] [eastwood.lint$eastwood invokeStatic "lint.clj" 738] [eastwood.lint$eastwood invoke "lint.clj" 718] [eastwood.lint$eastwood invokeStatic "lint.clj" 719] [eastwood.lint$eastwood invoke "lint.clj" 718] [eastwood.lint$eastwood_from_cmdline invokeStatic "lint.clj" 750] [eastwood.lint$eastwood_from_cmdline invoke "lint.clj" 749] [eastwood.lint$_main invokeStatic "lint.clj" 886] [eastwood.lint$_main doInvoke "lint.clj" 859] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.core$apply invokeStatic "core.clj" 667] [clojure.main$main_opt invokeStatic "main.clj" 514] [clojure.main$main_opt invoke "main.clj" 510] [clojure.main$main invokeStatic "main.clj" 664] [clojure.main$main doInvoke "main.clj" 616] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.main main "main.java" 40]]}] [clojure.main$main_opt invokeStatic "main.clj" 514] Stopped analyzing namespaces after typed-test.clj.reader due to exception thrown. 140 namespaces left unanalyzed. ```
vemv commented 3 years ago

Looks like a matter of backporting https://github.com/clojure/tools.reader/commit/d0e416e6ba2fd20396a1d2039fc1e13dd809c8ee

I should upgrade tools.reader if at hand (we have a funny way to bundle it)

Thanks again!

vemv commented 3 years ago

0.9.6 is out 🚀