Skip to content

Commit 7bad7f7

Browse files
[doc] Add a CI check for the doc being properly generated
And cleanup the doc about dev installation for contributors.
1 parent 7aa1f08 commit 7bad7f7

File tree

5 files changed

+58
-45
lines changed

5 files changed

+58
-45
lines changed

.github/workflows/checks.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,5 @@ jobs:
189189
run: |
190190
. venv/bin/activate
191191
cd doc
192-
make html
192+
pre-commit run --hook-stage push sphinx-generated-doc --all-files || { echo echo "Make sure that there \
193+
are no modification locally when launching 'make html'" ; exit 1; }

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ repos:
7474
args: ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I", "--spelling-dict=en"]
7575
exclude: tests/functional/|tests/input|tests(/\w*)*data/|doc/
7676
stages: [manual]
77+
- id: sphinx-generated-doc
78+
alias: sphinx-generated-doc
79+
name: sphinx-generated-doc
80+
entry: make -C doc/ html
81+
pass_filenames: false
82+
language: system
83+
stages: [push]
7784
- id: fix-documentation
7885
name: Fix documentation
7986
entry: python3 -m script.fix_documentation

doc/development_guide/contributor_guide/contribute.rst

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,13 @@
66

77
.. _repository:
88

9-
Repository
10-
----------
11-
12-
Pylint is developed using the git_ distributed version control system.
13-
14-
You can clone Pylint and its dependencies from ::
15-
16-
git clone https://github.com/PyCQA/pylint
17-
git clone https://github.com/PyCQA/astroid
18-
19-
.. _git: https://git-scm.com/
20-
219
Got a change for Pylint? Below are a few steps you should take to make sure
22-
your patch gets accepted. We recommend using Python 3.8 or higher for development
23-
of Pylint as it gives you access to the latest ``ast`` parser.
24-
25-
- Test your code
26-
27-
For more information on how to use our test suite and write new tests see :ref:`testing`.
10+
your patch gets accepted:
2811

29-
- ``pylint`` uses black_ and isort_ among other Python auto-formatters.
30-
We have a pre-commit hook which should take care of the autoformatting for
31-
you. To enable it, do the following:
32-
33-
* install ``pre-commit`` using ``pip install pre-commit``
34-
35-
* then run ``pre-commit install`` in the ``pylint`` root directory to enable the git hooks.
12+
- We recommend using Python 3.8 or higher for development of Pylint as it gives
13+
you access to the latest ``ast`` parser.
14+
- Install the dev dependencies, see :ref:`contributor_install`.
15+
- Use our test suite and write new tests, see :ref:`contributor_testing`.
3616

3717
- Add a short entry to the change log describing the change, except for internal
3818
implementation only changes.
@@ -42,6 +22,8 @@ of Pylint as it gives you access to the latest ``ast`` parser.
4222
`What's New` section). For the release document we usually write some more details,
4323
and it is also a good place to offer examples on how the new change is supposed to work.
4424

25+
- Document your change, if it is a non-trivial one.
26+
4527
- If you used multiple emails or multiple names when contributing, add your mails
4628
and preferred name in the ``script/.contributors_aliases.json`` file.
4729

@@ -51,8 +33,6 @@ of Pylint as it gives you access to the latest ``ast`` parser.
5133
`Closing issues via commit messages`_ of the GitHub documentation for more
5234
information on this)
5335

54-
- Document your change, if it is a non-trivial one.
55-
5636
- Send a pull request from GitHub (see `About pull requests`_ for more insight
5737
about this topic)
5838

doc/development_guide/contributor_guide/tests/index.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
.. _testing:
2-
3-
=======
4-
Testing
5-
=======
6-
1+
.. _contributor_testing:
72
.. _test_your_code:
83

4+
==============
5+
Testing pylint
6+
==============
7+
98
Pylint is very well tested and has a high code coverage. New contributions are not accepted
109
unless they include tests.
1110

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,51 @@
1-
Installation
2-
============
1+
.. _contributor_install:
2+
3+
Contributor installation
4+
========================
5+
6+
Basic installation
7+
------------------
8+
9+
Pylint is developed using the git_ distributed version control system.
10+
11+
You can clone Pylint using ::
12+
13+
git clone https://github.com/PyCQA/pylint
314

415
Before you start testing your code, you need to install your source-code package locally.
5-
Suppose you have cloned pylint into a directory, say ``my-pylint``.
6-
To set up your environment for testing, open a terminal and run::
16+
Suppose you just cloned pylint with the previous ``git clone`` command. To set up your
17+
environment for testing, open a terminal and run::
718

8-
cd my-pylint
19+
cd pylint
20+
python3 -m venv venv
21+
source venv/bin/activate
922
pip install -r requirements_test_min.txt
1023

1124
This ensures your testing environment is similar to Pylint's testing environment on GitHub.
1225

13-
If you're testing new changes in astroid you need to clone astroid_ and install
14-
with an editable installation as follows::
26+
**Optionally** (Because there's an auto-fix if you open a merge request): We have
27+
pre-commit hooks which should take care of the autoformatting for you before each
28+
commits. To enable it, run ``pre-commit install`` in the ``pylint`` root directory.
29+
30+
**Even more optionally**: You can enable slow on push hooks with ``pre-commit install --install-hooks -t pre-push``.
31+
It will do slow checks like checking that the generated documentation is up to date
32+
before each push.
33+
34+
Astroid installation
35+
--------------------
36+
37+
If you're testing new changes in astroid you need to also clone astroid_ and install
38+
with an editable installation alongside pylint as follows::
1539

40+
# Suppose you're in the pylint directory
1641
git clone https://github.com/PyCQA/astroid.git
17-
cd astroid
18-
python3 -m pip install -e .
42+
python3 -m pip install -e astroid/
1943

20-
If you want to check the coverage locally, consider using `pytest-cov`_::
44+
You're now using the local astroid in pylint and can control the version with git for example::
2145

22-
python3 -m pip install pytest-cov
46+
cd astroid/
47+
git switch my-astroid-dev-branch
2348

2449
.. _pytest-cov: https://pypi.org/project/pytest-cov/
2550
.. _astroid: https://github.com/pycqa/astroid
51+
.. _git: https://git-scm.com/

0 commit comments

Comments
 (0)