Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pyproject.toml #56409

Closed
wants to merge 1 commit into from

Conversation

yuvashrikarunakaran
Copy link

Here’s the refined ruff configuration file after removing unnecessary entries and improving clarity

Here’s the refined ruff configuration file after removing unnecessary entries and improving clarity
"PYI", # flake8-pyi
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"T10", # flake8-debugger
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"W", # pycodestyle
"YTT", # flake8-2020
"YTT" # flake8-2020
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"YTT" # flake8-2020
"YTT", # flake8-2020

@Trott
Copy link
Member

Trott commented Jan 1, 2025

This breaks linting. These kinds of (LLM?) tool-generated PRs provide little-to-no value for the code base and require a lot of time from maintainers to review. Please don't submit these.

Running Python linter...
tools/pip/site-packages/bin/ruff check .
configure.py:1068:29: RUF005 Consider `[*shlex.split(cc), '-E', '-P', '-x', lang, '-']` instead of concatenation
     |
1066 | def try_check_compiler(cc, lang):
1067 |   try:
1068 |     proc = subprocess.Popen(shlex.split(cc) + ['-E', '-P', '-x', lang, '-'],
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
1069 |                             stdin=subprocess.PIPE, stdout=subprocess.PIPE)
1070 |   except OSError:
     |
     = help: Replace with `[*shlex.split(cc), '-E', '-P', '-x', lang, '-']`

configure.py:1097:29: RUF005 Consider `[*shlex.split(cc), '-v']` instead of concatenation
     |
1095 | def get_version_helper(cc, regexp):
1096 |   try:
1097 |     proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE,
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
1098 |                             stderr=subprocess.PIPE, stdout=subprocess.PIPE)
1099 |   except OSError:
     |
     = help: Replace with `[*shlex.split(cc), '-v']`

configure.py:1113:29: RUF005 Consider `[*shlex.split(asm), '-v']` instead of concatenation
     |
1111 | def get_nasm_version(asm):
1112 |   try:
1113 |     proc = subprocess.Popen(shlex.split(asm) + ['-v'],
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
1114 |                             stdin=subprocess.PIPE, stderr=subprocess.PIPE,
1115 |                             stdout=subprocess.PIPE)
     |
     = help: Replace with `[*shlex.split(asm), '-v']`

configure.py:1140:29: RUF005 Consider iterable unpacking instead of concatenation
     |
1138 |       custom_env = os.environ.copy()
1139 |       custom_env["LC_ALL"] = "C"
1140 |       proc = subprocess.Popen(shlex.split(cc) + ['-Wa,-v', '-c', '-o',
     |  _____________________________^
1141 | |                                                '/dev/null', '-x',
1142 | |                                                'assembler',  '/dev/null'],
     | |_________________________________________________________________________^ RUF005
1143 |                               stdin=subprocess.PIPE, stderr=subprocess.PIPE,
1144 |                               stdout=subprocess.PIPE, env=custom_env)
     |
     = help: Replace with iterable unpacking

configure.py:1220:26: RUF005 Consider `[*shlex.split(cc or CC), '-dM', '-E', '-']` instead of concatenation
     |
