Content-detected formats (XML Schema, OpenAPI) are attributed to the root unit, not the unit that holds the files, so schema-declared says "no file to judge"

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
tooling

調査の方向性

Start with the content-detection origin at project_validator/facts/structure.py:224, which attributes ContentLanguages to the root path, and with _schemas() in project_validator/questions/declaration.py:52-58, which filters schemas by owner unit. Reproduce with a sub/ unit containing a.xsd lacking targetNamespace and check that schema-declared reports it instead of 'no XML Schema file to judge'. Done when probe-found formats map to the owning unit and that repro fails as expected.

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

説明

docbook/docbook: schema-declared PASS "no XML Schema file to judge" although 14 XSDs (6 without targetNamespace) and 364 documents were read: the facts are assigned to the root unit, whose formats do not include XML Schema, while the files live in the MovedToCodeberg unit; the root (holding only a README) is also reported as a Shell/XML Schema/XSLT product. hledger-web's config/openapi.yaml is read as a product SchemaDeclaration but OpenAPI is attributed to the root unit, so schema-declared reports "no OpenAPI file to judge" and static-analysis/schema-validation judge unit .. Formats found by content probes should belong to the unit that owns the files (the #51 design put probe-found formats on the root unit).

Evidence from the corpus audit

docbook/docbook / schema-declared
  • kind: FALSE_POSITIVE
  • actual: PASS: no XML Schema file to judge
  • expected: FAIL: 6 XSDs declare no targetNamespace (and 364 documents are asked for a schema location); the facts
    were all produced but assigned to a unit whose formats do not include "XML Schema".
  • evidence: MovedToCodeberg/src/docbook/schemas/4.5/xsd/docbook.xsd:64:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> (no targetNamespace; same
    for calstblx, dbhierx, dbnotnx, dbpoolx, htmltblx.xsd). --facts --only schema-declared emits 378
    SchemaDeclaration facts (14 targetNamespace, 6 with "missing": ["targetNamespace"]; 364 schema location).
    .map.json units: "directory": "." has formats: ["XML Schema","XSLT"], languages: ["Shell"] but owns no
    file; "directory": "MovedToCodeberg" has formats: ["XML"] only. Validator:
    project_validator/facts/structure.py:224 ContentLanguages(origin=Origin(path="."), ...) (content detection is
    always attributed to the root); questions/declaration.py:_schemas filters by owner(schema.path, units) == unit,
    so the root unit gets zero schemas and judge_schema_declared says "no XML Schema file to judge"; per_unit only
    asks units whose formats contain the language.
  • repro: sub/build.gradle (any build file making sub/ a unit) + sub/a.xsd with <xs:schema xmlns:xs="..."> and
    no targetNamespace; nothing at the root. Expected FAIL, actual PASS.
  • confidence: high
docbook/docbook / detection
  • kind: DETECTION
  • actual: units: . product (Shell; XML Schema, XSLT) and MovedToCodeberg product (Gradle; Java, JavaScript; XML)
  • expected: one unit MovedToCodeberg carrying Shell (gradlew), XML Schema and XSLT; the root holds only README.md.
    Consequence: "XML schemas: no tests found (XSpec suites)", "Shell: CI never runs shfmt", "Shell: no static analyzer"
    are all reported against the empty root unit.
  • evidence: find . -maxdepth 1 -type f -> ./README.md only; README.md:1: # Moved to Codeberg;
    MovedToCodeberg/gradlew, MovedToCodeberg/src/docbook/schemas/5.0/rng/docbook.rng. Validator: same
    structure.py:224 as above (origin ".").
  • repro: as the previous finding; look at --map units.
  • confidence: high
simonmichael/hledger / schema-declared
  • kind: FALSE_NEGATIVE
  • actual: PASS: no OpenAPI file to judge (and static-analysis: OpenAPI/AsyncAPI: no static analyzer runs, schema-validation FAIL, both judged for unit .)
  • expected: PASS: 1 OpenAPI file declares its version and info.version (hledger-web/config/openapi.yaml), judged in unit hledger-web. The --facts output shows the file was read as a product SchemaDeclaration with nothing missing, but the OpenAPI format is attributed to the root unit while the file is owned by the hledger-web unit, so _schemas() filters it out.
  • evidence: hledger-web/config/openapi.yaml:13: openapi: 3.1.0; :21: version: 1.0.0; --facts --only schema-declared: "kind": "SchemaDeclaration", "origin": "hledger-web/config/openapi.yaml", "format": "OpenAPI", "role": "product", "declared": {"openapi": "3.1.0", "info.version": "1.0.0"}, "missing": []; .map.json units: root formats: ["Dockerfile", "OpenAPI", "TOML", "YAML"], hledger-web formats: ["YAML"]; project_validator/questions/declaration.py:52-58: if schema.format == format_ and owner(schema.path, units) == unit
  • repro: cabal.project with packages: web, web/web.cabal, web/config/openapi.yaml (openapi: 3.1.0, info: {title: x, version: 1.0.0}); expect the file judged
  • confidence: high

Found by the regression-corpus audit (235 real repositories, one or more per ecosystem profile; corpus and expected results in corpus/). Evidence is quoted from the audited checkouts at the commits pinned in corpus/projects.toml; <checkouts>/<owner>__<repo> is such a checkout.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

主要言語
Python
スター
4
フォーク
1
平均マージ
10時間 41分
マージ済み PR(30日)
79

環境構築

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

はじめの一歩

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

cpp-best-practices/project_validator のほかの issue

cpp-best-practices/project_validator の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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