Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
sudo chmod +x llvm.sh
sudo ./llvm.sh ${LLVM_VERSION}
sudo apt-get install clang-format clang-format-${LLVM_VERSION} clang-tidy-${LLVM_VERSION}
- run: flake8
- run: ruff check
- run: ./scripts/clang-format-diff.sh
- name: clang-tidy
Expand Down
21 changes: 21 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
target-version = "py310"
preview = true

exclude = [
'third_party',
'test/lit/lit.cfg.py',
'test/spec/testsuite',
]

[lint.pylint]
max-locals = 30
max-positional-args = 7

[lint.per-file-ignores]
"test/**.py" = ["PLR6301", "PLW1514", "PLR0914"]

[lint]
select = [
"ARG",
"ASYNC",
"B",
"D",
"C4",
"C90",
"COM",
Expand All @@ -27,17 +36,29 @@ select = [

ignore = [
"C901", # https://docs.astral.sh/ruff/rules/complex-structure/
"D100", # https://docs.astral.sh/ruff/rules/undocumented-public-module/
"D101", # https://docs.astral.sh/ruff/rules/undocumented-public-class/
"D102", # https://docs.astral.sh/ruff/rules/undocumented-public-method/
"D103", # https://docs.astral.sh/ruff/rules/undocumented-public-function/
"D104", # https://docs.astral.sh/ruff/rules/undocumented-public-package/
"D105", # https://docs.astral.sh/ruff/rules/undocumented-magic-method/
"D203", # https://docs.astral.sh/ruff/rules/incorrect-blank-line-before-class/
"D213", # https://docs.astral.sh/ruff/rules/multi-line-summary-second-line/
"D107", # https://docs.astral.sh/ruff/rules/undocumented-public-init/
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default/
"B011", # https://docs.astral.sh/ruff/rules/assert-false/
"B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable/
"E501", # https://docs.astral.sh/ruff/rules/line-too-long/
"E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name/
"PERF401", # https://docs.astral.sh/ruff/rules/manual-list-comprehension/
"PLR0904", # https://docs.astral.sh/ruff/rules/too-many-public-methods/
"PLR0912", # https://docs.astral.sh/ruff/rules/too-many-branches/
"PLR0913", # https://docs.astral.sh/ruff/rules/too-many-arguments/
"PLR0915", # https://docs.astral.sh/ruff/rules/too-many-statements/
"PLR1702", # https://docs.astral.sh/ruff/rules/too-many-nested-blocks/
"PLR2004", # https://docs.astral.sh/ruff/rules/magic-value-comparison/
"PLW0603", # https://docs.astral.sh/ruff/rules/global-statement/
"PLW1510", # https://docs.astral.sh/ruff/rules/subprocess-run-without-check/
"PLW2901", # https://docs.astral.sh/ruff/rules/redefined-loop-name/
"PLW1514", # https://docs.astral.sh/ruff/rules/unspecified-encoding/
]
4 changes: 3 additions & 1 deletion check.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ def run_one_spec_test(wast: Path, stdout=None):


def run_spec_test_with_wrapped_stdout(wast: Path):
"""Return (bool, str) where the first element is whether the test was
"""Run a single spec test while capturing stdout.

Return (bool, str) where the first element is whether the test was
successful and the second is the combined stdout and stderr of the test.
"""
out = io.StringIO()
Expand Down
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# These requirements are only needed for developers who want to run the test
# suite or flake8, not for end users.
# suite, or CI checks, not for end users.

# Install with `pip3 install -r requirements-dev.txt`

flake8==7.3.0
ruff==0.14.1
filecheck==0.0.22
lit==0.11.0.post1
5 changes: 2 additions & 3 deletions scripts/bundle_clusterfuzz.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/python3

'''
Bundle files for uploading to ClusterFuzz.
"""Bundle files for uploading to ClusterFuzz.

Usage:

Expand Down Expand Up @@ -68,7 +67,7 @@

3. Check the stats and crashes page (known crashes should at least be showing
up). Note that these may take longer to show up than 1 and 2.
'''
"""

import glob
import os
Expand Down
13 changes: 7 additions & 6 deletions scripts/clusterfuzz/embed_wasms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

'''
Reverse script for extract_wasms.py: That one extracts wasm files from a
JavaScript testcase (which has wasm files embedded as arrays of numbers), and
this one re-embeds them back. To do so, we use the magic comments that the
extractor uses: it replaces each wasm array with
"""Reverse of extract_wasms.py.

extract_wasms.py extracts wasm files from a JavaScript testcase (which has wasm
files embedded as arrays of numbers), and this script re-embeds them back. To
do so, we use the magic comments that the extractor uses: it replaces each
wasm array with

'undefined /* extracted wasm */'

Expand All @@ -39,7 +40,7 @@

The first argument is the input JS, then the wasm files, then the last argument
is the output JS.
'''
"""

import re
import sys
Expand Down
8 changes: 4 additions & 4 deletions scripts/clusterfuzz/extract_wasms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

'''
Wasm extractor for testcases generated by the ClusterFuzz run.py script. This is
general enough to also handle Fuzzilli output.
"""Wasm extractor for testcases generated by the ClusterFuzz run.py script.

This is general enough to also handle Fuzzilli output.

Usage:

Expand All @@ -32,7 +32,7 @@
d8 OUTFILE.js -- OUTFILE.0.wasm

That is, the embedded file can now be provided as a filename argument.
'''
"""

import re
import sys
Expand Down
9 changes: 5 additions & 4 deletions scripts/clusterfuzz/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

'''
ClusterFuzz run.py script: when run by ClusterFuzz, it uses wasm-opt to generate
a fixed number of testcases. This is a "blackbox fuzzer", see
"""ClusterFuzz run.py script.

When run by ClusterFuzz, it uses wasm-opt to generate a fixed number of
testcases. This is a "blackbox fuzzer", see

https://google.github.io/clusterfuzz/setting-up-fuzzing/blackbox-fuzzing/

This file should be bundled up together with the other files it needs, see
bundle_clusterfuzz.py.
'''
"""

import getopt
import math
Expand Down
Loading
Loading