- Functions and macros declared inside a test no longer count as its
assertions or calls; a call to one still counts as a helper call.
- `should_panic` exempts a test only as an applied attribute:
`#[should_panic]`, or inside `#[cfg_attr(test, ...)]`.
- `only-weak` strips parentheses around the whole condition, so
`assert!((x.is_ok()))` is classified like `assert!(x.is_ok())`.
- `#[ cfg(test)]` and attributes with comments between `#`, `[` and
`cfg` mark test code like the compact form.
test_regions matched only the exact `#[cfg(test)]`, so helpers in a
module under `#[cfg(all(test, windows))]` or
`#[cfg(all(test, not(target_arch = "wasm32")))]` (as in
apps/vectorcraft-web/src/file_drops.rs) were not test code: a sleep in
such a helper passed the check, and its asserting helpers were not found.
A cfg predicate now counts when it is `test` or an `all(...)` with such a
predicate among its arguments, at any depth and with any spacing.
`any(test, ...)`, `not(test)` and `feature = "test"` do not count.
Replayed over the last 300 merges to main, only-weak would have failed
3 merges on 4 hits, and all 4 were tests where an is_ok or is_some check
is the behavior under test (a lease or start file that can be taken
again, a never-panic property test, a label found by a search with the
row's position in its predicate). Of the 39 only-weak hits in the whole
workspace, most are the same kinds: registry and label lookups,
still-imports and never-panic tests.
only-weak now lists its hits without failing, like all-unguarded. The
check fails on self-compare, ignore-without-reason and sleep. With this
change the replay fails 0 of 272 merges that change Rust files.
- The module docs and docs/development.md name the four rules that fail
the check, and describe `only-weak` and `self-compare` by what they
match (`len() > 0`, `assert_ne!`).
- The changed-lines diff passes `--inter-hunk-context=0`, so a clone's
`diff.interHunkContext` cannot mark unchanged lines between two edits.
- Single-letter workflow variables count as set.
- Test names with non-ASCII letters are read whole.
- An allow in a block comment needs a reason before `*/`.
- `all-unguarded` uses only a binding still in scope at the assertion,
treats a `const` declared with different values as unknown, and drops
a counted local once its collection may shrink or be replaced.
- `only-weak` ignores `unwrap_err`, `expect_err` and `panic!` in failure
messages.
- `self-compare` leaves out operands that call a method returning the
next value each time (`next`, `pop_front`, `recv` and others).
- An `ignore-without-reason` span reaches the attribute's `]`, so a
change to a reason on the next line counts.
- Changed mode decodes `+++` labels (the tab after a path with a space,
C-quoted paths), and the file inventories read `git ls-files -z`, so
files with spaces, quotes or non-ASCII names are linted.
- `#[test_case(1; "one")]` arguments and other attributes no longer end
the item before its `fn`, and an inner `#![...]` attribute before the
first test is not part of that test's span.
- A helper name counts as asserting only when every function of that
name in the crate's test code asserts.
- `.stdout(file)` and other stream builder calls count as configuration
whatever their argument, so `exit-status-only` still reports.
- A `return` inside `async { ... }` or `async move { ... }` ends the
future, not the test, for `early-return`.
- `env-gate-unset` looks for setters in code only, not in string
literals, ignores `echo` and `printf` output that is not written to
`$GITHUB_ENV`, and its span reaches the variable name on a later line.
- `sleep` reports `thread::sleep`, or a bare `sleep(...)` only where the
file imports `thread::sleep`.
- `reads-source` checks raw string paths in `include_str!` and
`ends_with`.
- A test pins that a collection changed after its `assert_eq!` loses
that guard for `all-unguarded`.
Replayed over the last 300 merges of main, all-unguarded failed good
pull requests on collections that cannot be empty. It now leaves out:
- plain locals bound to an array type of a positive length, to a
non-empty array literal or vec![...], or to a literal range followed
only by methods that keep an item (map, iter, rev, collect into a
known collection ...); counts may be consts of the file
- locals filled by a push or insert on every pass of a loop over such a
source
- fields and const or static items the file declares only as arrays of
a positive length
- collections compared with a non-empty literal through such methods,
directly or through a local built from them, and assertions on a
local bound to a count or length
- .windows(k) and .chunks_exact(k) when the collection has k items
Later code that may remove items or replace the collection cancels the
exemption.
Only only-weak, self-compare, ignore-without-reason and sleep fail the
check now. The other rules list their hits on changed lines without
failing. On the same 300 merges, 1 would fail (an only-weak test), and
the 3 all-unguarded hits are tests an empty result passes. On main at
07037afda8, all-unguarded lists 392 hits instead of 433.
`cargo xtask test-lint` reads the Rust files changed since a base and
fails on tests that a wrong result can pass: `.all()` with no length or
emptiness check, only is_ok/is_some/non-empty checks, `assert_eq!(x, x)`,
a process test that checks only the exit status, no assertion and no
asserting helper, a silent early return on a value from the code under
test, `#[ignore]` without a reason, an environment variable that no CI
leg sets, `thread::sleep` in test code, and test code that reads Rust
source outside the listed source audits.
Only hits on changed lines, or in a test with a changed line for the
rules about a whole test, fail it; older hits in the same files are
counted. The base is --base or TEST_LINT_BASE, the first parent of the
checked-out commit in CI (a shallow checkout fetches it), else the merge
base with upstream/main or origin/main. `// test-lint: allow <rule>
<reason>` exempts a line. `--all` lists every hit by crate and rule and
does not fail. `cargo xtask ci` runs it after cursors, so it runs in the
checks shard.
craft-libs main at 2680a3b3f adds #4364 (its egui pin moves to
07c20531, which VectorCraft's egui lines now match), #4425, #4409, #4414,
#4406, #4349, #4393, #4392, #4398, #4415, #4411, #4402, #4400, #4417,
#4399, #4407, #4375, #4428 and #4451. winit stays at 0dfcec0e, the rev
craft-libs pins. craft-nightly and craft-web-api move with the other
craft-libs crates, and xtask pdf-deps checks the new rev. Cargo.lock:
epaint_default_fonts now depends on brotli 9.1.3 and brotli-decompressor
6.3.2.
At the craft-libs pin this branch moves to, a panel shown in a dock flyout
runs its body twice in the release frame: first in the container's
invisible sizing pass, then in the real run. copy_shown read the release
in the sizing pass, where the readout has no area, and cleared the press
it had remembered, so the real run saw a release without a press and
copied nothing. Info's W, H and other readouts stopped copying
(panel_readout_copy: three tests failed with no copy).
copy_shown now returns before reading input or the remembered press in a
sizing pass.
craft-nightly was still pinned at 1f6c3a21f while every other craft-libs
crate moved to aa7e668ec. The newer craft-nightly brings:
- craft-libs#4297: profile-root validation requires HOME on Unix and
APPDATA and LOCALAPPDATA on Windows, and refuses a configured OS
directory that is relative or contains `..`
(ProfileError::MissingStableBoundary and InvalidStableBoundary).
- craft-libs#4304: a Unix socket (or AF_UNIX socket on Windows) in a
profile's single-instance/ folder is accepted when the app lists that
folder, and Launch reports whether the launcher's `--` separator was
present (passthrough_args_with_launcher_separator).
- craft-libs#4309: a Windows test fix only.
VectorCraft builds against these without code changes: it does not
construct Launch or match ProfileError exhaustively, and its
single-instance record is instance.json with a TCP listener. Cargo.lock
adds uds_windows (already in the lock) to craft-nightly's dependencies.
The Layers panel built its row order again on every selection change:
each change made a new Tracked for the rows, and the rows reported no
order revision, so the panel asked every row for the rows inside it
(7 calls for the 6 rows of the new test's document).
- LayerRows reports LayerTree::order_revision: a hash of the document,
the open rows, Show Layers Only and the isolated node. The selection,
the highlighted rows, the current layer and the names are not in it.
- refresh_rows writes new rows into the kept Tracked while the document
(uid and revert count) stays the same, and makes a new Tracked for
another document or after File > Revert.
- The craft-libs pin moves from 186a229c8 to aa7e668ec, current
craft-libs main, which has craft-libs#4319 (LayerTree::order_revision).
The winit rev moves to 0dfcec0eb, as craft-libs pins it; egui stays
at 14c39fed1. xtask pdf-deps checks the new rev. craft-nightly keeps
the rev main pins it at.
Two tests failed on the new craft-libs:
- canvas::tests::a_selection_drag_draws_its_marks_in_the_frame_the_pointer_moves:
since craft-libs#4143 a frame runs one pass where it ran two, and the
bounding box, Live Corners, hollow corners and shape widgets were drawn
before the tool host took the frame's pointer event, so the box showed
at the old corner. They are now drawn after it, into paint slots kept
in their old order.
- tests::nativemenu::applying_a_dialog_preview_reads_the_menus: since
craft-libs#4350 the closed dialog's angle field gives up the keys one
frame sooner, so the menus are sent again without the text-editing
gate within the frames the test ran. The test now waits for the gate
and counts the read and that send apart.
* feat(nightly): wire craft-nightly for self-isolated direct launch
* fix(nightly): answer plain version before resolving profile root
* test(nightly): retain exact version and saved profile coverage
The Set type row names Justification… (#2771) instead of calling the
justification options missing. The Alongside step names the one menu stub
left, Effect › 3D and Materials › Materials…, instead of 28. Both M7 rows
mark tab leaders done (#1880) and vertical type in progress with Type ›
Type Orientation (#5027).
Lines that called shipped work missing, pending or unconfirmed now say
what main has: the key anchor for Align and Distribute (#7769, #8023),
artboard colors in exports and print (#4991), update checks (#4138),
Touch Type, Snap to Glyph, ruby, kinsoku sets and tate-chu-yoko, the
file-font and read-only save regressions passing in #4569 and #6671,
and the Wayland cursor and Windows title bar fixes the reporters
confirmed (#1645, #1758). The built-in brush library count and list
match the twenty libraries in brushlib.rs, and the Preferences count
matches the two options still listed under Missing.
Lines that listed shipped features as remaining now name the pull
request that built them: Touch Type (#2469), the Dimension tool (#1788),
the freehand Keep selected (#2246), Alt to the Smooth tool (#2685), Blob
Brush Merge Only with Selection (#2367), Live Corners' Relative rounding
(#3091), Global Edit of similar groups (#4983), Consolidate All Windows
(#5216), Select All across threaded frames (#5542), the Bullets and
Numbering dialog and list levels (#5037), Convert to Text (#4093), the
spelling dialogs (#6341, #6425, #7744), Retype's installed-font search
(#8823), Retype in Quick Actions (#8778) and Cursor Swatch Preview
(#7265). The #1758 entry records the reporter's confirmation. Scores,
status lines and revision-history rows are unchanged.
The two duplicate Simplify rows are marked done: the slider opens at
the Auto-Simplify level (#3750), and with part of a path
direct-selected only the selected runs are simplified (#3814).
The Actions panel row names New Action (#5270) and Action Options
setting a function key that plays the action; editing actions remains.
The dynamic symbols row adds gradient and pattern fills and strokes
and the Transparency panel's opacity and blend for a picked part
(#6308), and .ai editing data keeping dynamic symbols (#8747).