kibit
kibit copied to clipboard
Run kibit on the same version of Clojure as the project
Certainly possible this is an issue with my environment, but I'm getting errors with Kibit parsing 0N. My project uses Clojure 1.3.0.
Here's the error:
➜ ~knockbox git:(master) lein plugin install jonase/kibit 0.0.2
[INFO] Unable to find resource 'jonase:kibit:jar:0.0.2' in repository central (http://repo1.maven.org/maven2)
Copying 4 files to /var/folders/yq/5r69gv8d0vz99cptvsj3bqvm0000gn/T/lein-f03139ec-689d-4f01-aa79-204128b507cb/lib
Including kibit-0.0.2.jar
Including clojure-1.3.0.jar
Including core.logic-0.6.7.jar
Including java.classpath-0.1.1.jar
Including tools.namespace-0.1.2.jar
Created jonase-kibit-0.0.2.jar
➜ ~knockbox git:(master) lein kibit
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
Reflection warning, clojure/core/logic.clj:1491 - call to invoke can't be resolved.
== knockbox.core ==
== knockbox.internal ==
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: clojure.lang.LispReader$ReaderException: java.lang.NumberFormatException: Invalid number: 0N (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: clojure.lang.LispReader$ReaderException: java.lang.NumberFormatException: Invalid number: 0N
at clojure.lang.LazySeq.sval(LazySeq.java:47)
at clojure.lang.LazySeq.seq(LazySeq.java:56)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.boundedLength(RT.java:1186)
at clojure.lang.RestFn.applyTo(RestFn.java:130)
at clojure.core$apply.invoke(core.clj:540)
at clojure.core$mapcat.doInvoke(core.clj:2122)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at jonase.kibit.core$check_file.invoke(core.clj:131)
at jonase.kibit.core$check_file.invoke(core.clj:128)
at leiningen.kibit$kibit$fn__2472.invoke(kibit.clj:16)
at leiningen.kibit$kibit.invoke(kibit.clj:15)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:259)
at leiningen.core$_main.doInvoke(core.clj:325)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:328)
at user$eval42.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more
Caused by: java.lang.RuntimeException: clojure.lang.LispReader$ReaderException: java.lang.NumberFormatException: Invalid number: 0N
at clojure.lang.LazySeq.sval(LazySeq.java:47)
at clojure.lang.LazySeq.seq(LazySeq.java:56)
at clojure.lang.RT.seq(RT.java:450)
at clojure.core$seq.invoke(core.clj:122)
at clojure.core$map$fn__3699.invoke(core.clj:2088)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
... 35 more
Caused by: clojure.lang.LispReader$ReaderException: java.lang.NumberFormatException: Invalid number: 0N
at clojure.lang.LispReader.read(LispReader.java:180)
at clojure.core$read.invoke(core.clj:2884)
at clojure.core$read.invoke(core.clj:2882)
at jonase.kibit.core$read_ns$fn__2450.invoke(core.clj:95)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
... 40 more
Caused by: java.lang.NumberFormatException: Invalid number: 0N
at clojure.lang.LispReader.readNumber(LispReader.java:218)
at clojure.lang.LispReader.read(LispReader.java:136)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1060)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.read(LispReader.java:145)
... 44 more
I just tried running kibit on knockbox on my machine and it all worked well. The reader syntax for BigInt was added in Clojure 1.3 and kibit will (currently) use whatever version of Clojure that Leiningen uses. If you update to Leiningen 2.0-preview2 you will be able to run kibit on your code base (note that the installation instructions for plugins differ).
Anyone knows how to use the version of Clojure that the project uses instead? Patch welcome :), since we'll hit this same issue when people start using the extensible reader found in Clojure 1.4.
It is well documented how to execute a task within the project itself. I will look into this over the weekend.
Aha! Thanks @jonase, I realized 0N wouldn't work prior to Clojure 1.3.0, but figured lein would use the version of clojure that my project.clj required. Thanks for the explanation.
@jonase it looks like Kibit can now run against Knockbox successfully.
This would be handy if it was combined with metadata on the rules. Then we could get the metadata from the rules (or the original functions), and only make suggestions for rules that are valid in a particular Clojure version.