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
59 changes: 32 additions & 27 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ max-locals = 30
max-positional-args = 7

[lint.per-file-ignores]
"test/**.py" = ["PLR6301", "PLW1514", "PLR0914"]
"test/**.py" = ["no-self-use", "unspecified-encoding", "too-many-locals"]

[lint]
select = [
Expand All @@ -31,34 +31,39 @@ select = [
"PL",
"UP",
"W",
"RUF",
"YTT",
]

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/
"ambiguous-variable-name",
"assert-false",
"collection-literal-concatenation",
"complex-structure",
"float-equality-comparison",
"function-uses-loop-variable",
"global-statement",
"incorrect-blank-line-before-class",
"line-too-long",
"magic-value-comparison",
"manual-list-comprehension",
"multi-line-summary-second-line",
"mutable-argument-default",
"mutable-class-default",
"redefined-loop-name",
"subprocess-run-without-check",
"too-many-arguments",
"too-many-branches",
"too-many-nested-blocks",
"too-many-public-methods",
"too-many-statements",
"too-many-statements-in-try-clause",
"undocumented-magic-method",
"undocumented-public-class",
"undocumented-public-function",
"undocumented-public-init",
"undocumented-public-method",
"undocumented-public-module",
"undocumented-public-package",
"unspecified-encoding",
]
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

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

ruff==0.14.1
ruff==0.16.0
filecheck==0.0.22
lit==0.11.0.post1
8 changes: 5 additions & 3 deletions scripts/bundle_clusterfuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@
# Delete the argument, as importing |shared| scans it.
sys.argv.pop()

from test import fuzzing # noqa
from test import shared # noqa
from test import support # noqa
from test import ( # ruff: ignore[module-import-not-at-top-of-file]
fuzzing,
shared,
support,
)

# Pick where to get the builds
if build_dir:
Expand Down
2 changes: 1 addition & 1 deletion scripts/clusterfuzz/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def get_js_file_contents(i, output_dir):
args = []
if system_random.random() < 0.8:
args = [f'--fuzz-import={wasm_file}']
second_wasm_contents, second_wasm_file = \
second_wasm_contents, _second_wasm_file = \
get_wasm_contents(f'{i}_second', output_dir, args)
pre += f'var secondBinary = {second_wasm_contents};\n'
bytes += second_wasm_contents.count(',')
Expand Down
8 changes: 4 additions & 4 deletions scripts/fuzz_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
script covers different options being passed)
"""

# ruff: noqa: COM819, ARG002
# ruff: file-ignore[prohibited-trailing-comma, unused-method-argument]

import contextlib
import difflib
Expand Down Expand Up @@ -1149,7 +1149,7 @@ def fix_output_for_js(x):
# of the wrong type - which would be cast on use, but if we remove
# the casts, we end up returning null here and not 0, which the
# fuzzer can notice.
x = re.sub(r' null', ' 0', x)
x = x.replace(r' null', ' 0')

# wasm2js converts exports to valid JS forms, which affects some of
# the names in the test suite. Fix those up.
Expand Down Expand Up @@ -2117,8 +2117,8 @@ def compare_to_merged_output(output, merged_output):
assert b.startswith(FUZZ_EXEC_NOTE_RESULT)
assert a.count(' => ') == 1
assert b.count(' => ') == 1
a_prefix, a_result = a.split(' => ')
b_prefix, b_result = b.split(' => ')
a_prefix, _a_result = a.split(' => ')
_b_prefix, b_result = b.split(' => ')
# Copy a's prefix with b's result.
merged_output_lines[i] = a_prefix + ' => ' + b_result

Expand Down
2 changes: 1 addition & 1 deletion scripts/fuzz_relooper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

"""Script that fuzzes the relooper using the C API."""

# ruff: noqa: UP031
# ruff: file-ignore[printf-string-formatting]

import difflib
import os
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen-s-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

assert sys.version_info >= (3, 10), 'requires Python 3.10'

# ruff: noqa: E241
# ruff: file-ignore[multiple-spaces-after-comma]

instructions = [
("unreachable", "makeUnreachable()"),
Expand Down
3 changes: 1 addition & 2 deletions test/unit/test_fuzz_preserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ def process_wat(self, wat):

# Given the types we saw for params or results, look in detail for the
# things we expect to see.
def found_expected(self, data):
def found_expected(self, data): # ruff: ignore[too-many-return-statements]
# The many returns here seem to be the best way to write this code.
# ruff: noqa: PLR0911

# Look for significant variety.
if len(data) < 5:
Expand Down
Loading