Add built-in validation checks for directive syntax

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
documentation

調査の方向性

issue にリンクされている既存の組み込みバリデーションチェックを確認し、無効なディレクティブと修正済みディレクティブの例と動作を比較します。インデントされていないディレクティブコンテンツブロックのバリデーションを追加し、提案された診断が報告される一方で、正しくインデントされた構文は受け入れられることを確認します。

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

説明

Issue/bug

Currently, the following invalid directive syntax is not checked by numpydoc-validation

.. directive::
Some text

The numpydoc-validation checks will pass, but the invalid syntax will result in a documentation build failure with a warning and/or error such as:

WARNING: Explicit markup ends without a blank line; unexpected unindent.
ERROR: Content block expected for the "note" directive; none found.

The correct syntax, according to the reST documentation, is:

+-------+-------------------------------+
| ".. " | directive type "::" directive |
+-------+ block                         |
        |                               |
        +-------------------------------+

Therefore, in the first example provided above, the errors/warnings are resolved by indenting the block of text, i.e.:

.. directive::
    Some text

Here is an example build failure and the subsequent commit diff with added indentation which resolved the warnings and errors and resulted in a successful documentation build. Ideally, this invalid syntax would have been caught by a pre-commit hook such as numpydoc-validation so that it could be addressed before running CI testing to avoid the inevitable documentation build failure.

This appears to be a somewhat common problem, e.g. reported here and here.

Feature request

The feature request is to add additional validation check(s) for the correct syntax of directives, e.g. add a new mapping to the existing checks, something like:

  • "GL11": "reST directives {directives} text block must be indented."

Thank you for your time.

主要言語
Python
スター
354
フォーク
185
平均マージ
4分
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

numpy/numpydoc のほかの issue

numpy/numpydoc の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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