Skip to content

refactor: no comment in any file, and a gate that refuses one - #91

Merged
lorenzolfm merged 4 commits into
mainfrom
no-comments
Nov 14, 2026
Merged

lorenzolfm merged 4 commits into
mainfrom
no-comments

Conversation

@lorenzolfm

@lorenzolfm lorenzolfm commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What

  • Remove each comment: Rust //, ///, //! and /* */, Nix #, bash in fuzz/session.sh, in Nix '' strings and in run: steps, YAML, TOML, .envrc and .gitignore. The removal is from the ast-grep match ranges, so a # or // in a string stays.
  • Add the gate elo-comments. It runs the ast-grep rule tests, then scans each file of the flake source. CI runs it in the gate matrix.
  • Take the rules from scaffold .config/ast-grep/comments (scaffold#106), only for the languages elo has: Rust, Rust #[doc = ...], Nix, Nix strings, bash, YAML, YAML run:, TOML. The config is the one of scaffold nix/dev/commands/lint.nix, with only the TOML grammar.
  • headerssync.rs: one nested if is now one if with &&. The comment between the two had stopped clippy collapsible_if. The name first_download keeps the meaning of the removed comment.
  • Remove the gate elo-doctest.
  • The comment gate stops when find fails or gives no file.
  • The comment gate stops on each file that no rule reads. commentGlobs lists the files of each language, and commentFree lists the files that need no scan.
  • Salt has private fields and Salt::new. Only headerssync reads the keys.

Why

A gate, not dev lint. elo has no dev command. Each check of elo is a flake gate, so this check is a gate too.

The scan reads the flake source, not git ls-files. A flake source is the tracked files, so the result is the same. find gives hidden files, so .github, .cargo, .config, .envrc and .gitignore get a scan.

Dropped from scaffold. The ignores of database/src/schema.rs and src/doctests.rs, and the rules for awk, proto and SQL. elo has none of those files.

Lost text. No text moves to another place. Git history keeps it. This includes the provenance of the captured bytes in src/fixtures.rs, the version tags after the pinned action SHAs, and the usage text of session.sh.

elo-doctest is removed. The comment gate refuses each /// and each #[doc = ...], and a doctest is one of those. Thus the gate cannot fail. A later doctest PR adds the gate again, with the scaffold ignore of src/doctests.rs.

The gate stops when find fails. A process substitution hides the status of find, so wait $! gets it. An empty list stops the gate too: ast-grep scan with no path scans . with the ignore files, and does not scan the hidden files.

The gate refuses a file that no rule reads. Before, ast-grep skipped a .py, .md or Dockerfile with a comment, and the gate passed. Now one Nix list gives the languageGlobs and the files that the gate takes, so the two cannot become different. README.md, the two Cargo.lock, flake.lock and the fuzz corpus are on commentFree by name. Each Cargo.lock has the two comment lines that cargo writes.

Salt fields are private. A removed comment said that no other sync can read the salt. Only that comment held this. Now the type holds it. The fuzz model reads its own SCRIPT_KEYS and SCRIPT_OFFSET, and each_salt_word_is_new reads net::salt_words.

Not confident:

  • I checked that the gate refuses a planted comment in a .rs, .toml, .sh, .yaml, .envrc and .gitignore file, a nested fuzz/.gitignore, and a planted .py with no comment.

… fails, and name the first-download test

- Remove `elo-doctest`. The comment gate refuses each `///` and each `#[doc = ...]`, so no doctest can be written and the gate cannot fail.
- In `elo-comments`, `wait $!` gets the status of `find`, and the gate stops on an empty file list. Without the files, `ast-grep scan` scans `.` with the ignore files and does not scan hidden files.
- `headerssync.rs`: `first_download` names the work test, as the removed comment did.
- CI: the gate matrix is a block list, at less than 100 columns.
- One list, `commentGlobs`, gives the files of each language. It is the `languageGlobs` of the ast-grep config, and it is the set of files that the gate takes.
- `commentFree` names the files that the gate takes with no scan: the two `Cargo.lock`, `flake.lock`, `README.md` and the fuzz corpus. Each `Cargo.lock` has the two comment lines that cargo writes.
- The gate stops on each other file, such as a `.py` or a `Dockerfile`. Before, ast-grep skipped such a file and the gate passed.
- The gate tests its file check first, on a list of paths.
…ads the keys

- `Salt::new` makes a salt. No other module reads or copies its fields.
- `net::salt_words` reads the random words. `each_salt_word_is_new` tests them, and `salt` gives them to `Salt::new`.
- The fuzz model reads `SCRIPT_KEYS` and `SCRIPT_OFFSET`, the values of its own salt.
@lorenzolfm
lorenzolfm merged commit 6a0e3c1 into main Nov 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant