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
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1565,8 +1565,8 @@ cpplint: lint-cpp
# Try with '--system' if it fails without; the system may have set '--user'
lint-py-build: ## Build resources needed to lint python files.
$(info Pip installing ruff on $(shell $(PYTHON) --version)...)
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.6.5 || \
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.6.5
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.13.1 || \
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.13.1

.PHONY: lint-py lint-py-fix lint-py-fix-unsafe
ifneq ("","$(wildcard tools/pip/site-packages/ruff)")
Expand All @@ -1576,7 +1576,6 @@ lint-py:
tools/pip/site-packages/bin/ruff check .
lint-py-fix:
tools/pip/site-packages/bin/ruff check . --fix

lint-py-fix-unsafe:
tools/pip/site-packages/bin/ruff check . --fix --unsafe-fixes
else
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ def check_compiler(o):
print_verbose(f"Detected {'Apple ' if is_apple else ''}{'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
if not ok:
warn(f'failed to autodetect C++ compiler version (CXX={CXX})')
elif (is_apple and clang_version < (17, 0, 0) or not is_apple and clang_version < (19, 1, 0)) if is_clang else gcc_version < (12, 2, 0):
elif ((is_apple and clang_version < (17, 0, 0)) or (not is_apple and clang_version < (19, 1, 0))) if is_clang else gcc_version < (12, 2, 0):
warn(f"C++ compiler (CXX={CXX}, {version_str}) too old, need g++ 12.2.0 or clang++ 19.1.0{' or Apple clang++ 17.0.0' if is_apple else ''}")

ok, is_clang, clang_version, gcc_version, is_apple = try_check_compiler(CC, 'c')
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ target-version = "py39"

[tool.ruff.lint]
select = [
"ASYNC", # flake8-async
"C90", # McCabe cyclomatic complexity
"E", # pycodestyle
"F", # Pyflakes
"ICN", # flake8-import-conventions
"INT", # flake8-gettext
"PERF", # flake8-performance
"PLC", # Pylint conventions
"PLE", # Pylint errors
"PLR09", # Pylint refactoring: max-args, max-branches, max returns, max-statements
Expand All @@ -32,6 +34,7 @@ ignore = [
"E401",
"E402",
"E7",
"PLC0415",
"RUF005",
]

Expand Down
4 changes: 1 addition & 3 deletions test/testpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ def SelectTest(name):
result = []
for subpath in os.listdir(path):
if os.path.isdir(os.path.join(path, subpath)):
for f in os.listdir(os.path.join(path, subpath)):
if SelectTest(f):
result.append([subpath, f[:-3]])
result.extend([subpath, f[:-3]] for f in os.listdir(os.path.join(path, subpath)) if SelectTest(f))
return result

def ListTests(self, current_path, path, arch, mode):
Expand Down
10 changes: 5 additions & 5 deletions test/tools/test_checkimports.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CheckImportsTest(unittest.TestCase):
'test', 'fixtures', 'tools', 'checkimports')

def test_unused_and_unsorted(self):
with captured_output() as (out, err):
with captured_output() as (out, _err):
self.assertEqual(is_valid(path.join(self.fixturesDir, 'invalid.cc')),
False)
output = out.getvalue()
Expand All @@ -42,21 +42,21 @@ def test_unused_and_unsorted(self):
output);

def test_unused_complex(self):
with captured_output() as (out, err):
with captured_output() as (out, _err):
self.assertEqual(is_valid(path.join(self.fixturesDir, 'maybe.cc')),
False)
output = out.getvalue()
self.assertIn('does not use "Local"', output);

def test_unused_simple(self):
with captured_output() as (out, err):
with captured_output() as (out, _err):
self.assertEqual(is_valid(path.join(self.fixturesDir, 'unused.cc')),
False)
output = out.getvalue()
self.assertIn('does not use "Context"', output);

def test_unsorted(self):
with captured_output() as (out, err):
with captured_output() as (out, _err):
self.assertEqual(is_valid(path.join(self.fixturesDir, 'unsorted.cc')),
False)
output = out.getvalue()
Expand All @@ -67,7 +67,7 @@ def test_unsorted(self):
output);

def test_valid(self):
with captured_output() as (out, err):
with captured_output() as (out, _err):
self.assertEqual(is_valid(path.join(self.fixturesDir, 'valid.cc')),
True)
output = out.getvalue()
Expand Down
2 changes: 1 addition & 1 deletion tools/generate_config_gypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def main():
default='//node')
parser.add_argument('--dep-file', help='path to an optional dep file',
default=None)
args, unknown_args = parser.parse_known_args()
args, _unknown_args = parser.parse_known_args()

config = get_gn_config(args.out_dir)
v8_config = get_v8_config(args.out_dir, args.node_gn_path)
Expand Down
10 changes: 5 additions & 5 deletions tools/icu/icutrim.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,17 @@ def removeList(count=0):
removeList(1)

# now, fixup res_index, one at a time
for tree in trees:
for tree, value in trees.items():
# skip trees that don't have res_index
if "hasIndex" not in trees[tree]:
if "hasIndex" not in value:
continue
treebunddir = options.tmpdir
if(trees[tree]["treeprefix"]):
treebunddir = os.path.join(treebunddir, trees[tree]["treeprefix"])
if(value["treeprefix"]):
treebunddir = os.path.join(treebunddir, value["treeprefix"])
if not (os.path.isdir(treebunddir)):
os.mkdir(treebunddir)
treebundres = os.path.join(treebunddir,RES_INDX)
treebundtxt = "%s.txt" % (treebundres[0:-4])
runcmd("iculslocs", "-i %s -N %s -T %s -b %s" % (outfile, dataname, tree, treebundtxt))
runcmd("genrb","-d %s -s %s res_index.txt" % (treebunddir, treebunddir))
runcmd("icupkg","-s %s -a %s%s %s" % (options.tmpdir, trees[tree]["treeprefix"], RES_INDX, outfile))
runcmd("icupkg","-s %s -a %s%s %s" % (options.tmpdir, value["treeprefix"], RES_INDX, outfile))
2 changes: 1 addition & 1 deletion tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def try_copy(options, path, dest):
return shutil.copy2(source_path, target_path)

def try_remove(options, path, dest):
source_path, target_path = mkpaths(options, path, dest)
_source_path, target_path = mkpaths(options, path, dest)
if not options.silent:
print('removing %s' % target_path)
try_unlink(target_path)
Expand Down
4 changes: 2 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ def setResourceLimits():
else:
preexec_fn = setMaxVirtualMemory

(process, exit_code, timed_out) = RunProcess(
(_process, exit_code, timed_out) = RunProcess(
context,
timeout,
args = args,
Expand Down Expand Up @@ -924,7 +924,7 @@ def GetBuildRequirements(self, path, context):
return result

def ListTests(self, current_path, path, context, arch, mode):
(name, rest) = CarCdr(path)
(name, _rest) = CarCdr(path)
result = [ ]
for test in self.tests_repos:
test_name = test.GetName()
Expand Down
Loading