sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 481 forks source link

src/tox.ini: Add validation of docstrings using flake8-rst-docstrings #30448

Closed mkoeppe closed 2 years ago

mkoeppe commented 4 years ago

Short of running a single-file docbuild (which needs fixing - #30475), there are several options for validating rst files and docstrings:

Here we add a tox environment using https://pypi.org/project/flake8-rst-docstrings.

Usage:

   ./sage -tox -e rst src/sage/geometry/polyhedra

We also run it as part of the Lint workflow on GH Actions (see badge).

Continued in the meta ticket: #34157

Depends on #30503

CC: @tobiasdiez @jhpalmieri @dimpase @fchapoton @DaveWitteMorris @Etn40ff @tscrim @kwankyu

Component: documentation

Author: Matthias Koeppe

Branch/Commit: 0677319

Reviewer: Kwankyu Lee

Issue created by migration from https://trac.sagemath.org/ticket/30448

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from 047a845 to a4552e1

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

a4552e1src/sage/coding: Fix some errors shown by tox -e rst
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from a4552e1 to 16c8046

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3a6c1afsrc/sage/cpython: Fix errors shown by tox -e rst
521a142src/sage/doctest: Fix some errors shown by tox -e rst
c53c78csrc/sage/knots: Fix errors shown by tox -e rst
438d08bsrc/sage/libs: Fix errors shown by tox -e rst
16c8046src/sage/misc: Fix some errors shown by tox -e rst
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from 16c8046 to 450cdc3

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

450cdc3src/sage/modular: Fix some errors shown by tox -e rst
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

74738fbsrc/sage/plot: Fix some errors shown by tox -e rst
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from 450cdc3 to 74738fb

mkoeppe commented 2 years ago

Description changed:

--- 
+++ 
@@ -13,3 +13,4 @@
    ./sage -tox -e rst src/sage/geometry/polyhedra

+We also run it as part of the Lint workflow on GH Actions (see badge).

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from 74738fb to c2d0a91

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

dccceb4src/sage/parallel: Fix errors shown by tox -e rst
4cc5674src/sage/quadratic_forms: Fix errors shown by tox -e rst
a2f5ef6src/sage/repl: Fix some errors shown by tox -e rst
c2d0a91src/sage/rings: Fix some errors shown by tox -e rst
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

8fc8776src/sage/structure: Fix errors shown by tox -e rst
18121fesrc/sage/modules: Fix errors shown by tox -e rst
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from c2d0a91 to 18121fe

mkoeppe commented 2 years ago
comment:50

I stop here for now, contributions welcome

mkoeppe commented 2 years ago
comment:51

Remaining failures see https://github.com/sagemath/sagetrac-mirror/runs/7294638131?check_suite_focus=true

kwankyu commented 2 years ago
comment:52

Replying to @mkoeppe:

Remaining failures see https://github.com/sagemath/sagetrac-mirror/runs/7294638131?check_suite_focus=true

May I open a meta ticket to deal with them?

mkoeppe commented 2 years ago
comment:53

Good idea

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d66c66e.github/workflows/lint.yml: Do not fail when rst checks fail
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from 18121fe to d66c66e

mkoeppe commented 2 years ago

Changed author from Matthias Koeppe, ... to Matthias Koeppe

kwankyu commented 2 years ago

Changed author from Matthias Koeppe to Matthias Koeppe, ...

kwankyu commented 2 years ago

New commits:

d66c66e.github/workflows/lint.yml: Do not fail when rst checks fail
kwankyu commented 2 years ago

Changed dependencies from #30503 to #30503; #34156

kwankyu commented 2 years ago
comment:57

Okay. I will open a separate ticket.

kwankyu commented 2 years ago

Changed dependencies from #30503; #34156 to #30503

kwankyu commented 2 years ago
comment:59

Here is the meta ticket: #34157

kwankyu commented 2 years ago
comment:60

Done. It is a ticket party. Whet your appetite.

kwankyu commented 2 years ago
comment:61

Perhaps

diff --git a/src/sage/graphs/domination.py b/src/sage/graphs/domination.py
index 25ac512233..8cc1e57de9 100644
--- a/src/sage/graphs/domination.py
+++ b/src/sage/graphs/domination.py
@@ -513,7 +513,7 @@ def _cand_ext_enum(G, to_dom, u_next):

         .. WARNING::

-            The same output may be output several times (up to ``H`` times).
+            The same output may be output several times (up to `|H|` times).

         In order to later remove duplicates, we here output pairs ``(ext, i)``
         where ``ext`` is the output candidate extension and ``i`` counts how
@@ -593,7 +593,7 @@ def minimal_dominating_sets(G, to_dominate=None, work_on_copy=True):
     - ``work_on_copy`` -- boolean (default: ``True``); whether or not to work on
       a copy of the input graph; if set to ``False``, the input graph will be
       modified (relabeled).
-    
+
     OUTPUT:

     An iterator over the inclusion-minimal sets of vertices of ``G``.
mkoeppe commented 2 years ago
comment:62

Thanks for catching this, please push it to the ticket

kwankyu commented 2 years ago

Changed branch from u/mkoeppe/src_tox_ini__add_validation_of_rst_files_and_docstrings to public/30448

kwankyu commented 2 years ago

Changed commit from d66c66e to none

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

450cdc3src/sage/modular: Fix some errors shown by tox -e rst
74738fbsrc/sage/plot: Fix some errors shown by tox -e rst
dccceb4src/sage/parallel: Fix errors shown by tox -e rst
4cc5674src/sage/quadratic_forms: Fix errors shown by tox -e rst
a2f5ef6src/sage/repl: Fix some errors shown by tox -e rst
c2d0a91src/sage/rings: Fix some errors shown by tox -e rst
8fc8776src/sage/structure: Fix errors shown by tox -e rst
18121fesrc/sage/modules: Fix errors shown by tox -e rst
d66c66e.github/workflows/lint.yml: Do not fail when rst checks fail
0677319Fix a typo
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Commit: 0677319

kwankyu commented 2 years ago
comment:65

Otherwise, it looks good to me.

kwankyu commented 2 years ago

Changed author from Matthias Koeppe, ... to Matthias Koeppe

kwankyu commented 2 years ago

Reviewer: Kwankyu Lee

kwankyu commented 2 years ago

Description changed:

--- 
+++ 
@@ -14,3 +14,5 @@

We also run it as part of the Lint workflow on GH Actions (see badge). + +Continued in the meta ticket: #34157

mkoeppe commented 2 years ago
comment:67

Thanks!

jhpalmieri commented 2 years ago
comment:68

A bug in flake8-rst-docstrings? See #34168 comment:14, also #34167 and #34169.

jhpalmieri commented 2 years ago
comment:69

Or maybe we're just sloppy in how we use reStructuredText, and we should add explicit titles our files, like

diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py
index 237ad5dfed..d11bf0fe8a 100644
--- a/src/sage/categories/category_with_axiom.py
+++ b/src/sage/categories/category_with_axiom.py
@@ -1,5 +1,7 @@
 r"""
+======
 Axioms
+======

 This documentation covers how to implement axioms and proceeds with an
 overview of the implementation of the axiom infrastructure. It assumes

I don't know rst syntax well enough to know if a single word at the start of a text block has special significance, but I think it might. This might also explain the issue with "noreplace" in sagedoc.py in #34172.

jhpalmieri commented 2 years ago
comment:70

I can't get the syntax

======
Axioms
======

to compile: it yields an error. At #34168 we've diagnosed what looks like a bug in flake8-rst-docstrings, and fixing that would be my preferred resolution.

vbraun commented 2 years ago

Changed branch from public/30448 to 0677319