From 4461032f524fba3b9ee4cd056f1a7fa5715866df Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 19 Jul 2026 03:38:38 -0500 Subject: [PATCH] Switch to ruff:ignore --- pycparserext/ext_c_lexer.py | 4 ++-- pycparserext/ext_c_parser.py | 8 ++++++-- pyproject.toml | 18 +++++++++--------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pycparserext/ext_c_lexer.py b/pycparserext/ext_c_lexer.py index cca688b..dc8d942 100644 --- a/pycparserext/ext_c_lexer.py +++ b/pycparserext/ext_c_lexer.py @@ -49,7 +49,7 @@ class GnuCLexer(CLexerBase): """GNU C lexer that recognizes GNU-specific keywords.""" - _extra_keywords = {**_COMMON_EXTRA_KEYWORDS, **_GNU_EXTRA_KEYWORDS} # noqa: RUF012 + _extra_keywords = {**_COMMON_EXTRA_KEYWORDS, **_GNU_EXTRA_KEYWORDS} # ruff:ignore[mutable-class-default] def token(self): tok = super().token() @@ -72,7 +72,7 @@ class OpenCLCLexer(CLexerBase): """OpenCL C lexer that recognizes OpenCL-specific keywords and line comments.""" - _extra_keywords = {**_COMMON_EXTRA_KEYWORDS, **_OCL_EXTRA_KEYWORDS} # noqa: RUF012 + _extra_keywords = {**_COMMON_EXTRA_KEYWORDS, **_OCL_EXTRA_KEYWORDS} # ruff:ignore[mutable-class-default] def token(self): tok = super().token() diff --git a/pycparserext/ext_c_parser.py b/pycparserext/ext_c_parser.py index aff834f..0a16d7a 100644 --- a/pycparserext/ext_c_parser.py +++ b/pycparserext/ext_c_parser.py @@ -710,7 +710,9 @@ def _parse_struct_declaration(self): class GnuCParser(_AsmAndAttributesMixin, CParserBase): - from pycparserext.ext_c_lexer import GnuCLexer as lexer_class # noqa + from pycparserext.ext_c_lexer import ( + GnuCLexer as lexer_class, # ruff:ignore[camelcase-imported-as-lowercase] + ) initial_type_symbols = frozenset({"__builtin_va_list"}) @@ -1124,7 +1126,9 @@ def _parse_designator(self): class OpenCLCParser(_AsmAndAttributesMixin, CParserBase): - from pycparserext.ext_c_lexer import OpenCLCLexer as lexer_class # noqa + from pycparserext.ext_c_lexer import ( + OpenCLCLexer as lexer_class, # ruff:ignore[camelcase-imported-as-lowercase] + ) INT_BIT_COUNTS = (8, 16, 32, 64) initial_type_symbols = ( diff --git a/pyproject.toml b/pyproject.toml index 553c1e6..c7779db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,8 @@ include = [ preview = true [tool.ruff.lint.per-file-ignores] -"test/*.py" = ["S102"] -"doc/conf.py" = ["S102"] +"test/*.py" = ["exec-builtin"] +"doc/conf.py" = ["exec-builtin"] [tool.ruff.lint] extend-select = [ @@ -57,13 +57,13 @@ extend-select = [ ] extend-ignore = [ "C90", # McCabe complexity - "E221", # multiple spaces before operator - "E226", # missing whitespace around arithmetic operator - "E402", # module-level import not at top of file - "UP006", # updated annotations due to __future__ import - "UP007", # updated annotations due to __future__ import - "UP031", # use f-strings instead of % - "UP032", # use f-strings instead of .format + "multiple-spaces-before-operator", + "missing-whitespace-around-arithmetic-operator", + "module-import-not-at-top-of-file", + "non-pep585-annotation", + "non-pep604-annotation-union", + "printf-string-formatting", + "f-string", ] [tool.ruff.lint.flake8-quotes] docstring-quotes = "double"