Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codeview/cf_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def main(argv: list[str] | None = None) -> int:
),
)

# 既存プロジェクトにも効かせる(作成時の指定は再実行では通らない)
# 既存プロジェクトにも適用する(作成時の指定は再実行では通らない)
step(
"disable preview",
api(
Expand Down
2 changes: 1 addition & 1 deletion codeview/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Account:

@dataclass(frozen=True)
class RepoScan:
"""`[scan.repos."<slug>"]` の追加分。全体の `[scan]` の値に足して効く。"""
"""`[scan.repos."<slug>"]` の追加分。全体の `[scan]` の値に足して適用される。"""

skip_exts: tuple[str, ...] = ()
exclude_prefixes: tuple[str, ...] = ()
Expand Down
2 changes: 1 addition & 1 deletion codeview/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def file_head(
) -> str:
"""ファイル名クリックで絶対パスをコピーできるヘッダ。

コードのページには折り返しの切り替えも置く。JS が無いと押しても効かないので、
コードのページには折り返しの切り替えも置く。JS が無いと押しても何も起きないので、
hidden で出しておき FILE_SCRIPT が見せる。
"""
btn = (
Expand Down
4 changes: 2 additions & 2 deletions docs/guarantees.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- `children` のルートでは直下の git リポをすべて走査し、各リポの HEAD にあるファイルをページにする。トップにはリポへのリンクが並ぶ
- `exclude_prefixes` に前方一致するパス、`skip_exts` の拡張子、未コミットのファイルはページにしない
- `[scan.repos."<slug>"]` に書いた `skip_exts` と `exclude_prefixes` は、その slug のリポにだけ、全体の `[scan]` の値に足して効く。他のリポのページは変わらない
- `[scan.repos."<slug>"]` に書いた `skip_exts` と `exclude_prefixes` は、その slug のリポにだけ、全体の `[scan]` の値に足して適用される。他のリポのページは変わらない
- リポ単位で除外したファイルも、全体で除外したファイルと同じく、Markdown のリンク先にならない(リンクにせず文字だけ残す)
- `[scan.repos."<slug>"]` に `skip_exts` と `exclude_prefixes` 以外のキーがあれば、`error:` を出して非0で終わり、`public/` を作らない
- 走査対象に無い slug を `[scan.repos]` に書いても build は止まらず、その slug を標準エラーに出す
Expand Down Expand Up @@ -47,7 +47,7 @@
|---|---|
| `children` の走査とトップのリンク | `test_scans_children_and_skips` |
| 除外パス・拡張子・未コミットを出さない | `test_scans_children_and_skips` |
| リポ単位の除外は、そのリポにだけ全体の値へ足して効く(除外したファイルはリンク先にならない) | `test_repo_scan_adds_to_global_for_that_repo_only` |
| リポ単位の除外は、そのリポにだけ全体の値へ足して適用される(除外したファイルはリンク先にならない) | `test_repo_scan_adds_to_global_for_that_repo_only` |
| リポ単位で除外したファイルは GitHub の URL のリンク先にならない | `test_repo_scan_excluded_file_is_not_a_github_link_target` |
| リポ単位の設定の未知のキー・表でない値 | `test_repo_scan_unknown_key_stops_before_build`、`test_repo_scan_must_be_a_table_per_repo` |
| 走査対象に無い slug は警告だけ | `test_repo_scan_unknown_slug_warns_and_continues` |
Expand Down
8 changes: 4 additions & 4 deletions issues/done/05_repo-scan-overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PR: https://github.com/yktsnet/codeview/pull/20
- README.md / README.en.md の設定の表に追記し、画像の多いリポだけ画像を外す例を載せた

## 保証
- リポ単位の除外はそのリポにだけ全体の値へ足して効く → `tests/test_build.py` `test_repo_scan_adds_to_global_for_that_repo_only`
- リポ単位の除外はそのリポにだけ全体の値へ足して適用される → `tests/test_build.py` `test_repo_scan_adds_to_global_for_that_repo_only`
- 除外したファイルは Markdown のリンク先にならない → 同上。GitHub の URL のリンク先にもならない → `test_repo_scan_excluded_file_is_not_a_github_link_target`
- 未知のキーは `error:` で止まり `public/` を作らない → `test_repo_scan_unknown_key_stops_before_build`、`test_repo_scan_must_be_a_table_per_repo`
- 走査対象に無い slug は警告だけ → `test_repo_scan_unknown_slug_warns_and_continues`
Expand All @@ -29,7 +29,7 @@ PR: https://github.com/yktsnet/codeview/pull/20
| `nix develop -c pytest -q` が通る(43 passed) | 合 |
| 新しいテストで、リポ単位の設定を書いたリポだけでそのページが出ず、同じ拡張子・パスでも他のリポでは出る | 合 |
| 保証節の新規4項目と維持4項目、台帳の更新 | 合 |
| テストの効き目(実装を10通りに壊して、対応するテストが落ちる) | 合 |
| テストが誤りを見つけるか(実装を10通りに壊して、対応するテストが落ちる) | 合 |
| 範囲の外に出た変更 | なし |

---
Expand All @@ -40,7 +40,7 @@ branch-slug: repo-scan-overrides
status: close
type: feat
対象: codeview/config.py, codeview/build.py, tests/test_build.py, tests/conftest.py, docs/guarantees.md, README.md, README.en.md
内容: `[scan]` の `skip_exts` と `exclude_prefixes` は全リポに一律で効く。画像の多いリポ(hi)だけ画像を出さず、他のリポでは出す、という使い分けができない。06 で画像を出力に戻す前に、リポ単位で除外を足す設定を設ける。
内容: `[scan]` の `skip_exts` と `exclude_prefixes` は全リポに一律で適用される。画像の多いリポ(hi)だけ画像を出さず、他のリポでは出す、という使い分けができない。06 で画像を出力に戻す前に、リポ単位で除外を足す設定を設ける。
対象外: 画像を出力に戻すこと(06)。`skip_dirs` のリポ単位の設定。全体の `[scan]` の意味を変えること
仮定: リポの指定には、生成物のパスと同じ slug(`<group>/<name>`、`path` のルートは `<group>`。`build.py` の `slugged` と同じ値)を使う。設定に書いた slug が走査対象に無くても止めず、標準エラーに警告を出す(リポを外した直後に build が通らなくなるのを避ける)
確認: `nix develop -c pytest -q` が通る。新しいテストで、リポ単位の設定を書いたリポだけでそのファイルのページが出ず、同じ拡張子・パスでも他のリポでは出ることを確かめる
Expand All @@ -50,7 +50,7 @@ type: feat

### 保証
- 新たに宣言する保証:
- `[scan.repos."<slug>"]` に書いた `skip_exts` と `exclude_prefixes` は、その slug のリポにだけ、全体の `[scan]` の値に足して効く。他のリポのページは変わらない
- `[scan.repos."<slug>"]` に書いた `skip_exts` と `exclude_prefixes` は、その slug のリポにだけ、全体の `[scan]` の値に足して適用される。他のリポのページは変わらない
- リポ単位で除外したファイルは、全体で除外したファイルと同じく、Markdown のリンク先にならない(リンクにせず文字だけ残す)
- `[scan.repos."<slug>"]` に `skip_exts` と `exclude_prefixes` 以外のキーがあれば、`error:` を出して非0で終わり、`public/` を作らない
- 走査対象に無い slug を書いても build は止まらず、その slug を標準エラーに出す
Expand Down
4 changes: 2 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def test_repo_scan_adds_to_global_for_that_repo_only(site):
_repo_scan_site(site)
public, _ = site.build()
alpha, beta = public / "alpha", public / "beta"
# リポ単位の除外は、そのリポだけに効く(拡張子は大小を無視する)
# リポ単位の除外は、そのリポだけに適用される(拡張子は大小を無視する)
assert not (alpha / "main.py.html").exists()
assert not (alpha / "docs").exists()
assert (beta / "main.py.html").is_file()
assert (beta / "docs" / "guide.md.html").is_file()
# 全体の除外は足したあとも効く
# 全体の除外は足したあとも残る
assert not (alpha / "logo.png.html").exists()
assert not (beta / "logo.png.html").exists()
assert (alpha / "README.md.html").is_file()
Expand Down
Loading