Skip to content

Commit a6c25fb

Browse files
committed
Refine doc contribution docs
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent a5bcdbd commit a6c25fb

File tree

1 file changed

+38
-81
lines changed

1 file changed

+38
-81
lines changed

docs/source/contribute/contrib_doc.rst

Lines changed: 38 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,118 +8,67 @@ Contributing to the Documentation
88
Setup Local Build
99
-----------------
1010

11-
To get started, create or identify a working directory on your local machine.
11+
To get started, check out and configure the repository for development::
1212

13-
Open that directory and execute the following command in a terminal session::
13+
git clone https://github.com/aboutcode-org/<your-repo>.git
1414

15-
git clone https://github.com/aboutcode-org/skeleton.git
15+
cd your-repo
16+
./configure --dev
1617

17-
That will create an ``/skeleton`` directory in your working directory.
18-
Now you can install the dependencies in a virtualenv::
19-
20-
cd skeleton
21-
./configure --docs
18+
(Or use "make dev")
2219

2320
.. note::
2421

25-
In case of windows, run ``configure --docs`` instead of this.
26-
27-
Now, this will install the following prerequisites:
28-
29-
- Sphinx
30-
- sphinx_rtd_theme (the format theme used by ReadTheDocs)
31-
- docs8 (style linter)
22+
In case of windows, run ``configure --dev``.
3223

33-
These requirements are already present in setup.cfg and `./configure --docs` installs them.
24+
This will install and configure all requirements foer development including for docs development.
3425

35-
Now you can build the HTML documents locally::
26+
Now you can build the HTML documentation locally::
3627

3728
source venv/bin/activate
38-
cd docs
39-
make html
40-
41-
Assuming that your Sphinx installation was successful, Sphinx should build a local instance of the
42-
documentation .html files::
43-
44-
open build/html/index.html
45-
46-
.. note::
47-
48-
In case this command did not work, for example on Ubuntu 18.04 you may get a message like “Couldn’t
49-
get a file descriptor referring to the console”, try:
50-
51-
::
52-
53-
see build/html/index.html
29+
make docs
5430

55-
You now have a local build of the AboutCode documents.
31+
This will build a local instance of the ``docs/_build`` directory::
5632

57-
.. _contrib_doc_share_improvements:
33+
open docs/_build/index.html
5834

59-
Share Document Improvements
60-
---------------------------
61-
62-
Ensure that you have the latest files::
63-
64-
git pull
65-
git status
6635

67-
Before commiting changes run Continious Integration Scripts locally to run tests. Refer
68-
:ref:`doc_ci` for instructions on the same.
36+
To validate the documentation style and content, use::
6937

70-
Follow standard git procedures to upload your new and modified files. The following commands are
71-
examples::
72-
73-
git status
74-
git add source/index.rst
75-
git add source/how-to-scan.rst
76-
git status
77-
git commit -m "New how-to document that explains how to scan"
78-
git status
79-
git push
80-
git status
81-
82-
The Scancode-Toolkit webhook with ReadTheDocs should rebuild the documentation after your
83-
Pull Request is Merged.
38+
source venv/bin/activate
39+
make doc8
40+
make docs-check
8441

85-
Refer the `Pro Git Book <https://git-scm.com/book/en/v2/>`_ available online for Git tutorials
86-
covering more complex topics on Branching, Merging, Rebasing etc.
8742

8843
.. _doc_ci:
8944

9045
Continuous Integration
9146
----------------------
9247

93-
The documentations are checked on every new commit through Travis-CI, so that common errors are
94-
avoided and documentation standards are enforced. Travis-CI presently checks for these 3 aspects
95-
of the documentation :
48+
The documentations are checked on every new commit, so that common errors are avoided and
49+
documentation standards are enforced. We checks for these aspects of the documentation:
9650

