Skip to content

Commit f3ca9c6

Browse files
Aviv Kellertargos
Aviv Keller
authored andcommitted
build: update ruff and add lint-py-fix
PR-URL: #54410 Reviewed-By: Christian Clauss <cclauss@me.com>
1 parent 80da599 commit f3ca9c6

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Makefile

+10-4
Original file line numberDiff line numberDiff line change
@@ -1536,17 +1536,22 @@ cpplint: lint-cpp
15361536
# Try with '--system' if it fails without; the system may have set '--user'
15371537
lint-py-build:
15381538
$(info Pip installing ruff on $(shell $(PYTHON) --version)...)
1539-
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.5.2 || \
1540-
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.5.2
1539+
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.6.5 || \
1540+
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.6.5
15411541

1542-
.PHONY: lint-py
1542+
.PHONY: lint-py lint-py-fix lint-py-fix-unsafe
15431543
ifneq ("","$(wildcard tools/pip/site-packages/ruff)")
15441544
# Lint the Python code with ruff.
15451545
lint-py:
15461546
$(info Running Python linter...)
15471547
tools/pip/site-packages/bin/ruff check .
1548+
lint-py-fix:
1549+
tools/pip/site-packages/bin/ruff check . --fix
1550+
1551+
lint-py-fix-unsafe:
1552+
tools/pip/site-packages/bin/ruff check . --fix --unsafe-fixes
15481553
else
1549-
lint-py:
1554+
lint-py lint-py-fix lint-py-fix-unsafe:
15501555
$(warning Python linting with ruff is not available)
15511556
$(warning Run 'make lint-py-build')
15521557
endif
@@ -1604,6 +1609,7 @@ lint-clean:
16041609
$(RM) tools/.*lintstamp
16051610
$(RM) .eslintcache
16061611
$(RM) -r tools/eslint/node_modules
1612+
$(RM) tools/pip/site_packages
16071613

16081614
HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
16091615

tools/v8-json-to-junit.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import utils
3535
import signal
3636
import sys
37-
import xml.etree.ElementTree as xml
37+
import xml.etree.ElementTree as ET
3838

3939
def IsExitCodeCrashing(exit_code):
4040
if utils.IsWindows():
@@ -44,22 +44,22 @@ def IsExitCodeCrashing(exit_code):
4444

4545
class JUnitTestOutput:
4646
def __init__(self, test_suite_name):
47-
self.root = xml.Element("testsuite")
47+
self.root = ET.Element("testsuite")
4848
self.root.attrib["name"] = test_suite_name
4949

5050
def HasRunTest(self, test_name, test_cmd, test_duration, test_failure):
51-
test_case_element = xml.Element("testcase")
51+
test_case_element = ET.Element("testcase")
5252
test_case_element.attrib["name"] = test_name
5353
test_case_element.attrib["cmd"] = test_cmd
5454
test_case_element.attrib["time"] = str(round(test_duration, 3))
5555
if test_failure is not None:
56-
failure_element = xml.Element("failure")
56+
failure_element = ET.Element("failure")
5757
failure_element.text = test_failure
5858
test_case_element.append(failure_element)
5959
self.root.append(test_case_element)
6060

6161
def FinishAndWrite(self, f):
62-
xml.ElementTree(self.root).write(f, "UTF-8")
62+
ET.ElementTree(self.root).write(f, "UTF-8")
6363

6464

6565
def Main():

0 commit comments

Comments
 (0)