Repository navigation
basou: Measure the name of a file and the paths of files on a board - #363
Merged
Merged
Conversation
- board.yaml: board_version 3 adds two kinds of measure over a repo's files, with include, exclude and at as a file_count has them, and not measured where a file_count is not. file_name picks the first or the last of the files matched (pick), in the byte order of their paths, and its value is that file's name; with a pattern it picks only among the files whose name the pattern matches, and the value is what the pattern's group holds (1 when it names none, and a group without a pattern is refused). file_paths gives the paths matched, in byte order, up to 1000; more is not measured. No file to pick is not measured: a string has no zero. A ratio takes neither, and a board of version 1 or 2 is told that version 3 reads them. - The value of a measure may be a list of strings. The difference from the previous record lists each path that came in or went out when both hold a list, and the value whole otherwise. - board measure prints a list as a count, and --json gives the paths; the board page draws it in its lane as a count, with the paths folded under it, and reads a record whose measure holds one. - board guide says where to read the paths and how the difference gives them; board init's comment on measures names the two kinds.
A name of four bytes from 0xf0 (U+1F600) is after one from 0xef (U+FF5E) in byte order, though its first UTF-16 unit is before. The test now tells the two orders apart, so sorting by the decoded text fails it.
- board guide and CHANGELOG: it is the Measures section of board measure that gives a list as a count. The difference from the previous record gives each path that came in or went out when both records hold a list, and the list whole when only one does. - The comment of BOARD_DEFAULT_CAPTURE_GROUP names a file_name measure with a pattern, which takes it too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The third of the changes that move
basou board(experimental) to a new shape of its declaration and its records. Like the first two, it lands on the integration branchboard/shape-v3, not onmain; all of them go tomainand out in one release.What changes
Two kinds of measure over a repo's files (from
board_version: 3). Both takerepo,include,excludeandatas afile_countdoes, and are not measured where afile_countis not (a fixed directory with nothing under it, a directory git could not list, a symlink that leaves the repository, a repo or revision that cannot be read).file_namepicks the first or the last of the files matched (pick, required), in the byte order of their paths in the repository, as git orders them, and its value is that file's name. With apattern, it picks only among the files whose name the pattern matches, and the value is what the pattern'sgroupholds. The names are narrowed before one is picked, so a name with no match at the end of the order (schema.sqlafter the dated ones) does not hide the one before it.groupis filled in as 1 only when there is apattern; agroupwithout apatternis refused, so a declaration's snapshot never holds agroupthat means nothing. Agroupthe pattern does not have is refused, as for aregex_capture.file_pathsgives the paths matched, in byte order, up to 1000 (BOARD_FILE_PATHS_MAX, fixed with version 3: a measure has no method version, so changing it would turn the same repository's value between null and a list unseen). More is a null with that as the reason. Nothing matched under a directory that is there is an empty list. Two paths that are not UTF-8 and read as the same text are kept once.ratios[0].numerator: 'latest_migration' is a file_name, which is not a number).measures[0].kind: 'file_name' is read from board_version 3 on; this file is board_version 2).The value of a measure may be a list of strings. In the difference from the previous record, a measure whose value is a list in both records is compared as a set: each path that came in is
added(measures.migrations.value["db/migrations/20261001_x.sql"]), each that went outremoved. When one of the two is not a list (not measured, or no such measure then), the value is compared whole. The difference is not part of a record.basou board measureprints a list as its count underMeasures:(migrations 12 files (paths in --json) [data]), and--jsongives the paths. UnderSince the previous record, the paths that came in and went out are a line each, and a list compared whole is printed whole.The board page draws a list in its lane as a count, with the paths folded under it (
<details>), and reads a record whose measure holds one; a record whose measure holds a list of anything but strings is not drawn.basou board guidesays thatMeasures:in measure.txt gives a list as a count, where to read the paths, and how the difference gives them (each path when both records hold a list, the list whole when only one does).basou board init's comment onmeasuresnames the two kinds.Tests
pick,groupwith and without apattern, a group past the pattern's, a key the kind does not take, a repo the manifest does not declare),groupfilled only with a pattern, a ratio of either refused, the kinds a version 3 board names, and which version a version 1 or 2 board is told reads them.Bbeforea, and a name whose first byte is 0xc3 afterz); the paths matched, an empty list, the lane; no file, no name, a group that took no part, a fixed directory with nothing under it (in the working tree and at a revision), a repo not on disk; two non-UTF-8 paths that read as the same text kept once; 1000 paths kept and 1001 not measured; a symlink that leaves the repository.<details>with its count and unit.board measureprints a list as a count and--jsongives the paths; the guide's line andinit's comment.pick,groupand the ratio and repo checks; the order, the narrowing, the name, the dedupe and the limit; the set diff; the page's reader and its drawing; the text output). Sorting the decoded text instead of the bytes passed at first and is held by the second commit's test.pnpm -r build,pnpm typecheck,pnpm -r test:coverage,pnpm test:scripts,pnpm lint,pnpm lint:langandpnpm lint:pathspass locally.