venantius / yagni

A Leiningen plugin for finding dead code
Eclipse Public License 1.0
219 stars 10 forks source link

Conditional read not allowed #37

Open jeaye opened 7 years ago

jeaye commented 7 years ago

Looks like yagni is choking on conditionals in cljc files. This isn't a CLJS project, as it's running on the JVM, but it shares code with someone that runs on CLJS. I know there's #26, but it seems like this could be solved without actually supporting CLJS, since it's more an issue of handling the reader conditional.

venantius commented 7 years ago

Yeah, Yagni's code predates reader conditionals IIRC. It's been a long time since I've touched the Yagni source so in practical terms this project is unmaintained. I'd be open to a PR.

nha commented 6 years ago

fixed by https://github.com/venantius/yagni/pull/43

AndreaCrotti commented 5 years ago

@nha I still get this error, but from my understanding reading the linked issue this should have been part of 0.1.6 already? (which is the version I'm using)

nha commented 5 years ago

@AndreaCrotti yes, it should be released as 0.1.6 After it was released I used it in boot-check ( https://github.com/tolitius/boot-check/pull/22#issue-212418446 ) and it worked fine in my project.

Maybe make sure that you don't have a different version between your ˜./lein/profile.clj and your project.clj?

AndreaCrotti commented 5 years ago

Mm I tried in another project as well but no it still fails for me, even after deleting my lein profile.clj file. Maybe it's still one of the dependencies that's the wrong version somehow?

These are the deps from one these two projects:

 [bidi "2.1.4"]
   [prismatic/schema "1.1.7" :exclusions [[org.clojure/tools.reader]]]
 [binaryage/devtools "0.9.10" :scope "test"]
   [binaryage/env-config "0.2.2" :scope "test"]
 [buddy/buddy-auth "2.1.0"]
   [clout "2.1.2"]
     [instaparse "1.4.0" :exclusions [[org.clojure/clojure]]]
   [funcool/cuerdas "2.0.3"]
 [buddy "2.0.0"]
   [buddy/buddy-core "1.4.0" :exclusions [[org.clojure/clojure]]]
     [org.bouncycastle/bcpkix-jdk15on "1.58"]
     [org.bouncycastle/bcprov-jdk15on "1.58"]
   [buddy/buddy-hashers "1.3.0" :exclusions [[org.clojure/clojure]]]
     [clojurewerkz/scrypt "1.2.0"]
       [com.lambdaworks/scrypt "1.4.0"]
   [buddy/buddy-sign "2.2.0" :exclusions [[org.clojure/clojure]]]
 [cider/piggieback "0.3.10" :scope "test"]
   [nrepl "0.4.4" :scope "test"]
 [clj-http "3.9.1"]
   [commons-codec "1.11" :exclusions [[org.clojure/clojure]]]
   [commons-io "2.6" :exclusions [[org.clojure/clojure]]]
   [org.apache.httpcomponents/httpasyncclient "4.1.3" :exclusions [[org.clojure/clojure]]]
     [org.apache.httpcomponents/httpcore-nio "4.4.6"]
   [org.apache.httpcomponents/httpclient-cache "4.5.5" :exclusions [[org.clojure/clojure]]]
   [org.apache.httpcomponents/httpclient "4.5.5" :exclusions [[org.clojure/clojure]]]
     [commons-logging "1.2"]
   [org.apache.httpcomponents/httpcore "4.4.9" :exclusions [[org.clojure/clojure]]]
   [org.apache.httpcomponents/httpmime "4.5.5" :exclusions [[org.clojure/clojure]]]
   [potemkin "0.4.5" :exclusions [[org.clojure/clojure]]]
     [clj-tuple "0.2.2"]
     [riddley "0.1.12"]
   [slingshot "0.12.2" :exclusions [[org.clojure/clojure]]]
 [cljs-ajax "0.8.0"]
   [com.cognitect/transit-cljs "0.8.256"]
     [com.cognitect/transit-js "0.8.846"]
 [cljs-http "0.1.45"]
   [noencore "0.3.3"]
   [org.clojure/core.async "0.3.442"]
     [org.clojure/tools.analyzer.jvm "0.7.0"]
       [org.clojure/core.memoize "0.5.9"]
         [org.clojure/core.cache "0.6.5"]
           [org.clojure/data.priority-map "0.0.7"]
       [org.clojure/tools.analyzer "0.6.9"]
       [org.ow2.asm/asm-all "4.2"]
 [cljsjs/classnames "2.2.5-1"]
 [cljsjs/moment "2.22.2-2"]
 [cljsjs/popperjs "1.14.3-1"]
 [cljsjs/prop-types "15.6.2-0"]
 [cljsjs/react-datepicker "1.5.0-0"]
 [cljsjs/react-dom "16.6.0-0"]
 [cljsjs/react-onclickoutside "6.7.1-1"]
 [cljsjs/react-popper "0.10.4-0"]
 [cljsjs/react "16.6.0-0"]
 [cljsjs/vega-lite "2.6.0-1"]
 [cljsjs/vega "4.3.0-0"]
 [clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
 [com.andrewmcveigh/cljs-time "0.5.2"]
 [com.bhauman/figwheel-main "0.1.9" :scope "test"]
   [com.bhauman/cljs-test-display "0.1.1" :scope "test"]
   [com.bhauman/figwheel-core "0.1.9" :scope "test"]
   [com.bhauman/figwheel-repl "0.1.9" :scope "test"]
     [co.deps/ring-etag-middleware "0.2.0" :scope "test"]
     [ring-cors "0.1.12" :scope "test"]
   [com.bhauman/spell-spec "0.1.1" :scope "test"]
   [expound "0.7.1" :scope "test"]
   [hawk "0.2.11" :scope "test"]
     [net.incongru.watchservice/barbary-watchservice "1.0" :scope "test"]
       [net.java.dev.jna/jna "3.2.2" :scope "test"]
   [org.eclipse.jetty.websocket/websocket-server "9.2.21.v20170120" :scope "test"]
     [org.eclipse.jetty.websocket/websocket-client "9.2.21.v20170120" :scope "test"]
     [org.eclipse.jetty.websocket/websocket-common "9.2.21.v20170120" :scope "test"]
       [org.eclipse.jetty/jetty-util "9.2.21.v20170120"]
     [org.eclipse.jetty/jetty-http "9.2.21.v20170120"]
     [org.eclipse.jetty/jetty-servlet "9.2.21.v20170120" :scope "test"]
       [org.eclipse.jetty/jetty-security "9.2.21.v20170120" :scope "test"]
   [org.eclipse.jetty.websocket/websocket-servlet "9.2.21.v20170120" :scope "test"]
     [org.eclipse.jetty.websocket/websocket-api "9.2.21.v20170120" :scope "test"]
 [com.bhauman/rebel-readline-cljs "0.1.4" :scope "test"]
   [cljs-tooling "0.2.0" :scope "test"]
   [com.bhauman/rebel-readline "0.1.4" :scope "test"]
     [cljfmt "0.5.7" :scope "test"]
     [compliment "0.3.6" :scope "test"]
     [org.jline/jline-reader "3.5.1" :scope "test"]
     [org.jline/jline-terminal-jansi "3.5.1" :scope "test"]
       [org.fusesource.jansi/jansi "1.16" :scope "test"]
     [org.jline/jline-terminal "3.5.1" :scope "test"]
 [com.cemerick/url "0.1.1"]
   [pathetic "0.5.0"]
     [com.cemerick/clojurescript.test "0.0.4"]
 [com.taoensso/timbre "4.10.0"]
   [com.taoensso/encore "2.91.0"]
     [com.taoensso/truss "1.5.0"]
   [io.aviso/pretty "0.1.33"]
 [day8.re-frame/http-fx "0.1.6"]
 [day8.re-frame/re-frame-10x "0.3.5" :scope "test"]
   [cljsjs/react-flip-move "2.9.17-0" :scope "test"]
   [cljsjs/react-highlight "1.0.7-1" :scope "test" :exclusions [[cljsjs/react]]]
     [cljsjs/highlight "9.6.0-0" :scope "test"]
   [zprint "0.4.7" :scope "test"]
     [rewrite-clj "0.6.0" :scope "test" :exclusions [[com.cemerick/austin]]]
     [rewrite-cljs "0.4.4" :scope "test" :exclusions [[org.clojure/clojurescript]]]
 [environ/environ.core "0.3.1"]
 [garden "1.3.6"]
   [com.yahoo.platform.yui/yuicompressor "2.4.8" :exclusions [[rhino/js]]]
 [hiccup "1.0.5"]
 [honeysql "0.9.4"]
   [net.cgrand/macrovich "0.2.1"]
 [junit "4.12"]
   [org.hamcrest/hamcrest-core "1.3"]
 [medley "1.0.0"]
 [metosin/ring-http-response "0.9.1"]
 [migratus "1.0.9"]
   [org.clojure/tools.logging "0.4.1"]
 [nilenso/honeysql-postgres "0.2.4"]
 [ns-tracker "0.3.1"]
   [org.clojure/java.classpath "0.2.3"]
   [org.clojure/tools.namespace "0.2.11"]
 [org.clojure/clojure "1.9.0"]
   [org.clojure/core.specs.alpha "0.1.24"]
 [org.clojure/clojurescript "1.10.439"]
   [com.cognitect/transit-clj "0.8.309" :exclusions [[org.clojure/clojure]]]
     [com.cognitect/transit-java "0.8.332"]
       [org.msgpack/msgpack "0.6.12"]
         [com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
         [org.javassist/javassist "3.18.1-GA"]
   [com.google.javascript/closure-compiler-unshaded "v20180805"]
     [args4j "2.0.26"]
     [com.google.code.findbugs/jsr305 "3.0.1"]
     [com.google.code.gson/gson "2.7"]
     [com.google.errorprone/error_prone_annotations "2.0.18"]
     [com.google.guava/guava "25.1-jre"]
       [com.google.j2objc/j2objc-annotations "1.1"]
       [org.checkerframework/checker-qual "2.0.0"]
       [org.codehaus.mojo/animal-sniffer-annotations "1.14"]
     [com.google.javascript/closure-compiler-externs "v20180805"]
     [com.google.jsinterop/jsinterop-annotations "1.0.0"]
     [com.google.protobuf/protobuf-java "3.0.2"]
   [org.clojure/data.json "0.2.6"]
   [org.clojure/google-closure-library "0.0-20170809-b9c14c6b"]
     [org.clojure/google-closure-library-third-party "0.0-20170809-b9c14c6b"]
   [org.clojure/tools.reader "1.3.0"]
   [org.mozilla/rhino "1.7R5"]
 [org.clojure/data.csv "0.1.4"]
 [org.clojure/java.jdbc "0.7.8"]
 [org.clojure/spec.alpha "0.2.176"]
 [org.clojure/test.check "0.9.0"]
 [org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]
 [org.postgresql/postgresql "42.2.5"]
 [org.webjars/font-awesome "5.5.0"]
 [prone "1.6.1"]
   [realize "1.1.0"]
 [re-com "2.3.0"]
 [re-frame "0.10.6"]
   [reagent "0.7.0"]
     [cljsjs/create-react-class "15.5.3-0"]
     [cljsjs/react-dom-server "15.5.4-0"]
 [reloaded.repl "0.2.4" :scope "test"]
   [com.stuartsierra/component "0.2.3" :scope "test"]
     [com.stuartsierra/dependency "0.1.1" :scope "test"]
   [suspendable "0.1.1" :scope "test"]
 [ring-oauth2 "0.1.4"]
   [clj-time "0.14.0"]
     [joda-time "2.9.7"]
 [ring/ring-defaults "0.3.2"]
   [javax.servlet/javax.servlet-api "3.1.0"]
   [ring/ring-anti-forgery "1.3.0"]
   [ring/ring-headers "0.3.0"]
   [ring/ring-ssl "0.3.0"]
 [ring/ring-json "0.4.0"]
   [cheshire "5.5.0"]
     [com.fasterxml.jackson.core/jackson-core "2.5.3"]
     [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.5.3"]
     [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.5.3"]
     [tigris "0.1.1"]
 [ring/ring-mock "0.3.2" :scope "test"]
   [ring/ring-codec "1.0.1"]
 [ring "1.7.0"]
   [ring/ring-core "1.7.0"]
     [commons-fileupload "1.3.3"]
     [crypto-equality "1.0.0"]
     [crypto-random "1.2.0"]
   [ring/ring-devel "1.7.0"]
     [clj-stacktrace "0.2.8"]
   [ring/ring-jetty-adapter "1.7.0"]
     [org.eclipse.jetty/jetty-server "9.2.24.v20180105"]
       [org.eclipse.jetty/jetty-io "9.2.24.v20180105"]
   [ring/ring-servlet "1.7.0"]
 [venantius/accountant "0.2.4"]
nha commented 5 years ago

@AndreaCrotti it looks like it could due to this line: https://github.com/venantius/yagni/blob/master/src/leiningen/yagni.clj#L10 Bumping the version for lein could be enough (and that would explain why it worked for me since I don't use lein)

AndreaCrotti commented 5 years ago

Yes that's it @nha I can run it in the repl as dependency, it's just the lein plugin that doesn't work. I could update that but then it would still need a new release right?

jeaye commented 5 years ago

Seems like that should be using environ or something, to automatically read the correct version from the project.clj. I'd expect this slip to happen again in the future, if left as-is.

venantius commented 5 years ago

Ehhhh, whoops! I've just updated it and bumped the release to 0.1.7. @AndreaCrotti can you please confirm that this works?