Permalink
Browse files

Debugging while testing contrib libs

  • Loading branch information...
1 parent de6a813 commit 86f62dabdc512b442ab3774667f70db65fcdfec8 @jonase committed Jan 15, 2012
Showing with 27 additions and 14 deletions.
  1. +14 −7 project.clj
  2. +7 −5 src/eastwood/core.clj
  3. +3 −1 src/eastwood/linters/reflection.clj
  4. +1 −1 src/eastwood/linters/unused.clj
  5. +2 −0 src/eastwood/util.clj
View
@@ -3,18 +3,25 @@
:dependencies [[org.clojure/clojure "1.3.0"]
[analyze "0.1.3-SNAPSHOT"]
- ;; OK - reflection warnings
+ ;; clojure.data.json OK
#_[org.clojure/data.json "0.1.1"]
- ;; OK
+
+ ;; clojure.core.match: lots of reflection warnings -- eastwood fault
#_[org.clojure/core.match "0.2.0-alpha8"]
- ;; OK. found stuff.
+
+ ;; clojure.core.logic: 2x misplaced docstrings, subst? never used + lots of reflection
#_[org.clojure/core.logic "0.6.7"]
- ;; OK
+
+ ;; clojure.data.finger-tree: lots of reflection
#_[org.clojure/data.finger-tree "0.0.1"]
- ;; OK
+
+ ;; clojure.tools.logging: OK
#_[org.clojure/tools.logging "0.2.3"]
- ;; OK, using deprecated replicate + naked use.
+
+ ;; clojure.java.jdbc: using deprecated replicate + naked use.
+ ;; clojure.java.jdbc.internal: reflection getCause
#_[org.clojure/java.jdbc "0.1.1"]
- ;; OK
+
+ ;; clojure.data.csv: OK
#_[org.clojure/data.csv "0.1.0"]
])
View
@@ -23,20 +23,22 @@
;; :non-dynamic-earmuffs misc/non-dynamic-earmuffs ; checked by compiler
:reflection reflection/reflection
:deprecations deprecated/deprecations
- :unused-locals unused/unused-locals
+ :unused-locals unused/unused-locals ; Currently too slow to be practical
:unused-private-vars unused/unused-private-vars})
(def ^:private all-linters (set (keys linters)))
(defn- lint [exprs kw]
+ (println "==" kw "==")
((linters kw) exprs))
(defn lint-ns [ns-sym & {:keys [only exclude]
- :or {only all-linters
+ :or {only (disj all-linters :unused-locals)
exclude nil}}]
- (let [namespaces (set/difference (set only) (set exclude))
+ (let [linters (set/difference (set only) (set exclude))
exprs (analyze ns-sym)]
- (doseq [ns namespaces]
- (lint exprs ns))))
+ (doseq [linter linters]
+ (lint exprs linter))))
;(lint-ns 'brittle.core)
+
@@ -27,5 +27,7 @@
(defn reflection [exprs]
(doseq [expr (mapcat expr-seq exprs)
- :when (reflective-call? expr)]
+ :when (and (reflective-call? expr)
+ (not (= "__methodImplCache"
+ (:field-name expr))))]
(report expr)))
@@ -55,5 +55,5 @@
(let [pdefs (private-defs exprs)
vfreq (var-freq exprs)]
(doseq [pvar pdefs
- :when (nil? (vfreq pdefs))]
+ :when (nil? (vfreq pvar))]
(println "Private var" pvar "is never used"))))
View
@@ -1,6 +1,8 @@
(ns eastwood.util
(:require [clojure.set :as set]))
+;; TODO: Profile!
+
(defn local-bindings [expr]
(condp = (:op expr)
:fn-method (if-let [rest-param (:rest-param expr)]

0 comments on commit 86f62da

Please sign in to comment.