Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Support for multi src path analysis

オープン
#28 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
clojure
領域
devtools

調査の方向性

weasel.repl.websocket/websocket-setup-env から開始し、cljs.repl/analyze-source の呼び出しを追跡してから、issue に記載されているコンパイラー環境の処理を確認します。:src-paths オプションをサポートし、以前のコンパイラー・ルートを保持したまま各ソース・ルートを解析します。依存する namespace が報告された誤検知警告なしで読み込まれれば完了です。

索引モデルが issue の本文から書いたものです。

説明

When I piggyback into the Weasel REPL, many "false-positive" code analysis warnings are emitted. These are mostly of the form "Referred var some.namespace/var-name does not exist," but other similar warnings are emitted. Nothing breaks for me, and the REPL functions.

This occurs when (cljs.repl/analyze-source (:src this)) is called from within weasel.repl.websocket/websocket-setup-env.

I've traced the root cause down to an inability of the ClojureScript compiler to locate the source of dependent namespaces to analyze. To fix this appears to require two changes:

  1. The :root in the ClojureScript compiler environment needs to be set to the source root. This root needs to follow the JVM classpath convention. In other words it needs to be precisely at the level containing the namespace directories. Using the weasel project structure itself as an example, this would be src/cljs/.
  2. For projects that have multiple roots (:source-paths per lein-cljsbuild) a separate analysis needs to be done for each distinct root. Thus, Weasel would need to accomodate a :src-paths option in lieu of its current :src option.

With a :src-paths option, if I replace (cljs.repl/analyze-source (:src this)) with the following form

(let [compiler-env (::env/compiler this)
      previous-root (:root @compiler-env)]
  (doseq [src-path (:src-paths this)]
    (swap! compiler-env assoc :root (File. src-path))
    (env/with-compiler-env compiler-env
      (cljs.repl/analyze-source src-path)))
  (swap! compiler-env assoc :root previous-root))

then piggybacking into Weasel works without any "false-positive" warnings, and if you inspect the ClojureScript compiler's behavior, you can see that it succeeds in loading dependent namespaces and analyzing them.

主要言語
Clojure
スター
323
フォーク
31
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nrepl/weasel のほかの issue

nrepl/weasel の issue をすべて見る

似ている issue

Clojure の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。