Skip to content

Commit 1c31ab1

Browse files
solar05bbatsov
authored andcommitted
Fix kondo suggestions
1 parent 6fe6b58 commit 1c31ab1

File tree

13 files changed

+28
-41
lines changed

13 files changed

+28
-41
lines changed

.clj-kondo/config.edn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{:output {:progress true
2+
:exclude-files ["analysis.cljc" "meta.cljc"]}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ pom.xml.asc
1212
.cljs_nashorn_repl/
1313
nashorn_code_cache/
1414
.cljs_node_repl/
15+
.clj-kondo/.cache

src/orchard/eldoc.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
(map #(mapv str %) raw-arglists))
2222

2323
(defn- extract-ns-or-class
24-
[{:keys [ns class candidates] :as info}]
24+
[{:keys [ns class candidates]}]
2525
(cond
2626
ns {:ns (str ns)}
2727
class {:class [(str class)]}

src/orchard/info.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"Retrieve the info map from var and symbols."
33
(:refer-clojure :exclude [qualified-symbol?])
44
(:require
5-
[clojure.edn :as edn]
65
[clojure.java.io :as io]
76
[orchard.cljs.analysis :as cljs-ana]
87
[orchard.cljs.meta :as cljs-meta]
@@ -186,7 +185,7 @@
186185
(let [[resource-relative resource-full] (resource/resource-path-tuple path)]
187186
(merge {:file (or (file-path path) resource-full path)}
188187
;; Classpath-relative path if possible
189-
(if resource-relative
188+
(when resource-relative
190189
{:resource resource-relative}))))
191190

192191
(defn javadoc-info

src/orchard/inspect.clj

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"Evaluate the given expression where `v` is bound to the currently inspected
134134
value. Open the evaluation result in the inspector."
135135
[inspector expr]
136-
(let [{:keys [index path current-page page-size value]} inspector
136+
(let [{:keys [current-page value]} inspector
137137
eval-fn `(fn [~'v] ~(read-string expr))
138138
result ((eval eval-fn) value)]
139139
(-> (update inspector :stack conj value)
@@ -204,7 +204,7 @@
204204

205205
(defmulti inspect-value #'value-types)
206206

207-
(defmethod inspect-value nil [value]
207+
(defmethod inspect-value nil [_value]
208208
"nil")
209209

210210
(defmethod inspect-value :atom [value]
@@ -360,7 +360,7 @@
360360
inspector))
361361

362362
;; Inspector multimethod
363-
(defn known-types [ins obj]
363+
(defn known-types [_ins obj]
364364
(cond
365365
(nil? obj) :nil
366366
(map? obj) :coll
@@ -375,12 +375,12 @@
375375
(instance? List obj) :coll
376376
(instance? Map obj) :coll
377377
(.isArray (class obj)) :array
378-
:default (or (:inspector-tag (meta obj))
379-
(type obj))))
378+
:else (or (:inspector-tag (meta obj))
379+
(type obj))))
380380

381381
(defmulti inspect #'known-types)
382382

383-
(defmethod inspect :nil [inspector obj]
383+
(defmethod inspect :nil [inspector _obj]
384384
(-> inspector
385385
(render-ln "nil")))
386386

@@ -459,14 +459,6 @@
459459
(render-fields "Fields:" non-static)
460460
(render-fields "Static fields:" static)))))
461461

462-
(defn- render-class-section [inspector obj section]
463-
(let [method (symbol (str ".get" (name section)))
464-
elements (eval (list method obj))]
465-
(if (seq elements)
466-
`(~(name section) ": " (:newline)
467-
~@(mapcat (fn [f]
468-
`(" " (:value ~f) (:newline))) elements)))))
469-
470462
(defn- render-section [obj inspector section]
471463
(let [method (symbol (str ".get" (name section)))
472464
elements (eval (list method obj))]
@@ -517,7 +509,7 @@
517509
(render-ln inspector "Var: #'" ns "/" sym)
518510
(= type :expr)
519511
(render-ln inspector "Expr: " expr)
520-
:default
512+
:else
521513
inspector)))
522514

523515
(defn render-path [inspector]

src/orchard/java.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
(clojure.lang IPersistentMap)
1515
(clojure.reflect Constructor Field JavaReflector Method)
1616
(java.io File)
17-
(java.net JarURLConnection URI)))
17+
(java.net JarURLConnection)))
1818

1919
;;; ## Java Class/Member Info
2020
;;

src/orchard/java/classpath.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[orchard.misc :as misc])
1212
(:import
1313
(java.io File)
14-
(java.net URI URL)
14+
(java.net URL)
1515
(java.nio.file Paths)
1616
(java.util.jar JarFile JarEntry)))
1717

src/orchard/java/legacy_parser.clj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
(com.sun.javadoc ClassDoc ConstructorDoc Doc FieldDoc MethodDoc
99
Parameter RootDoc Tag Type)
1010
(com.sun.source.tree ClassTree)
11-
(com.sun.tools.javac.util Abort Context List Options)
11+
(com.sun.tools.javac.util Abort Context List)
1212
(com.sun.tools.javadoc DocEnv JavadocEnter JavadocTool Messager
1313
ModifierFilter RootDocImpl)
1414
(com.sun.tools.javac.tree JCTree)
1515
(java.io StringReader)
1616
(java.net URI)
17-
(java.util Locale)
1817
(javax.swing.text.html HTML$Tag HTMLEditorKit$ParserCallback)
1918
(javax.swing.text.html.parser ParserDelegator)
2019
(javax.tools JavaFileObject$Kind SimpleJavaFileObject)))
@@ -69,7 +68,6 @@
6968
(when-let [res (io/resource path)]
7069
(let [access (ModifierFilter. ModifierFilter/ALL_ACCESS)
7170
context (doto (Context.) (Messager/preRegister "orchard-javadoc"))
72-
options (doto (Options/instance context) (.put "ignore.symbol.file" "y"))
7371
compiler (JavadocTool/make0 context)
7472
enter (JavadocEnter/instance0 context)
7573
docenv (doto (DocEnv/instance context)

src/orchard/java/parser.clj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
[clojure.java.io :as io]
77
[clojure.string :as str])
88
(:import
9-
(java.net URI)
109
(java.io StringReader StringWriter)
1110
(javax.lang.model.element Element ElementKind ExecutableElement
1211
TypeElement VariableElement)
1312
(javax.swing.text.html HTML$Tag HTMLEditorKit$ParserCallback)
1413
(javax.swing.text.html.parser ParserDelegator)
15-
(javax.tools DocumentationTool JavaFileObject$Kind
16-
SimpleJavaFileObject ToolProvider)
17-
(javax.tools JavaFileObject$Kind SimpleJavaFileObject)
14+
(javax.tools ToolProvider)
1815
(jdk.javadoc.doclet Doclet DocletEnvironment)))
1916

2017
;;; ## JDK Compatibility

src/orchard/java/resource.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
"If it's a resource, return a tuple of the relative path and the full
4545
resource path."
4646
[path]
47-
(or (if-let [full (resource-full-path path)]
47+
(or (when-let [full (resource-full-path path)]
4848
[path full])
49-
(if-let [[_ relative] (re-find #".*jar!/(.*)" path)]
50-
(if-let [full (resource-full-path relative)]
49+
(when-let [[_ relative] (re-find #".*jar!/(.*)" path)]
50+
(when-let [full (resource-full-path relative)]
5151
[relative full]))
5252
;; handles load-file on jar resources from a cider buffer
53-
(if-let [[_ relative] (re-find #".*jar:(.*)" path)]
54-
(if-let [full (resource-full-path relative)]
53+
(when-let [[_ relative] (re-find #".*jar:(.*)" path)]
54+
(when-let [full (resource-full-path relative)]
5555
[relative full]))))
5656

5757
(defn resource-path

0 commit comments

Comments
 (0)