1219 |   try:
1220 |     p = subprocess.Popen(shlex.split(cc or CC) + ['-dM', '-E', '-'],
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
1221 |                          stdin=subprocess.PIPE,
1222 |                          stdout=subprocess.PIPE,
     |
     = help: Replace with `[*shlex.split(cc or CC), '-dM', '-E', '-']`

configure.py:1391:5: C901 `configure_node` is too complex (48 > 20)
     |
1389 |   o['variables']['node_library_files'] = SearchFiles('lib', 'js')
1390 | 
1391 | def configure_node(o):
     |     ^^^^^^^^^^^^^^ C901
1392 |   if options.dest_os == 'android':
1393 |     o['variables']['OS'] = 'android'
     |

configure.py:1453:121: E501 Line too long (127 > 120)
     |
1451 |   # Do not use code cache when Node.js is built for collecting coverage of itself, this allows more
1452 |   # precise coverage for the JS built-ins.
1453 |   if options.without_node_code_cache or options.without_node_snapshot or options.node_builtin_modules_path or options.coverage:
     |                                                                                                                         ^^^^^^^ E501
1454 |     o['variables']['node_use_node_code_cache'] = 'false'
1455 |   else:
     |

configure.py:1638:34: E741 Ambiguous variable name: `l`
     |
1637 |     default_libs = getattr(options, shared_lib + '_libname')
1638 |     default_libs = [f'-l{l}' for l in default_libs.split(',')]
     |                                  ^ E741
1639 | 
1640 |     if default_libs:
     |

configure.py:1664:121: E501 Line too long (127 > 120)
     |
1662 |   o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0
1663 |   o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
1664 |   o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1
     |                                                                                                                         ^^^^^^^ E501
1665 |   o['variables']['v8_enable_extensible_ro_snapshot'] = 0
1666 |   o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
     |

configure.py:1813:5: C901 `configure_intl` is too complex (47 > 20)
     |
1811 |   return file_list
1812 | 
1813 | def configure_intl(o):
     |     ^^^^^^^^^^^^^^ C901
1814 |   def icu_download(path):
1815 |     depFile = tools_path / 'icu' / 'current_ver.dep'
     |

configure.py:2118:29: RUF005 Consider `['ld.gold', '-v']` instead of concatenation
     |
2116 | def configure_section_file(o):
2117 |   try:
2118 |     proc = subprocess.Popen(['ld.gold'] + ['-v'], stdin = subprocess.PIPE,
     |                             ^^^^^^^^^^^^^^^^^^^^ RUF005
2119 |                             stdout = subprocess.PIPE, stderr = subprocess.PIPE)
2120 |   except OSError:
     |
     = help: Replace with `['ld.gold', '-v']`

configure.py:2336:44: RUF005 Consider `['python', 'tools/gyp_node.py', *gyp_args]` instead of concatenation
     |
2334 |   warn('warnings were emitted in the configure phase')
2335 | 
2336 | print_verbose("running: \n    " + " ".join(['python', 'tools/gyp_node.py'] + gyp_args))
     |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
2337 | run_gyp(gyp_args)
2338 | if options.compile_commands_json and sys.platform == 'win32':
     |
     = help: Replace with `['python', 'tools/gyp_node.py', *gyp_args]`

test/message/testcfg.py:50:23: E701 Multiple statements on one line (colon)
   |
48 |   def IgnoreLine(self, str):
49 |     """Ignore empty lines and valgrind output."""
50 |     if not str.strip(): return True
   |                       ^ E701
51 |     else: return str.startswith('==') or str.startswith('**')
   |

test/message/testcfg.py:51:9: E701 Multiple statements on one line (colon)
   |
49 |     """Ignore empty lines and valgrind output."""
50 |     if not str.strip(): return True
51 |     else: return str.startswith('==') or str.startswith('**')
   |         ^ E701
52 | 
53 |   def IsFailureOutput(self, output):
   |

test/message/testcfg.py:122:18: RUF005 Consider `[*current_path, t]` instead of concatenation
    |
121 |   def ListTests(self, current_path, path, arch, mode):
122 |     all_tests = [current_path + [t] for t in self.Ls(self.root)]
    |                  ^^^^^^^^^^^^^^^^^^ RUF005
123 |     result = []
124 |     for tst in all_tests:
    |
    = help: Replace with `[*current_path, t]`

test/pseudo-tty/testcfg.py:55:27: E701 Multiple statements on one line (colon)
   |
53 |   def IgnoreLine(self, str_arg):
54 |     """Ignore empty lines and valgrind output."""
55 |     if not str_arg.strip(): return True
   |                           ^ E701
56 |     else: return str_arg.startswith('==') or str_arg.startswith('**')
   |

test/pseudo-tty/testcfg.py:56:9: E701 Multiple statements on one line (colon)
   |
54 |     """Ignore empty lines and valgrind output."""
55 |     if not str_arg.strip(): return True
56 |     else: return str_arg.startswith('==') or str_arg.startswith('**')
   |         ^ E701
57 | 
58 |   def IsFailureOutput(self, output):
   |

test/pseudo-tty/testcfg.py:118:20: RUF005 Consider `[sys.executable, PTY_HELPER, *full_command]` instead of concatenation
    |
116 |       fd = os.open(self.input, os.O_RDONLY)
117 |     full_command = self.context.processor(command)
118 |     full_command = [sys.executable, PTY_HELPER] + full_command
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
119 |     output = test.Execute(full_command,
120 |                      self.context,
    |
    = help: Replace with `[sys.executable, PTY_HELPER, *full_command]`

test/pseudo-tty/testcfg.py:140:18: RUF005 Consider `[*current_path, t]` instead of concatenation
    |
139 |   def ListTests(self, current_path, path, arch, mode):
140 |     all_tests = [current_path + [t] for t in self.Ls(self.root)]
    |                  ^^^^^^^^^^^^^^^^^^ RUF005
141 |     result = []
142 |     # Skip these tests on Windows, as pseudo terminals are not available
    |
    = help: Replace with `[*current_path, t]`

test/testpy/__init__.py:108:18: RUF005 Consider `[*current_path, t]` instead of concatenation
    |
107 |   def ListTests(self, current_path, path, arch, mode):
108 |     all_tests = [current_path + [t] for t in self.Ls(os.path.join(self.root))]
    |                  ^^^^^^^^^^^^^^^^^^ RUF005
109 |     result = []
110 |     for tst in all_tests:
    |
    = help: Replace with `[*current_path, t]`

test/tools/test_checkimports.py:35:52: E703 [*] Statement ends with an unnecessary semicolon
   |
33 |                        False)
34 |       output = out.getvalue()
35 |       self.assertIn('does not use "Local"', output);
   |                                                    ^ E703
36 |       self.assertIn('using statements aren\'t sorted in', output);
37 |       self.assertIn('Line 1: Actual: v8::MaybeLocal, Expected: v8::Array',
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:36:66: E703 [*] Statement ends with an unnecessary semicolon
   |
34 |       output = out.getvalue()
35 |       self.assertIn('does not use "Local"', output);
36 |       self.assertIn('using statements aren\'t sorted in', output);
   |                                                                  ^ E703
37 |       self.assertIn('Line 1: Actual: v8::MaybeLocal, Expected: v8::Array',
38 |                     output);
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:38:28: E703 [*] Statement ends with an unnecessary semicolon
   |
36 |       self.assertIn('using statements aren\'t sorted in', output);
37 |       self.assertIn('Line 1: Actual: v8::MaybeLocal, Expected: v8::Array',
38 |                     output);
   |                            ^ E703
39 |       self.assertIn('Line 2: Actual: v8::Array, Expected: v8::Local',
40 |                     output);
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:40:28: E703 [*] Statement ends with an unnecessary semicolon
   |
38 |                     output);
39 |       self.assertIn('Line 2: Actual: v8::Array, Expected: v8::Local',
40 |                     output);
   |                            ^ E703
41 |       self.assertIn('Line 3: Actual: v8::Local, Expected: v8::MaybeLocal',
42 |                     output);
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:42:28: E703 [*] Statement ends with an unnecessary semicolon
   |
40 |                     output);
41 |       self.assertIn('Line 3: Actual: v8::Local, Expected: v8::MaybeLocal',
42 |                     output);
   |                            ^ E703
