File tree Expand file tree Collapse file tree 3 files changed +23
-13
lines changed
src/cider/nrepl/middleware Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 10
10
11
11
* Make ` middleware.stacktrace ` detect a given project's common ns prefix even in face of single-segment namespaces such as ` user ` .
12
12
13
+ ### Changes
14
+
15
+ * Parallelize ` cider.nrepl.middleware.stacktrace/analyze-stacktrace ` .
16
+
13
17
## 0.26.0 (2021-04-22)
14
18
15
19
### New features
Original file line number Diff line number Diff line change 183
183
" Flag the frame if it is from the users project. From a users
184
184
project means that the namespace is one we have identified or it
185
185
begins with the identified common prefix."
186
- [{:keys [ns ] :as frame}]
186
+ [namespaces {:keys [ns ] :as frame}]
187
187
(if (and ns
188
- (or (contains? ( directory- namespaces) (symbol ns ))
188
+ (or (contains? namespaces (symbol ns ))
189
189
(when (:valid @ns-common-prefix)
190
190
(.startsWith ^String ns (:common @ns-common-prefix)))))
191
191
(flag-frame frame :project )
206
206
207
207
(defn analyze-frame
208
208
" Return the stacktrace as a sequence of maps, each describing a stack frame."
209
- [frame]
210
- ((comp flag-repl flag-project analyze-fn analyze-file stack-frame) frame))
209
+ [namespaces frame]
210
+ (let [f (comp flag-repl (partial flag-project namespaces) analyze-fn analyze-file stack-frame)]
211
+ (f frame)))
211
212
212
213
(defn analyze-stacktrace
213
214
" Return the stacktrace as a sequence of maps, each describing a stack frame."
214
215
[^Exception e]
215
- (-> (map analyze-frame (.getStackTrace e))
216
- (flag-duplicates )
217
- (flag-tooling )))
216
+ (let [namespaces (directory-namespaces )]
217
+ (-> (pmap (partial analyze-frame namespaces)
218
+ (.getStackTrace e))
219
+ (flag-duplicates )
220
+ (flag-tooling ))))
218
221
219
222
; ;; ## Causes
220
223
Original file line number Diff line number Diff line change 57
57
(defn stack-frame
58
58
" Search the stacktrace of exception `e` for the function `f` and return info
59
59
describing the stack frame, including var, class, and line."
60
- [^Exception e f]
61
- (->> (map st/analyze-frame (.getStackTrace e))
62
- (filter #(= (:class %) (.getName (class f))))
63
- (first )))
60
+ ([^Exception e f]
61
+ (stack-frame (st/directory-namespaces ) e f))
62
+ ([namespaces ^Exception e f]
63
+ (->> (map (partial st/analyze-frame namespaces) (.getStackTrace e))
64
+ (filter #(= (:class %) (.getName (class f))))
65
+ (first ))))
64
66
65
67
(defn- print-object
66
68
" Print `object` using pprint or a custom print-method, if available."
184
186
finds the erring test fixture in the stacktrace and binds it as the current
185
187
test var. Test count is decremented to indicate that no tests were run."
186
188
[ns e]
187
- (let [frame (->> (concat (:clojure.test/once-fixtures (meta ns ))
189
+ (let [namespaces (st/directory-namespaces )
190
+ frame (->> (concat (:clojure.test/once-fixtures (meta ns ))
188
191
(:clojure.test/each-fixtures (meta ns )))
189
- (map (partial stack-frame e))
192
+ (map (partial stack-frame namespaces e))
190
193
(filter identity)
191
194
(first ))
192
195
fixture (resolve (symbol (:var frame)))]
You can’t perform that action at this time.
0 commit comments