9751
1. Successful Builds (By using ``sphinx-build``)
98-
2. No Broken Links (By Using ``link-check``)
99-
3. Linting Errors (By Using ``Doc8``)
52+
2. No Broken Links (By Using ``linkcheck``)
53+
3. Linting Errors (By Using ``doc8``)
10054

101-
So run these scripts at your local system before creating a Pull Request::
55+
You myst run these scripts locally before creating a pull request::
10256

103-
cd docs
104-
./scripts/sphinx_build_link_check.sh
105-
./scripts/doc8_style_check.sh
57+
make doc8
58+
make check-docs
10659

107-
If you don't have permission to run the scripts, run::
108-
109-
chmod u+x ./scripts/doc8_style_check.sh
11060

11161
.. _doc_style_docs8:
11262

113-
Style Checks Using ``Doc8``
63+
Style Checks Using ``doc8``
11464
---------------------------
11565

11666
How To Run Style Tests
11767
^^^^^^^^^^^^^^^^^^^^^^
11868

11969
In the project root, run the following commands::
12070

121-
$ cd docs
122-
$ ./scripts/doc8_style_check.sh
71+
make doc8
12372

12473
A sample output is::
12574

@@ -143,11 +92,13 @@ A sample output is::
14392

14493
Now fix the errors and run again till there isn't any style error in the documentation.
14594

95+
14696
What is Checked?
14797
^^^^^^^^^^^^^^^^
14898

14999
PyCQA is an Organization for code quality tools (and plugins) for the Python programming language.
150-
Doc8 is a sub-project of the same Organization. Refer this `README <https://github.com/PyCQA/doc8/blob/main/README.rst>`_ for more details.
100+
Doc8 is a sub-project of the same Organization. Refer this
101+
`README <https://github.com/PyCQA/doc8/blob/main/README.rst>`_ for more details.
151102

152103
What is checked:
153104

@@ -164,16 +115,19 @@ What is checked:
164115
- no carriage returns (use UNIX newlines) - D004
165116
- no newline at end of file - D005
166117

118+
167119
.. _doc_interspinx:
168120

169121
Interspinx
170122
----------
171123

172-
ScanCode toolkit documentation uses `Intersphinx <https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html>`_
124+
AboutCode documentation uses
125+
`Intersphinx <https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html>`_
173126
to link to other Sphinx Documentations, to maintain links to other Aboutcode Projects.
174127

175128
To link sections in the same documentation, standart reST labels are used. Refer
176-
`Cross-Referencing <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_ for more information.
129+
`Cross-Referencing <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_
130+
for more information.
177131

178132
For example::
179133

@@ -223,6 +177,7 @@ Intersphinx, and you link to that label, it will create a link to the local labe
223177
For more information, refer this tutorial named
224178
`Using Intersphinx <https://my-favorite-documentation-test.readthedocs.io/en/latest/using_intersphinx.html>`_.
225179

180+
226181
.. _doc_style_conv:
227182

228183
Style Conventions for the Documentaion
@@ -303,12 +258,14 @@ Style Conventions for the Documentaion
303258
``rst_snippets/warning_snippets/`` and then included to eliminate redundancy, as these are
304259
frequently used in multiple files.
305260

261+
306262
Converting from Markdown
307263
------------------------
308264

309-
If you want to convert a ``.md`` file to a ``.rst`` file, this `tool <https://github.com/chrissimpkins/md2rst>`_
310-
does it pretty well. You'd still have to clean up and check for errors as this contains a lot of
311-
bugs. But this is definitely better than converting everything by yourself.
265+
If you want to convert a ``.md`` file to a ``.rst`` file, this
266+
`tool <https://github.com/chrissimpkins/md2rst>`_ does it pretty well.
267+
You will still have to clean up and check for errors as this contains a lot of bugs. But this is
268+
definitely better than converting everything by yourself.
312269

313270
This will be helpful in converting GitHub wiki's (Markdown Files) to reStructuredtext files for
314271
Sphinx/ReadTheDocs hosting.

0 commit comments

Comments
 (0)