File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 550550 (let [jar? (or (nil? source)
551551 (str/ends-with? source " .jar" ))
552552 gitlib-hash (and (not jar?)
553- (second (re-find #".gitlibs/libs/.*/(\b [0-9a-f]{5,40}\b )/" (utils/unixify source))))]
554- (if (or jar? gitlib-hash)
553+ (second (re-find #".gitlibs/libs/.*/(\b [0-9a-f]{5,40}\b )/" (utils/unixify source))))
554+ clojure-source? (and source
555+ (some #(str/ends-with? source %)
556+ [" .clj" " .cljc" " .cljs" " .bb" ]))]
557+ (if (or jar? gitlib-hash (not clojure-source?))
555558 (update g :->analysis-info merge (into {} (map (juxt identity
556559 (constantly (if source
557560 (or (when gitlib-hash {:hash gitlib-hash})
Original file line number Diff line number Diff line change @@ -390,7 +390,15 @@ my-uuid")]
390390 (is (match? {:jar string?} (->analysis-info 'weavejester.dependency/graph)))))
391391 (testing " should establish dependencies across files"
392392 (let [{:keys [graph]} (analyze-string (slurp " src/nextjournal/clerk.clj" ))]
393- (is (dep/depends? graph 'nextjournal.clerk/show! 'nextjournal.clerk.analyzer/hash)))))
393+ (is (dep/depends? graph 'nextjournal.clerk/show! 'nextjournal.clerk.analyzer/hash))))
394+ (testing " does not try to parse non-Clojure source files (issue #531)"
395+ ; ; Mimic libpython-clj: a var whose :file meta points to a Python file.
396+ (def issue-531-py-var 1 )
397+ ; ; Absolute path, matching how libpython-clj writes :file meta — also forces
398+ ; ; `var->location` down its on-disk branch so the bad code path is exercised.
399+ (alter-meta! #'issue-531-py-var assoc :file
400+ (str (fs/absolutize (fs/file " test" " nextjournal" " clerk" " fixtures" " issue_531_not_clojure.py" ))))
401+ (is (analyze-string " (ns consumer) (def use-py (nextjournal.clerk.analyzer-test/issue-531-py-var))" ))))
394402
395403(deftest graph-nodes-with-anonymous-ids
396404 (testing " nodes with \" anonymous ids\" from dependencies in foreign files respect graph dependencies"
Original file line number Diff line number Diff line change 1+ import numpy as np
2+
3+
4+ class BagObj :
5+ def __init__ (self , obj ):
6+ self ._obj = obj
You can’t perform that action at this time.
0 commit comments