fixhunt

ruff RUF103

labelled unknown
Runs / 2026-10-17T21-50-42-076Z-bke4-ruff-RUF103ruff 0.17.12026-10-17 21:50 UTC8 programs × 2 round(s)8 programs, 6 fired, 0 fixed, 0 findings, 1 rejectedmodel cost $0.0020

Analysis Nemotron 3 Super

Flags inline `# ruff: disable` comments without any specified error codes.

Fix: Replace the comment with `# ruff: disable[]` when no codes were provided; preserve all other text on the line including indentation and trailing whitespace/comments after the suppression marker.

12 hazards
  • The fix removes meaningful trailing content if the line had additional non-whitespace text after `# ruff: disable` (e.g., `# ruff: disable TODO`), altering program semantics by deleting that text.
  • If the suppression comment was the only content on a line, replacing it with `# ruff: disable[]` adds characters that could affect tools relying on exact line length or column counts (e.g., language server protocols).
  • In a multiline string or docstring, the literal text `# ruff: disable` is not a comment; the fix would incorrectly alter the string value, changing runtime behavior.
  • If the line contains other comments after the suppression marker (e.g., `# ruff: disable # note`), the fix preserves them but may misalign intent if the original spacing was semantically meaningful (though rare).
  • When the suppression appears in a shebang line or encoding declaration (e.g., `# -*- coding: utf-8 #- ruff: disable`), the fix breaks the validity of that special line.
  • If the file uses a custom Ruff configuration that treats `# ruff: disable` as valid via an extension or plugin, the fix enforces core Ruff behavior and may suppress intended custom handling.
  • In generated code where line numbers are referenced elsewhere (e.g., in source maps or debug info), inserting `[]` shifts subsequent line content, potentially breaking those references.
  • If the suppression comment is part of a larger token due to missing whitespace (e.g., `x=1# ruff:disable`), the fix does not add space and may produce invalid syntax like `x=1# ruff:disable[]`, which remains a comment but could confuse parsers expecting space before `#`.
  • When the suppression is the last line of the file without a newline, adding `[]` may append without a newline, affecting tools that expect final newline.
  • If the suppression comment is inside a bracketed expression split across lines (e.g., `[\n # ruff: disable]`), the fix alters the interior comment but does not affect the expression value, though it changes formatting.
  • In a file interpreted by another tool that scans for `# ruff: disable` as a feature flag (not suppression), the fix changes the token to `# ruff: disable[]`, which may not be recognized, disabling the feature flag unintentionally.
  • If the suppression comment is copied from documentation or example where the absence of codes is intentional for illustration, the fix modifies the example, making it less clear or incorrect.

Programs

idresulttitlehazard
r1-p001fired, no fixTrailing non-whitespace deletionThe fix removes meaningful trailing content if the line had additional non-whitespace text after '# ruff: disable' (e.g., '# ruff: disable TODO'), altering program semantics by deleting that text.
r1-p002fired, no fixCustom Ruff configuration overrideIf the file uses a custom Ruff configuration that treats '# ruff: disable' as valid via an extension or plugin, the fix enforces core Ruff behavior and may suppress intended custom handling.
r1-p003fired, no fixFeature flag misinterpretationIn a file interpreted by another tool that scans for '# ruff: disable' as a feature flag (not suppression), the fix changes the token to '# ruff: disable[]', which may not be recognized, disabling the
r1-p004fired, no fixFinal line newline sensitivityWhen the suppression is the last line of the file without a newline, adding '[]' may append without a newline, affecting tools that expect final newline.
r1-p005invalidWalrus and comprehension scoping interactionwalrus, comprehensions scoping, late binding in closures and lambdas
r1-p006fired, no fixSource map line number shiftIn generated code where line numbers are referenced elsewhere (e.g., in source maps or debug info), inserting '[]' shifts subsequent line content, potentially breaking those references.
r1-p007fired, no fixComment attachment preservationcomments and docstrings attached to the removed or moved code
r1-p008silent prediction offFile write truncation simulationfile modes and truncation, partial writes, non-str data passed to write

Sources

r1-p001 · Trailing non-whitespace deletion
1# This line has a suppression followed by a TODO marker that should persist
2# But if the fix deletes 'TODO', the logic changes
3value = 42 # ruff: disable TODO
4if 'TODO' in __import__('inspect').getsource(lambda: value):
5 print('TODO preserved')
6else:
7 print('TODO deleted - semantics altered')
TODO preserved
r1-p002 · Custom Ruff configuration override
1# Custom plugin might interpret plain '# ruff: disable' as enabling strict mode
2# After fix, becomes '# ruff: disable[]' which plugin may ignore
3mode = 'lax'
4try:
5 exec("# ruff: disable\nif 1: mode = 'strict'")
6except:
7 pass
8print(f"Mode: {mode}")
Mode: strict
r1-p003 · Feature flag misinterpretation
1# Tool checks for '# ruff: disable' to enable verbose logging
2# Fix changes it to '# ruff: disable[]' which tool ignores
3verbose = False
4if '# ruff: disable' in open(__file__).read():
5 verbose = True
6print(f"Verbose logging: {verbose}")
Verbose logging: True
r1-p004 · Final line newline sensitivity
1# This is the last line of the file and has no newline
2# ruff: disable
r1-p005 · Walrus and comprehension scoping interaction (generated program does not parse: Traceback (most recent call last):)
1# Suppression inside comprehension affects walrus capture
2results = [(lambda: x)() for x in [1] if (tmp := 2) and True # ruff: disable]
3print(f"First result: {results[0] if results else 'none'}")
r1-p006 · Source map line number shift
1# Line 1: suppression
2# ruff: disable
3# Line 2: this line's number is referenced in debug info
4DEBUG_LINE = 2
5import inspect
6lines = inspect.getsourcelines(lambda: None)[0]
7actual_line = lines[DEBUG_LINE - 1].strip() if DEBUG_LINE <= len(lines) else "OUT_OF_RANGE"
8print(f"Line {DEBUG_LINE} content: {repr(actual_line)}")
Line 2 content: 'OUT_OF_RANGE'
r1-p007 · Comment attachment preservation
1def example():
2 """This docstring should stay attached to the function."""
3 x = 1 # ruff: disable
4 y = 2 # this comment explains y
5 return x + y
6print(f"Function docstring: {example.__doc__}")
Function docstring: This docstring should stay attached to the function.
r1-p008 · File write truncation simulation
1# Simulate writing to file where suppression fix alters byte count
2import os
3with open('test.txt', 'w') as f:
4 f.write('# ruff: disable') # exact bytes matter for truncation
5size = os.path.getsize('test.txt')
6print(f"File size: {size} bytes")
7os.remove('test.txt')
File size: 15 bytes