Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
144 lines (138 loc) · 5.55 KB
/
Copy pathpyproject.toml
File metadata and controls
144 lines (138 loc) · 5.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
[tool.vulture]
# These are reached in ways vulture cannot see, so it would report every one of
# them as dead. The run_* tasks are pulled from OptimizationRegistry rather than
# called by name; exc_* are the __exit__ protocol parameters, which have to be
# accepted and are then unused by design.
#
# Listed one by one rather than as run_*/exc_* globs: a pattern would also cover
# a future run_ task that really had gone dead.
ignore_names = [
"run_vacuum_all",
"run_fstrim",
"run_fccache",
"run_tmpfiles_cleanup",
"run_ldconfig",
"run_locale_gen",
"run_man_db_refresh",
"run_dns_flush",
"run_autostart_cleanup",
"run_systemd_user_service_cleanup",
"run_user_systemd_reset_failed",
"run_system_systemd_reset_failed",
"run_swap_management",
"run_journal_optimization",
"run_coredump_cleanup",
"run_broken_symlink_cleanup",
"run_desktop_database_refresh",
"run_mime_database_refresh",
"run_glib_schema_compile",
"run_icon_cache_refresh",
"run_locate_db_refresh",
"run_flatpak_repair",
"run_package_repo_refresh",
"exc_tb",
"exc_type",
"exc_val",
# TypedDict keys, from the app records in uninstall/discovery.py. A key is
# declared as an annotation in the class body and read as a string subscript
# (app["install_dir"]), and vulture cannot connect the two -- so it calls the
# declaration a dead variable. The other keys of those same records escape
# only by coincidence, because some local variable elsewhere happens to share
# the name; these four are the ones with no such twin, not a group that is
# special in any other way.
#
# "id" is the blunt one: it would now also hide a genuinely dead variable
# named id anywhere in src/. Nothing defines one, and a plain variable named
# id shadows a builtin, which is a defect of its own that ruff would have
# something to say about.
"collateral_packages",
"collateral_unavailable",
"flatpak_scope",
"id",
"install_dir",
# Same thing one record over: UninstallOutcome in uninstall/removal.py. Its
# other two keys have a same-named local (the screen's package_removed, the
# function's own data_left_in_place); removed_paths and
# processes_left_running are only ever read as result.get("..."), which
# vulture does not see.
"removed_paths",
"processes_left_running",
# And once more for the scan records: core/scan_cache.ScanResult mirrors the
# Rust struct, analyze.FastExploreResult adds the preview keys, and the whole
# analyze chain reads them as data.get("..."). The coincidental twin covers
# path, file_count, subdirs, size_bytes, entry_meta and is_fast_explore, and
# _cache_estimated_bytes is spared by its underscore; these five are what is
# left over.
"preview_entry_limit",
"preview_sampled_entries",
"preview_truncated",
"top_files",
"total_size_bytes",
# core/engine.reset_engine_state clears the process-wide "engine is unusable"
# latch. Only tests/conftest.py calls it -- an autouse fixture, so that one
# test feeding the boundary a mismatched schema cannot turn the engine off for
# every test after it -- and vulture reads src/ alone.
"reset_engine_state",
]
[tool.ruff]
# 指定代码目标版本
target-version = "py310"
line-length = 100
[tool.ruff.lint]
# 启用的规则集
# E: pycodestyle
# F: Pyflakes
# I: isort (自动整理导入顺序)
# UP: pyupgrade (升级旧语法)
# B: flake8-bugbear (发现潜在bug)
# SIM: flake8-simplify (简化代码)
# ISC: flake8-implicit-str-concat (捕获缺逗号导致的隐式字符串拼接)
select = ["E", "F", "I", "UP", "B", "SIM", "W", "ISC"]
ignore = ["E501"]
# 自动修复
fixable = ["ALL"]
unfixable = []
[tool.ruff.format]
# 使用双引号,类似于 Black
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.coverage.run]
branch = true
source = ["src"]
# Interactive terminal rendering and raw keyboard/mouse handling are now driven
# end to end by tests/test_pty_integration.py (real pty: alternate-screen round
# trip, a cbreak ESC keypress, and SIGINT/SIGTERM -> 130/143 with the terminal
# reset). That suite launches topo as a child process, though, so its execution
# of src/ui does not register as line coverage here. The omit therefore stays
# until a subprocess-coverage harness (COVERAGE_PROCESS_START) attributes the
# child's lines back to this report; remove it then, not before -- dropping it
# now would only expose the in-process navigator unit tests' coverage, which the
# pty suite does not lift.
omit = [
"src/ui/**",
"src/__init__.py",
"src/**/__init__.py",
]
[tool.coverage.report]
show_missing = true
skip_covered = true
precision = 0
# Exclusions must describe code that cannot add meaningful behavioral coverage,
# not merely code that is inconvenient to test. Business branches, error
# handling, filesystem mutations, and command construction remain measurable.
exclude_also = [
# Explicit, reviewable escape hatch for platform-only or process-replacing
# paths. Every use should include a nearby comment explaining why.
"# pragma: no cover",
# Static typing blocks never execute at runtime.
"if TYPE_CHECKING:",
# Abstract/protocol declarations define contracts rather than behavior.
"@(abc\\.)?abstractmethod",
"raise NotImplementedError",
# Standard defensive assertions that communicate an unreachable state.
"if __debug__:",
# Module entry points only delegate to the already-tested application API.
"if __name__ == .__main__.:",
]