mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-12-27 07:10:19 -05:00
95 lines
2.9 KiB
TOML
95 lines
2.9 KiB
TOML
[project]
|
|
requires-python = ">=3.10"
|
|
|
|
[tool.ruff]
|
|
line-length = 160
|
|
builtins = ['_', 'I', 'P']
|
|
include = ['*.py', '*.recipe']
|
|
exclude = [
|
|
"*_ui.py",
|
|
"bypy/*",
|
|
"setup/polib.py",
|
|
"setup/linux-installer.py",
|
|
"src/css_selectors/*",
|
|
"src/polyglot/*",
|
|
"src/templite/*",
|
|
"src/tinycss/*",
|
|
]
|
|
preview = true
|
|
|
|
[tool.ruff.format]
|
|
quote-style = 'single'
|
|
|
|
[tool.ruff.lint]
|
|
explicit-preview-rules = true
|
|
ignore = [
|
|
'E402', 'E722', 'E741',
|
|
'UP012', 'UP030', 'UP038', 'C413', 'C420', 'PIE790', 'ISC003',
|
|
'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF012', 'RUF013', 'RUF015', 'RUF031', 'RUF100',
|
|
'F841', # because in preview, unused tuple unpacking variable that not use dummy syntax (prefix '_' underscore)
|
|
# raise error 'unused-variable', sigh (https://github.com/astral-sh/ruff/issues/8884)
|
|
]
|
|
select = [
|
|
'E', 'F', 'I', 'W', 'INT',
|
|
'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', 'PIE', 'RET501', 'ISC',
|
|
'RUF', # note: RUF can flag many unsolicited errors
|
|
# preview rules
|
|
'RUF051', 'RUF056', # useless dict operation
|
|
'RUF055', # unnecessary regex
|
|
'RUF039', # always use raw-string for regex
|
|
'RUF047', # needless else
|
|
'E302', 'E303', 'E304', 'E305', 'W391', # blank-line standard
|
|
'E111', 'E112', 'E113', 'E117', # code indentation
|
|
'E114', 'E115', 'E116', 'E261', 'E262', 'E265', # comment formating
|
|
'E201', 'E202', 'E211', 'E251', 'E275', # various whitespace
|
|
]
|
|
unfixable = ['PIE794', 'ISC001']
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"recipes/*" = ['UP']
|
|
"setup/changelog.py" = ['ISC001']
|
|
"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501']
|
|
"src/calibre/ebooks/metadata/sources/*" = ['UP']
|
|
"src/calibre/gui2/store/stores/*" = ['UP']
|
|
"src/qt/*.py" = ['I', 'E302']
|
|
"src/qt/*.pyi" = ['I']
|
|
|
|
[tool.ruff.lint.isort]
|
|
detect-same-package = true
|
|
extra-standard-library = ["aes", "elementmaker", "encodings"]
|
|
known-first-party = ["calibre_extensions", "calibre_plugins", "polyglot"]
|
|
known-third-party = ["odf", "qt", "templite", "tinycss", "css_selectors"]
|
|
relative-imports-order = "closest-to-furthest"
|
|
split-on-trailing-comma = false
|
|
section-order = ['__python__', "future", "standard-library", "third-party", "first-party", "local-folder"]
|
|
|
|
[tool.ruff.lint.isort.sections]
|
|
'__python__' = ['__python__']
|
|
|
|
[tool.ruff.lint.flake8-comprehensions]
|
|
allow-dict-calls-with-keyword-arguments = true
|
|
|
|
[tool.ruff.lint.flake8-quotes]
|
|
avoid-escape = true
|
|
docstring-quotes = 'single'
|
|
inline-quotes = 'single'
|
|
multiline-quotes = 'single'
|
|
|
|
[tool.flynt]
|
|
line-length = 400 # over value to catch every case
|
|
transform-format = false # don't transform already existing format call
|
|
exclude = [
|
|
"bypy/",
|
|
"setup/polib.py",
|
|
"setup/linux-installer.py",
|
|
"src/calibre/ebooks/metadata/sources/",
|
|
"src/calibre/gui2/store/stores/",
|
|
"src/css_selectors/",
|
|
"src/polyglot/",
|
|
"src/templite/",
|
|
"src/tinycss/",
|
|
]
|
|
|
|
[tool.pylsp-mypy]
|
|
enabled = false
|