43 | 
44 |   def test_unused_complex(self):
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:49:52: E703 [*] Statement ends with an unnecessary semicolon
   |
47 |                        False)
48 |       output = out.getvalue()
49 |       self.assertIn('does not use "Local"', output);
   |                                                    ^ E703
50 | 
51 |   def test_unused_simple(self):
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:56:54: E703 [*] Statement ends with an unnecessary semicolon
   |
54 |                        False)
55 |       output = out.getvalue()
56 |       self.assertIn('does not use "Context"', output);
   |                                                      ^ E703
57 | 
58 |   def test_unsorted(self):
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:63:66: E703 [*] Statement ends with an unnecessary semicolon
   |
61 |                        False)
62 |       output = out.getvalue()
63 |       self.assertIn('using statements aren\'t sorted in', output);
   |                                                                  ^ E703
64 |       self.assertIn('Line 1: Actual: v8::MaybeLocal, Expected: v8::Array',
65 |                     output);
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:65:28: E703 [*] Statement ends with an unnecessary semicolon
   |
63 |       self.assertIn('using statements aren\'t sorted in', output);
64 |       self.assertIn('Line 1: Actual: v8::MaybeLocal, Expected: v8::Array',
65 |                     output);
   |                            ^ E703
66 |       self.assertIn('Line 2: Actual: v8::Array, Expected: v8::MaybeLocal',
67 |                     output);
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:67:28: E703 [*] Statement ends with an unnecessary semicolon
   |
65 |                     output);
66 |       self.assertIn('Line 2: Actual: v8::Array, Expected: v8::MaybeLocal',
67 |                     output);
   |                            ^ E703
68 | 
69 |   def test_valid(self):
   |
   = help: Remove unnecessary semicolon

test/tools/test_checkimports.py:74:35: E703 [*] Statement ends with an unnecessary semicolon
   |
72 |                        True)
73 |       output = out.getvalue()
74 |       self.assertEqual(output, '');
   |                                   ^ E703
75 | 
76 | if __name__ == '__main__':
   |
   = help: Remove unnecessary semicolon

tools/build_addons.py:16:25: RUF005 Consider iterable unpacking instead of concatenation
   |
14 |   def generate_headers(headers_dir, install_args):
15 |     print('Generating headers')
16 |     subprocess.check_call([
   |  _________________________^
17 | |       sys.executable,
18 | |       os.path.join(ROOT_DIR, 'tools/install.py'),
19 | |       'install',
20 | |       '--silent',
21 | |       '--headers-only',
22 | |       '--prefix', '/',
23 | |       '--dest-dir', headers_dir,
24 | |   ] + install_args)
   | |__________________^ RUF005
25 |   
26 |   # Rebuild addons in parallel.
   |
   = help: Replace with iterable unpacking

tools/configure.d/nodedownload.py:136:11: E713 [*] Test for membership should be `not in`
    |
135 | def candownload(auto_downloads, package):
136 |   if not (package in auto_downloads.keys()):
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E713
137 |     raise Exception('Internal error: "%s" is not in the --downloads list. Check nodedownload.py' % package)
138 |   if auto_downloads[package]:
    |
    = help: Convert to `not in`

