Conversation
There was a problem hiding this comment.
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-ignoresforS102(use ofexec) in tests (anddoc/conf.py). - Update test imports to use
from pycparserext import ...style. - Normalize
c_ast/yaccimports inext_c_parser.pyandext_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
S102for all files undertest/*.py. Since the onlyexec(...)usage in the test suite is intest/test_pycparserext.py, it would be more targeted to either ignoreS102for that specific file or add a line-level# noqa: S102whereexecis used, to avoid masking futureexecusage 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.
| 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 |
There was a problem hiding this comment.
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).
No description provided.