Skip to content

Commit c671270

Browse files
committed
Apply lint fixes
1 parent c951463 commit c671270

File tree

15 files changed

+149
-180
lines changed

15 files changed

+149
-180
lines changed

doc/source/conf.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
source_suffix = '.rst'
2020
master_doc = 'index'
2121

22-
project = u'python-xmlsec'
23-
copyright = u'2020, Oleg Hoefling <[email protected]>' # noqa: A001
24-
author = u'Bulat Gaifullin <[email protected]>'
22+
project = 'python-xmlsec'
23+
copyright = '2020, Oleg Hoefling <[email protected]>'
24+
author = 'Bulat Gaifullin <[email protected]>'
2525
release = importlib.metadata.version('xmlsec')
2626
parsed: Version = parse(release)
27-
version = '{}.{}'.format(parsed.major, parsed.minor)
27+
version = f'{parsed.major}.{parsed.minor}'
2828

2929
exclude_patterns: list[str] = []
3030
pygments_style = 'sphinx'
@@ -39,19 +39,19 @@
3939
(
4040
master_doc,
4141
'python-xmlsec.tex',
42-
u'python-xmlsec Documentation',
43-
u'Bulat Gaifullin \\textless{}[email protected]\\textgreater{}',
42+
'python-xmlsec Documentation',
43+
'Bulat Gaifullin \\textless{}[email protected]\\textgreater{}',
4444
'manual',
4545
)
4646
]
4747

48-
man_pages = [(master_doc, 'python-xmlsec', u'python-xmlsec Documentation', [author], 1)]
48+
man_pages = [(master_doc, 'python-xmlsec', 'python-xmlsec Documentation', [author], 1)]
4949

5050
texinfo_documents = [
5151
(
5252
master_doc,
5353
'python-xmlsec',
54-
u'python-xmlsec Documentation',
54+
'python-xmlsec Documentation',
5555
author,
5656
'python-xmlsec',
5757
'One line description of project.',
@@ -75,8 +75,7 @@
7575

7676

7777
def lxml_element_doc_reference(app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: Text) -> reference:
78-
"""
79-
Handle a missing reference only if it is a ``lxml.etree._Element`` ref.
78+
"""Handle a missing reference only if it is a ``lxml.etree._Element`` ref.
8079
8180
We handle only :class:`lxml.etree._Element` and :class:`~lxml.etree._Element` nodes.
8281
"""
@@ -85,7 +84,7 @@ def lxml_element_doc_reference(app: Sphinx, env: BuildEnvironment, node: pending
8584
and node.get('reftarget', None) == 'lxml.etree._Element'
8685
and contnode.astext() in ('lxml.etree._Element', '_Element')
8786
):
88-
reftitle = '(in lxml v{})'.format(lxml.__version__) # type: ignore[attr-defined]
87+
reftitle = f'(in lxml v{lxml.__version__})' # type: ignore[attr-defined]
8988
newnode = reference('', '', internal=False, refuri=lxml_element_cls_doc_uri, reftitle=reftitle)
9089
newnode.append(contnode)
9190
return newnode

pyproject.toml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ line-length = 130
2929
# Target Python version (used for autofixes and style rules)
3030
target-version = "py39"
3131

32-
# Enable rule categories:
33-
# E = pycodestyle (style issues, like indentation, whitespace, etc.)
34-
# F = pyflakes (unused imports, undefined names)
35-
# D = pydocstyle (docstring format/style issues)
36-
# I = isort (import sorting)
37-
# B = flake8-bugbear (common bugs & anti-patterns)
38-
# UP = pyupgrade (auto-upgrade syntax for newer Python)
39-
# SIM = flake8-simplify (simplifiable code patterns)
40-
# RUF = Ruff-native rules (extra, performance-optimized checks)
41-
select = ["E", "F", "D", "I", "B", "UP", "SIM", "RUF"]
42-
4332
# Directories and files to exclude from linting and formatting
4433
exclude = [
4534
".venv*", # virtual environments
@@ -52,8 +41,20 @@ exclude = [
5241
"*_pb2.pyi" # protobuf-generated type stubs
5342
]
5443

55-
# File-specific rule ignores (equivalent to flake8's `per-file-ignores`)
56-
[tool.ruff.per-file-ignores]
44+
[tool.ruff.lint]
45+
# Enable rule categories:
46+
# E = pycodestyle (style issues, like indentation, whitespace, etc.)
47+
# F = pyflakes (unused imports, undefined names)
48+
# I = isort (import sorting)
49+
# B = flake8-bugbear (common bugs & anti-patterns)
50+
# UP = pyupgrade (auto-upgrade syntax for newer Python)
51+
# SIM = flake8-simplify (simplifiable code patterns)
52+
# RUF = Ruff-native rules (extra, performance-optimized checks)
53+
select = ["E", "F", "I", "B", "UP", "SIM", "RUF"]
54+
# TODO: Add more rule categories as needed, e.g.:
55+
# D = pydocstyle (docstring format/style issues)
56+
57+
[tool.ruff.lint.per-file-ignores]
5758
"*.pyi" = [
5859
# Ignore formatting and import errors in stub files
5960
"E301", # expected 1 blank line, found 0
@@ -62,6 +63,7 @@ exclude = [
6263
"E501", # line too long
6364
"E701", # multiple statements on one line
6465
"F401", # unused import
66+
"F811", # redefinition of unused name
6567
"F822" # undefined name in `__all__`
6668
]
6769
"doc/source/conf.py" = [

0 commit comments

Comments
 (0)