tools/gypi_to_gn.py:109:5: C901 `ToGNString` is too complex (32 > 20)
    |
108 | # This function is copied from build/gn_helpers.py in Chromium.
109 | def ToGNString(value, pretty=False):
    |     ^^^^^^^^^^ C901
110 |   """Returns a stringified GN equivalent of a Python value.
    |

tools/gypi_to_gn.py:162:3: E731 Do not assign a `lambda` expression, use a `def`
    |
160 |       raise ValueError('Unsupported type when printing to GN.')
161 | 
162 |   can_start = lambda tok: tok and tok not in ',}]='
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
163 |   can_end = lambda tok: tok and tok not in ',{[='
    |
    = help: Rewrite `can_start` as a `def`

tools/gypi_to_gn.py:163:3: E731 Do not assign a `lambda` expression, use a `def`
    |
162 |   can_start = lambda tok: tok and tok not in ',}]='
163 |   can_end = lambda tok: tok and tok not in ',{[='
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
164 | 
165 |   # Adds whitespaces, trying to keep everything (except dicts) in 1 line.
    |
    = help: Rewrite `can_end` as a `def`

tools/icu/icutrim.py:38:121: E501 Line too long (132 > 120)
   |
36 | endian=sys.byteorder
37 | 
38 | parser = optparse.OptionParser(usage="usage: mkdir tmp ; %prog -D ~/Downloads/icudt53l.dat -T tmp -F trim_en.json -O icudt53l.dat" )
   |                                                                                                                         ^^^^^^^^^^^^ E501
39 | 
40 | parser.add_option("-P","--tool-path",
   |

tools/icu/icutrim.py:85:121: E501 Line too long (172 > 120)
   |
83 |                   default=None)
84 | 
85 | parser.add_option('-e', '--endian', action='store', dest='endian', help='endian, big, little or host, your default is "%s".' % endian, default=endian, metavar='endianness')
   |                                                                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
86 | 
87 | (options, args) = parser.parse_args()
   |

tools/icu/icutrim.py:245:13: E741 Ambiguous variable name: `l`
    |
243 |         else:
244 |             print("tree %s - no ONLY")
245 |         for l in range(len(mytree["locs"])):
    |             ^ E741
246 |             loc = mytree["locs"][l]
247 |             if (only is not None) and not loc in only:
    |

tools/icu/icutrim.py:247:43: E713 [*] Test for membership should be `not in`
    |
245 |         for l in range(len(mytree["locs"])):
246 |             loc = mytree["locs"][l]
247 |             if (only is not None) and not loc in only:
    |                                           ^^^^^^^^^^^ E713
248 |                 # REMOVE loc
249 |                 toRemove = "%s%s%s" % (mytree["treeprefix"], loc, mytree["extension"])
    |
    = help: Convert to `not in`

tools/icu/icutrim.py:292:121: E501 Line too long (121 > 120)
    |
290 |             trees[tree]["locs"] = [line.strip() for line in treeitems]
291 |         if tree not in config.get("trees", {}):
292 |             print(" Warning: filter file %s does not mention trees.%s - will be kept as-is" % (options.filterfile, tree))
    |                                                                                                                         ^ E501
293 |         else:
294 |             queueForRemoval(tree)
    |

tools/icu/shrink-icu-src.py:67:15: RUF005 Consider iterable unpacking instead of concatenation
   |
65 |             ign.remove('license.html')
66 |     elif subdir == 'source':
67 |         ign = ign + ['layout','samples','test','extra','config','layoutex','allinone','data']
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
68 |         ign = ign + ['runConfigureICU','install-sh','mkinstalldirs','configure']
69 |         ign = ign + ['io']
   |
   = help: Replace with iterable unpacking

tools/icu/shrink-icu-src.py:68:15: RUF005 Consider iterable unpacking instead of concatenation
   |
66 |     elif subdir == 'source':
67 |         ign = ign + ['layout','samples','test','extra','config','layoutex','allinone','data']
68 |         ign = ign + ['runConfigureICU','install-sh','mkinstalldirs','configure']
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
69 |         ign = ign + ['io']
70 |     elif subdir == 'source/tools':
   |
   = help: Replace with iterable unpacking

tools/icu/shrink-icu-src.py:69:15: RUF005 Consider `[*ign, 'io']` instead of concatenation
   |
67 |         ign = ign + ['layout','samples','test','extra','config','layoutex','allinone','data']
68 |         ign = ign + ['runConfigureICU','install-sh','mkinstalldirs','configure']
69 |         ign = ign + ['io']
   |               ^^^^^^^^^^^^ RUF005
70 |     elif subdir == 'source/tools':
71 |         ign = ign + ['tzcode','ctestfw','gensprep','gennorm2','gendict','icuswap',
   |
   = help: Replace with `[*ign, 'io']`

tools/icu/shrink-icu-src.py:71:15: RUF005 Consider iterable unpacking instead of concatenation
   |
69 |           ign = ign + ['io']
70 |       elif subdir == 'source/tools':
71 |           ign = ign + ['tzcode','ctestfw','gensprep','gennorm2','gendict','icuswap',
   |  _______________^
72 | |         'genbrk','gencfu','gencolusb','genren','memcheck','makeconv','gencnval','icuinfo','gentest']
   | |____________________________________________________________________________________________________^ RUF005
73 |       ign = ign + ['.DS_Store', 'Makefile', 'Makefile.in']
   |
   = help: Replace with iterable unpacking

tools/icu/shrink-icu-src.py:73:11: RUF005 Consider `[*ign, '.DS_Store', 'Makefile', 'Makefile.in']` instead of concatenation
   |
71 |         ign = ign + ['tzcode','ctestfw','gensprep','gennorm2','gendict','icuswap',
72 |         'genbrk','gencfu','gencolusb','genren','memcheck','makeconv','gencnval','icuinfo','gentest']
73 |     ign = ign + ['.DS_Store', 'Makefile', 'Makefile.in']
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
74 | 
75 |     for file in files:
   |
   = help: Replace with `[*ign, '.DS_Store', 'Makefile', 'Makefile.in']`

tools/icu/shrink-icu-src.py:77:19: RUF005 Consider `[*ign, file]` instead of concatenation
   |
75 |     for file in files:
76 |         if ignore_regex.match(file):
77 |             ign = ign + [file]
   |                   ^^^^^^^^^^^^ RUF005
78 | 
79 |     # print '>%s< [%s]' % (subdir, ign)
   |
   = help: Replace with `[*ign, file]`

tools/install.py:29:31: E701 Multiple statements on one line (colon)
   |
27 |     os.unlink(path)
28 |   except OSError as e:
29 |     if e.errno != errno.ENOENT: raise
   |                               ^ E701
30 | 
31 | def try_symlink(options, source_path, link_path):
   |

tools/install.py:42:31: E701 Multiple statements on one line (colon)
   |
40 |     os.makedirs(path)
41 |   except OSError as e:
42 |     if e.errno != errno.EEXIST: raise
   |                               ^ E701
43 | 
44 | def try_rmdir_r(options, path):
   |

tools/install.py:50:36: E701 Multiple statements on one line (colon)
   |
48 |       os.rmdir(path)
49 |     except OSError as e:
50 |       if e.errno == errno.ENOTEMPTY: return
   |                                    ^ E701
51 |       if e.errno == errno.ENOENT: return
52 |       if e.errno == errno.EEXIST and current_system == SYSTEM_AIX: return
   |

tools/install.py:51:33: E701 Multiple statements on one line (colon)
   |
49 |     except OSError as e:
50 |       if e.errno == errno.ENOTEMPTY: return
51 |       if e.errno == errno.ENOENT: return
   |                                 ^ E701
52 |       if e.errno == errno.EEXIST and current_system == SYSTEM_AIX: return
53 |       raise
   |

tools/install.py:52:66: E701 Multiple statements on one line (colon)
   |
50 |       if e.errno == errno.ENOTEMPTY: return
51 |       if e.errno == errno.ENOENT: return
52 |       if e.errno == errno.EEXIST and current_system == SYSTEM_AIX: return
   |                                                                  ^ E701
53 |       raise
54 |     path = abspath(path, '..')
   |

tools/install.py:95:64: E701 Multiple statements on one line (colon)
   |
93 |   # don't install npm if the target path is a symlink, it probably means
94 |   # that a dev version of npm is installed there
95 |   if os.path.islink(abspath(options.install_path, target_path)): return
   |                                                                ^ E701
96 | 
97 |   # npm has a *lot* of files and it'd be a pain to maintain a fixed list here
   |

tools/mkssldef.py:18:22: E701 Multiple statements on one line (colon)
   |
16 |   while filenames and filenames[0].startswith('-'):
17 |     option = filenames.pop(0)
18 |     if option == '-o': out = open(filenames.pop(0), 'w')
   |                      ^ E701
19 |     elif option.startswith('-C'): categories += option[2:].split(',')
20 |     elif option.startswith('-D'): defines += option[2:].split(',')
   |

tools/mkssldef.py:19:33: E701 Multiple statements on one line (colon)
   |
17 |     option = filenames.pop(0)
18 |     if option == '-o': out = open(filenames.pop(0), 'w')
19 |     elif option.startswith('-C'): categories += option[2:].split(',')
   |                                 ^ E701
20 |     elif option.startswith('-D'): defines += option[2:].split(',')
21 |     elif option.startswith('-X'): excludes += option[2:].split(',')
   |

tools/mkssldef.py:20:33: E701 Multiple statements on one line (colon)
   |
18 |     if option == '-o': out = open(filenames.pop(0), 'w')
19 |     elif option.startswith('-C'): categories += option[2:].split(',')
20 |     elif option.startswith('-D'): defines += option[2:].split(',')
   |                                 ^ E701
21 |     elif option.startswith('-X'): excludes += option[2:].split(',')
22 |     elif option.startswith('-B'): bases += option[2:].split(',')
   |

tools/mkssldef.py:21:33: E701 Multiple statements on one line (colon)
   |
19 |     elif option.startswith('-C'): categories += option[2:].split(',')
20 |     elif option.startswith('-D'): defines += option[2:].split(',')
21 |     elif option.startswith('-X'): excludes += option[2:].split(',')
   |                                 ^ E701
22 |     elif option.startswith('-B'): bases += option[2:].split(',')
   |

tools/mkssldef.py:22:33: E701 Multiple statements on one line (colon)
   |
20 |     elif option.startswith('-D'): defines += option[2:].split(',')
21 |     elif option.startswith('-X'): excludes += option[2:].split(',')
22 |     elif option.startswith('-B'): bases += option[2:].split(',')
   |                                 ^ E701
23 | 
24 |   excludes = [re.compile(exclude) for exclude in excludes]
   |

tools/mkssldef.py:30:46: E701 Multiple statements on one line (colon)
   |
28 |     for line in open(filename).readlines():
29 |       name, _, _, meta, _ = re.split(r'\s+', line)
30 |       if any(p.match(name) for p in excludes): continue
   |                                              ^ E701
31 |       meta = meta.split(':')
32 |       assert meta[0] in ('EXIST', 'NOEXIST')
   |

tools/mkssldef.py:34:28: E701 Multiple statements on one line (colon)
   |
32 |       assert meta[0] in ('EXIST', 'NOEXIST')
33 |       assert meta[2] in ('FUNCTION', 'VARIABLE')
34 |       if meta[0] != 'EXIST': continue
   |                            ^ E701
35 |       if meta[2] != 'FUNCTION': continue
36 |       def satisfy(expr, rules):
   |

tools/mkssldef.py:35:31: E701 Multiple statements on one line (colon)
   |
33 |       assert meta[2] in ('FUNCTION', 'VARIABLE')
34 |       if meta[0] != 'EXIST': continue
35 |       if meta[2] != 'FUNCTION': continue
   |                               ^ E701
36 |       def satisfy(expr, rules):
37 |         def test(expr):
   |

tools/mkssldef.py:38:34: E701 Multiple statements on one line (colon)
   |
36 |       def satisfy(expr, rules):
37 |         def test(expr):
38 |           if expr.startswith('!'): return not expr[1:] in rules
   |                                  ^ E701
39 |           return expr == '' or expr in rules
40 |         return all(map(test, expr.split(',')))
   |

tools/mkssldef.py:38:47: E713 [*] Test for membership should be `not in`
   |
36 |       def satisfy(expr, rules):
37 |         def test(expr):
38 |           if expr.startswith('!'): return not expr[1:] in rules
   |                                               ^^^^^^^^^^^^^^^^^ E713
39 |           return expr == '' or expr in rules
40 |         return all(map(test, expr.split(',')))
   |
   = help: Convert to `not in`

tools/mkssldef.py:41:39: E701 Multiple statements on one line (colon)
   |
39 |           return expr == '' or expr in rules
40 |         return all(map(test, expr.split(',')))
41 |       if not satisfy(meta[1], defines): continue
   |                                       ^ E701
42 |       if not satisfy(meta[3], categories): continue
43 |       exported.append(name)
   |

tools/mkssldef.py:42:42: E701 Multiple statements on one line (colon)
   |
40 |         return all(map(test, expr.split(',')))
41 |       if not satisfy(meta[1], defines): continue
42 |       if not satisfy(meta[3], categories): continue
   |                                          ^ E701
43 |       exported.append(name)
   |

tools/mkssldef.py:48:27: E701 Multiple statements on one line (colon)
   |
46 |     for line in open(filename).readlines():
47 |       line = line.strip()
48 |       if line == 'EXPORTS': continue
   |                           ^ E701
49 |       if line[0] == ';': continue
50 |       exported.append(line)
   |

tools/mkssldef.py:49:24: E701 Multiple statements on one line (colon)
   |
47 |       line = line.strip()
48 |       if line == 'EXPORTS': continue
49 |       if line[0] == ';': continue
   |                        ^ E701
50 |       exported.append(line)
   |

tools/mkssldef.py:53:31: E701 Multiple statements on one line (colon)
   |
52 |   print('EXPORTS', file=out)
53 |   for name in sorted(exported): print('    ', name, file=out)
   |                               ^ E701
   |

tools/pseudo-tty.py:33:5: E731 Do not assign a `lambda` expression, use a `def`
   |
31 |     # The comparison against b' '[0] is because |data| is
32 |     # a string in python2 but a bytes object in python3.
33 |     filt = lambda c: c >= b' '[0] or c in b'\t\n\r\f'
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
34 |     data = filter(filt, data)
35 |     data = bytes(data)
   |
   = help: Rewrite `filt` as a `def`

tools/run-valgrind.py:55:11: RUF005 Consider iterable unpacking instead of concatenation
   |
54 | # Compute the command line.
55 | command = VALGRIND_ARGUMENTS + [executable, '--zero-fill-buffers']
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
56 | command += sys.argv[2:]
   |
   = help: Replace with iterable unpacking

tools/test.py:234:121: E501 Line too long (127 > 120)
    |
232 |             outputs = [case.Run() for _ in range(self.measure_flakiness)]
233 |             # +1s are there because the test already failed once at this point.
234 |             print(" failed %d out of %d" % (len([i for i in outputs if i.UnexpectedOutput()]) + 1, self.measure_flakiness + 1))
    |                                                                                                                         ^^^^^^^ E501
235 |       else:
236 |         self.succeeded += 1
    |

tools/test.py:345:9: E741 Ambiguous variable name: `l`
    |
343 |     logger.info('  stack: |-')
344 | 
345 |     for l in self.traceback.splitlines():
    |         ^ E741
346 |       logger.info('    ' + l)
    |

tools/test.py:512:121: E501 Line too long (148 > 120)
    |
510 |   def __init__(self, cases, flaky_tests_mode, measure_flakiness):
511 |     templates = {
512 |       'status_line': "[%(mins)02i:%(secs)02i|\033[34m%%%(remaining) 4d\033[0m|\033[32m+%(passed) 4d\033[0m|\033[31m-%(failed) 4d\033[0m]: %(test)s",
    |                                                                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501
513 |       'stdout': "\033[1m%s\033[0m",
514 |       'stderr': "\033[31m%s\033[0m",
    |

tools/test.py:621:24: E701 Multiple statements on one line (colon)
    |
619 |         from fcntl import fcntl, F_GETFL, F_SETFL
620 |         from os import O_NONBLOCK
621 |         for fd in 0,1,2: fcntl(fd, F_SETFL, ~O_NONBLOCK & fcntl(fd, F_GETFL))
    |                        ^ E701
622 | 
623 |     return result
    |

tools/test.py:644:16: E713 [*] Test for membership should be `not in`
    |
642 |     else:
643 |       outcome = PASS
644 |     return not outcome in self.test.outcomes
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E713
645 | 
646 |   def HasCrashed(self):
    |
    = help: Convert to `not in`

tools/test.py:701:21: E701 Multiple statements on one line (colon)
    |
700 | def RunProcess(context, timeout, args, **rest):
701 |   if context.verbose: print("#", " ".join(args))
    |                     ^ E701
702 |   popen_args = args
703 |   prev_error_mode = SEM_INVALID_VALUE
    |

tools/test.py:721:21: E701 Multiple statements on one line (colon)
    |
719 |   # Compute the end time - if the process crosses this limit we
720 |   # consider it timed out.
721 |   if timeout is None: end_time = None
    |                     ^ E701
722 |   else: end_time = time.time() + timeout
723 |   timed_out = False
    |

tools/test.py:722:7: E701 Multiple statements on one line (colon)
    |
720 |   # consider it timed out.
721 |   if timeout is None: end_time = None
722 |   else: end_time = time.time() + timeout
    |       ^ E701
723 |   timed_out = False
724 |   # Repeatedly check the exit code from the process in a
    |

tools/test.py:730:13: E714 [*] Test for object identity should be `is not`
    |
729 |   while exit_code is None:
730 |     if (not end_time is None) and (time.time() >= end_time):
    |             ^^^^^^^^^^^^^^^^ E714
731 |       # Kill the process and wait for it to exit.
732 |       KillTimedOutProcess(context, process.pid)
    |
    = help: Convert to `is not`

tools/test.py:920:21: RUF005 Consider `[*current_path, test_name]` instead of concatenation
    |
918 |       test_name = test.GetName()
919 |       if not name or name.match(test_name):
920 |         full_path = current_path + [test_name]
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
921 |         test.AddTestsToList(result, full_path, path, context, arch, mode)
922 |     result.sort(key=lambda x: x.GetName())
    |
    = help: Replace with `[*current_path, test_name]`

tools/test.py:1034:24: E701 Multiple statements on one line (colon)
     |
1033 |   def GetOutcomes(self, env, defs):
1034 |     if self.name in env: return set([env[self.name]])
     |                        ^ E701
1035 |     else: return set()
     |

tools/test.py:1035:9: E701 Multiple statements on one line (colon)
     |
1033 |   def GetOutcomes(self, env, defs):
1034 |     if self.name in env: return set([env[self.name]])
1035 |     else: return set()
     |         ^ E701
     |

tools/test.py:1103:32: E701 Multiple statements on one line (colon)
     |
1102 |   def Current(self, length = 1):
1103 |     if not self.HasMore(length): return ""
     |                                ^ E701
1104 |     return self.expr[self.index:self.index+length]
     |

tools/test.py:1210:14: E701 Multiple statements on one line (colon)
     |
1208 | def ParseOperatorExpression(scan):
1209 |   left = ParseAtomicExpression(scan)
1210 |   if not left: return None
     |              ^ E701
1211 |   while scan.HasMore() and (scan.Current() in BINARIES):
1212 |     op = scan.Current()
     |

tools/test.py:1223:14: E701 Multiple statements on one line (colon)
     |
1221 | def ParseConditionalExpression(scan):
1222 |   left = ParseOperatorExpression(scan)
1223 |   if not left: return None
     |              ^ E701
1224 |   while scan.HasMore() and (scan.Current() == 'if'):
1225 |     scan.Advance()
     |

tools/test.py:1236:14: E701 Multiple statements on one line (colon)
     |
1234 | def ParseLogicalExpression(scan):
1235 |   left = ParseConditionalExpression(scan)
1236 |   if not left: return None
     |              ^ E701
1237 |   while scan.HasMore() and (scan.Current() in LOGICALS):
1238 |     op = scan.Current()
     |

tools/test.py:1598:3: E731 Do not assign a `lambda` expression, use a `def`
     |
1596 |     args = [a for a in args if a != 'default'] + def_suites
1597 |   subsystem_regex = re.compile(r'^[a-zA-Z-]*$')
1598 |   check = lambda arg: subsystem_regex.match(arg) and (arg not in suites)
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E731
1599 |   mapped_args = ["*/test*-%s-*" % arg if check(arg) else arg for arg in args]
1600 |   paths = [SplitPath(NormalizePath(a)) for a in mapped_args]
     |
     = help: Rewrite `check` as a `def`

tools/test.py:1621:5: C901 `Main` is too complex (36 > 20)
     |
1621 | def Main():
     |     ^^^^ C901
1622 |   parser = BuildOptions()
1623 |   (options, args) = parser.parse_args()
     |

tools/test.py:1814:52: E714 [*] Test for object identity should be `is not`
     |
1812 |     print()
1813 |     sys.stderr.write("--- Total time: %s ---\n" % FormatTime(duration))
1814 |     timed_tests = [ t for t in cases_to_run if not t.duration is None ]
     |                                                    ^^^^^^^^^^^^^^^^^^ E714
1815 |     timed_tests.sort(key=lambda x: x.duration)
1816 |     for i, entry in enumerate(timed_tests[:20], start=1):
     |
     = help: Convert to `is not`

tools/utils.py:88:25: E714 [*] Test for object identity should be `is not`
   |
86 |   if id.startswith('arm') or id == 'aarch64':
87 |     return 'arm'
88 |   elif (not id) or (not re.match('(x|i[3-6])86$', id) is None):
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E714
89 |     return 'ia32'
90 |   elif id == 'i86pc':
   |
   = help: Convert to `is not`

tools/v8/node_common.py:26:5: E722 Do not use bare `except`
   |
24 |       if os.path.isfile(gclient_path):
25 |         return depot_tools
26 |     except:
   |     ^^^^^^ E722
27 |       pass
28 |     if fetch_if_not_exist:
   |

tools/v8_gypfiles/GN-scraper.py:17:7: E741 Ambiguous variable name: `l`
   |
15 |   match = matches.group(1)
16 |   files = []
17 |   for l in match.splitlines():
   |       ^ E741
18 |     m2 = PLAIN_SOURCE_RE.match(l)
19 |     if not m2:
   |

tools/zos/sdwrap.py:7:3: E741 Ambiguous variable name: `l`
  |
6 | def wrap(args):
7 |   l = args.input.readline(72)
  |   ^ E741
8 |   firstline = True
9 |   while l:
  |

tools/zos/sdwrap.py:16:7: E741 Ambiguous variable name: `l`
   |
14 |         outstr = " {}".format(l)
15 |         firstline = True
16 |       l = args.input.readline(72)
   |       ^ E741
17 |     else:
18 |       if firstline:
   |

tools/zos/sdwrap.py:23:7: E741 Ambiguous variable name: `l`
   |
21 |       else:
22 |         outstr = " {:<70}*\n".format(l[:-1])
23 |       l = l[-1] + args.input.readline(70)
   |       ^ E741
24 |     args.output.write(outstr)
   |

tools/zos/sdwrap.py:29:3: E741 Ambiguous variable name: `l`
   |
28 | def unwrap(args):
29 |   l = args.input.readline()
   |   ^ E741
30 |   firstline = True
31 |   while l:
   |

tools/zos/sdwrap.py:51:5: E741 Ambiguous variable name: `l`
   |
49 |         args.output.write(l[1:])
50 |         firstline = True
51 |     l = args.input.readline()
   |     ^ E741
52 |   return 0
   |

Found 97 errors.
[*] 18 fixable with the `--fix` option (24 hidden fixes can be enabled with the `--unsafe-fixes` option).

@Trott Trott closed this Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants