Skip to content

Commit 6c57132

Browse files
authored
Add rstcheck in pre-commit (#3777)
* Fix a bunch of rstcheck warnings * Add rstcheck to pre-commit * Ignore automodule * Update changelog and contributing * tox -e ruff -> tox -e precommit But keep the old name for compat
1 parent 17aba81 commit 6c57132

File tree

14 files changed

+35
-23
lines changed

14 files changed

+35
-23
lines changed

.github/workflows/misc_0.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ jobs:
157157
- name: Run tests
158158
run: tox -e shellcheck
159159

160-
ruff:
161-
name: ruff
160+
precommit:
161+
name: precommit
162162
runs-on: ubuntu-latest
163163
timeout-minutes: 30
164164
steps:
@@ -174,7 +174,7 @@ jobs:
174174
run: pip install tox-uv
175175

176176
- name: Run tests
177-
run: tox -e ruff
177+
run: tox -e precommit
178178

179179
typecheck:
180180
name: typecheck

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ repos:
1313
rev: 0.6.0
1414
hooks:
1515
- id: uv-lock
16+
- repo: https://github.com/rstcheck/rstcheck
17+
rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5
18+
hooks:
19+
- id: rstcheck
20+
additional_dependencies: ['rstcheck[sphinx]']
21+
args: ["--report-level", "warning"]

.rstcheck.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[rstcheck]
2+
ignore_directives = automodule

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
### Added
1717
- `opentelemetry-instrumentation`: botocore: Add support for AWS Secrets Manager semantic convention attribute
1818
([#3765](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3765))
19+
- Add `rstcheck` to pre-commit to stop introducing invalid RST
20+
([#3777](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3777))
21+
1922

2023
## Version 1.37.0/0.58b0 (2025-09-11)
2124

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ You can run `tox` with the following arguments:
8484
* `tox -e lint-some-package` to run lint checks on `some-package`
8585
* `tox -e generate-workflows` to run creation of new CI workflows if tox environments have been updated
8686
* `tox -e ruff` to run ruff linter and formatter checks against the entire codebase
87+
* `tox -e precommit` to run all `pre-commit` actions
8788

88-
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
89+
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` and `rstcheck` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
8990

9091
```console
9192
pip install pre-commit -c dev-requirements.txt

_template/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenTelemetry <REPLACE ME> Instrumentation
2-
===========================
2+
==========================================
33

44
|pypi|
55

@@ -20,5 +20,5 @@ Installation
2020
References
2121
----------
2222

23-
* `OpenTelemetry <REPLACE ME>/ Tracing <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/<REPLACE ME>/<REPLACE ME>.html>`_
23+
* `OpenTelemetry REPLACE ME/ Tracing <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/REPLACE ME/REPLACE ME.html>`_
2424
* `OpenTelemetry Project <https://opentelemetry.io/>`_

instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/manual/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenTelemetry Google GenAI SDK Manual Instrumentation Example
2-
============================================
2+
=============================================================
33

44
This is an example of how to instrument Google GenAI SDK calls when configuring
55
OpenTelemetry SDK and Instrumentations manually.

instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/zero-code/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenTelemetry Google GenAI SDK Manual Instrumentation Example
2-
============================================
2+
=============================================================
33

44
This is an example of how to instrument Google GenAI SDK calls with zero code changes,
55
using `opentelemetry-instrument`.

instrumentation-genai/opentelemetry-instrumentation-langchain/examples/manual/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
OpenTelemetry Langcahin Instrumentation Example
2-
============================================
2+
===============================================
33

44
This is an example of how to instrument Langchain when configuring OpenTelemetry SDK and instrumentations manually.
55

6-
When :code:`main.py <main.py>`_ is run, it exports traces to an OTLP-compatible endpoint.
6+
When `main.py <main.py>`_ is run, it exports traces to an OTLP-compatible endpoint.
77
Traces include details such as the span name and other attributes.
88

9-
Note: :code:`.env <.env>`_ file configures additional environment variables:
9+
Note: `.env <.env>`_ file configures additional environment variables:
1010
- :code:`OTEL_LOGS_EXPORTER=otlp` to specify exporter type.
1111
- :code:`OPENAI_API_KEY` open AI key for accessing the OpenAI API.
1212
- :code:`OTEL_EXPORTER_OTLP_ENDPOINT` to specify the endpoint for exporting traces (default is http://localhost:4317).
1313

1414
Setup
1515
-----
1616

17-
Minimally, update the :code:`.env <.env>`_ file with your :code:`OPENAI_API_KEY`.
17+
Minimally, update the `.env <.env>`_ file with your :code:`OPENAI_API_KEY`.
1818
An OTLP compatible endpoint should be listening for traces http://localhost:4317.
1919
If not, update :code:`OTEL_EXPORTER_OTLP_ENDPOINT` as well.
2020

instrumentation-genai/opentelemetry-instrumentation-langchain/examples/zero-code/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
OpenTelemetry Langchain Zero-Code Instrumentation Example
2-
======================================================
2+
=========================================================
33

44
This is an example of how to instrument Langchain with zero code changes,
55
using `opentelemetry-instrument`.
66

7-
When :code:`main.py <main.py>`_ is run, it exports traces to an OTLP-compatible endpoint.
7+
When `main.py <main.py>`_ is run, it exports traces to an OTLP-compatible endpoint.
88
Traces include details such as the span name and other attributes.
99

10-
Note: :code:`.env <.env>`_ file configures additional environment variables:
10+
Note: `.env <.env>`_ file configures additional environment variables:
1111
- :code:`OTEL_LOGS_EXPORTER=otlp` to specify exporter type.
1212
- :code:`OPENAI_API_KEY` open AI key for accessing the OpenAI API.
1313
- :code:`OTEL_EXPORTER_OTLP_ENDPOINT` to specify the endpoint for exporting traces (default is http://localhost:4317).
1414

1515
Setup
1616
-----
1717

18-
Minimally, update the :code:`.env <.env>`_ file with your :code:`OPENAI_API_KEY`.
18+
Minimally, update the `.env <.env>`_ file with your :code:`OPENAI_API_KEY`.
1919
An OTLP compatible endpoint should be listening for traces http://localhost:4317.
2020
If not, update :code:`OTEL_EXPORTER_OTLP_ENDPOINT` as well.
2121

0 commit comments

Comments
 (0)