Skip to content

Commit

Permalink
[CI] Add ratchet for doctests (ray-project#37584)
Browse files Browse the repository at this point in the history
code-block:: python isn't tested, so we want to use testcode going forward. This PR adds a ratchet to ensure that libraries with tested code snippets continue to get tested.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
  • Loading branch information
bveeramani committed Jul 25, 2023
1 parent 665cfa8 commit 016a21e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .buildkite/pipeline.build_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
commands:
- ./ci/v2/lint.sh copyright

- label: "semgrep"
commands:
- ./ci/v2/lint.sh run_semgrep

- label: "test script"
commands:
- ./ci/v2/lint.sh test_script
Expand Down
4 changes: 4 additions & 0 deletions ci/v2/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ annotations() {
"${ROOT_DIR}"/lint/check_api_annotations.py
}

run_semgrep() {
semgrep ci --config "${WORKSPACE_DIR}/semgrep.yml"
}

bazel_buildifier() {
LINT_BAZEL_TMP="$(mktemp -d)"
curl -sl "https://github.com/bazelbuild/buildtools/releases/download/v6.1.2/buildifier-linux-amd64" \
Expand Down
1 change: 1 addition & 0 deletions python/requirements/lint-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ mypy==0.982
types-PyYAML==6.0.12.2
black==22.10.0
isort==5.10.1
semgrep==1.32.0
2 changes: 1 addition & 1 deletion python/requirements/ml/rllib-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ imageio-ffmpeg==0.4.5
onnx==1.12.0; sys_platform != 'darwin' or platform_machine != 'arm64'
onnxruntime==1.14.1; sys_platform != 'darwin' or platform_machine != 'arm64'
tf2onnx==1.13.0; sys_platform != 'darwin' or platform_machine != 'arm64'
rich==12.0.1
rich==12.6.0
# Msgpack checkpoint stuff.
msgpack
msgpack_numpy
2 changes: 1 addition & 1 deletion python/requirements_compiled.txt
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ restrictedpython==6.0
retry-decorator==1.1.1
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==12.0.1
rich==12.6.0
rsa==4.7.2
s3fs==2023.5.0 ; python_version >= "3.8"
s3transfer==0.6.1
Expand Down
13 changes: 13 additions & 0 deletions semgrep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rules:
- id: code-block-python
paths:
include:
- "python/ray/data/**/*.py"
- "doc/source/data/**/*.rst"
languages:
- generic
message: >
Don't use 'code-block:: python', it's not tested! Use 'testcode' instead! For more
information, see https://docs.ray.io/en/master/ray-contribute/writing-code-snippets.html.
pattern: "code-block:: python"
severity: ERROR

0 comments on commit 016a21e

Please sign in to comment.