amoeba commented on code in PR #40022:
URL: https://github.com/apache/arrow/pull/40022#discussion_r1505240004
##########
.pre-commit-config.yaml:
##########
@@ -36,6 +36,12 @@ repos:
- dockerfile
entry: --entrypoint /bin/hadolint hadolint/hadolint:latest -
exclude: ^dev/.*$
+ - id: sphinx-lint
+ name: Sphinx Lint
+ entry: archery lint --docs
+ language: system
Review Comment:
Okay this is ready for another look. I changed the pre-commit config so it
doesn't need archery to be installed and instead works similarly to the other
hooks like flake8 (i.e., automatically).
One odd thing came up which is that the output gets printed twice when
pre-commit runs. I did some research and it looks like pre-commit runs hooks in
multiple stages and there are cases where hooks run multiple times, just in
different stages. I tried manually specifying `stages` [as outlined in the
documentation](https://pre-commit.com/#confining-hooks-to-run-at-certain-stages)
but that didn't seem to have any effect. Any ideas @jorisvandenbossche?
Either way, here's what this PR looks like now:
First, introduce some changes that sphinx-lint would be expected to catch
and stage them:
```sh
$ git diff --staged
diff --git a/docs/source/cpp/env_vars.rst b/docs/source/cpp/env_vars.rst
index 0fa80aa11..ff2fbe52f 100644
--- a/docs/source/cpp/env_vars.rst
+++ b/docs/source/cpp/env_vars.rst
@@ -24,10 +24,12 @@ Environment Variables
The following environment variables can be used to affect the behavior of
Arrow C++ at runtime. Many of these variables are inspected only once per
process (for example, when the Arrow C++ DLL is loaded), so you cannot
assume
-that changing their value later will have an effect.
+that changing their value later will have an effect.
+
.. envvar:: ACERO_ALIGNMENT_HANDLING
+
Arrow C++'s Acero module performs computation on streams of data. This
computation may involve a form of "type punning" that is technically
undefined behavior if the underlying array is not properly aligned. On
```
Then install archery[lint] and run:
```sh
$ archery lint --docs
INFO:archery:Running docs linter (sphinx-lint)
/Users/bryce/src/apache/arrow/docs/source/cpp/env_vars.rst:27: trailing
whitespace (trailing-whitespace)
/Users/bryce/src/apache/arrow/docs/source/cpp/env_vars.rst:29: trailing
whitespace (trailing-whitespace)
/Users/bryce/src/apache/arrow/docs/source/cpp/env_vars.rst:32: trailing
whitespace (trailing-whitespace)
```
The output is similar if we install and run sphinx-lint directly:
```sh
$ sphinx-lint --disable all --enable
trailing-whitespace,missing-final-newline docs
docs/source/cpp/env_vars.rst:27: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:29: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:32: trailing whitespace (trailing-whitespace)
```
Though we get duplicated but otherwise correct output if we run run
pre-commit directly though:
```sh
$ pre-commit run
Release Audit
Tool.......................................................Passed
Docker Format........................................(no files to
check)Skipped
Python Format........................................(no files to
check)Skipped
cython-lint..........................................(no files to
check)Skipped
Sphinx
Lint..............................................................Failed
- hook id: sphinx-lint
- exit code: 1
docs/source/cpp/env_vars.rst:27: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:29: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:32: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:27: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:29: trailing whitespace (trailing-whitespace)
docs/source/cpp/env_vars.rst:32: trailing whitespace (trailing-whitespace)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]