Skip to content

Update config, fix lints for ruff 0.15.2#100

Merged
inducer merged 1 commit intomainfrom
ruff152
Feb 22, 2026
Merged

Update config, fix lints for ruff 0.15.2#100
inducer merged 1 commit intomainfrom
ruff152

Conversation

@inducer
Copy link
Owner

@inducer inducer commented Feb 22, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 22, 2026 19:38
@inducer inducer enabled auto-merge (rebase) February 22, 2026 19:39
@inducer inducer merged commit efa66d3 into main Feb 22, 2026
4 checks passed
@inducer inducer deleted the ruff152 branch February 22, 2026 19:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Ruff configuration and adjusts imports to satisfy newer Ruff linting behavior, primarily by suppressing a new S102 finding in tests and modernizing some import statements.

Changes:

  • Add Ruff per-file-ignores for S102 (use of exec) in tests (and doc/conf.py).
  • Update test imports to use from pycparserext import ... style.
  • Normalize c_ast/yacc imports in ext_c_parser.py and ext_c_generator.py.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/test_pycparserext.py Adjusts local imports to a different import form for lint compliance.
pyproject.toml Adds Ruff per-file ignore configuration for S102.
pycparserext/ext_c_parser.py Changes c_ast/yacc import style (currently introduces an unused import lint issue).
pycparserext/ext_c_generator.py Changes c_ast import to from pycparser import c_ast.
Comments suppressed due to low confidence (1)

pyproject.toml:42

  • The new per-file ignore suppresses S102 for all files under test/*.py. Since the only exec(...) usage in the test suite is in test/test_pycparserext.py, it would be more targeted to either ignore S102 for that specific file or add a line-level # noqa: S102 where exec is used, to avoid masking future exec usage elsewhere in tests.
[tool.ruff.lint.per-file-ignores]
"test/*.py" = ["S102"]
"doc/conf.py" = ["S102"]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 5 to 9
try:
import pycparser.ply.yacc as yacc
from pycparser.ply import yacc
except ImportError:
import ply.yacc as yacc # noqa: F401
from ply import yacc # noqa: F401
from pycparser.plyparser import parameterized, template
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

yacc is imported but never referenced anywhere in this module. With F enabled in Ruff, from pycparser.ply import yacc will trigger an F401 unused-import error (the # noqa: F401 only applies to the fallback import). Either remove the yacc imports entirely, or add # noqa: F401 consistently (and ideally a short comment if the import is needed for side effects).

Copilot uses AI. Check for mistakes.
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.

2 participants