Add a structured issues model and emit findings from the filename validator
評估
這個 Issue 還沒有評估資料。
描述
Summary
Validation currently answers a yes/no question. BIDSValidator.is_bids() returns a
boolean, and the CLI prints one line per non-compliant file:
/sub-01/anat/oops.nii.gz is not a valid bids filename
That output carries no severity, no stable code, and no structure a program can consume.
It cannot be counted, filtered, serialised, or shown in a UI, and it cannot say why a
name is wrong.
context.py already anticipates this: ValidationError is a stub whose entire body is
"""TODO: Add issue structure.""".
Proposal
Two small pieces.
1. An issue model (bids_validator/issues.py). Pure data, no I/O, attrs to match
the convention already used by context.py, bidsignore.py and types/files.py:
Severity(error,warning)Issuewithcode,severity,location,message,sub_code,ruleDatasetIssues, an ordered collection withadd,extend,by_severity,
has_errors,__len__,__iter__
Field names mirror the reference validator so output stays interchangeable.
2. Emit findings from filename validation. Rather than one blanket answer, report the
specific reason using the reference validator's codes: NOT_INCLUDED,
MISSING_REQUIRED_ENTITY, ENTITY_NOT_IN_RULE, ENTITY_WITH_NO_LABEL,
INVALID_ENTITY_LABEL, EXTENSION_MISMATCH, DATATYPE_MISMATCH, INVALID_LOCATION,
FILENAME_MISMATCH, ALL_FILENAME_RULES_HAVE_ISSUES.
Scope is names and paths only. No file contents are read.
BIDSValidator.is_bids() stays untouched, since pybids and mne-bids depend on it.
Why this first
Every later check needs somewhere to report to. Content validation (sidecar fields, NIfTI
headers, tabular columns) produces the same Issue type into the same DatasetIssues,
so the output contract is defined once and does not change as coverage grows.
Questions for maintainers
- Is the minimal field set above right, or do you want the reference validator's richer
fields (rule provenance, machine-actionable fixes, anignoreseverity, line spans)
from the start? I kept them out to keep the first PR small. - The CLI currently prints
<path> is not a valid bids filenamefor each bad file.
When these findings are wired into it, should that output change to show the
specific code and reason, or should the current text stay the default with the
structured output behind a flag? Changing it would be more useful but would break
anyone parsing the current output. - Any preference on module naming (
issues.py/filename_checks.py)?
I have a working implementation with tests and am happy to open a PR, or to adjust the
shape first if you would prefer a different design.
- 主要語言
- Python
- 星號
- 10
- 分支
- 7
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
bids-standard/python-validator 的其他 Issue
-
Populate associations context可能重新可做 @ubdbra001 於 116 天前認領,目前沒有進行中的 PR。 未關閉
bids-standard/python-validator#82 · 1 則留言 · 已指派 1 人 ·
-
難度 4/5 3-5 天 新手友好度 45/100
-
performance
難度 5/5 一週以上 新手友好度 35/100
-
Validate Derivatives可能已有人在做 @bendhouseart 於 298 天前認領。 未關閉enhancement
bids-standard/python-validator#62 · 已指派 1 人 ·
-
難度 3/5 1-2 天 新手友好度 45/100
查看 bids-standard/python-validator 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
namespace operations
難度 1/5 1 小時以內 新手友好度 65/100
EclipseFdn/open-vsx.org#15057 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
FinanceFlash/unvibecode#349 ·
-
Mission statement: why this is free, in the README, Why This Exists and the wiki Home可能已有人在做 @ChiefGyk3D 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
ChiefGyk3D/Clouds-Against-Humanity#348 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
vllm-project/vime#508 ·
維護者通常 4 天內回覆