diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 17:09:59 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 17:09:59 +0000 |
| commit | e757979f1a2afdbe7146066345bb9acd19d3b151 (patch) | |
| tree | 30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /src/recipe.rs | |
| parent | 94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff) | |
| download | aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip | |
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained
either re-explained the line below them or had grown into paragraphs.
Density went from one comment line per 6.7 lines of code to one per 10.
827 insertions against 2194 deletions across 86 files.
What survived: the invariants (I1-I12), the design cross-references into
DESIGN.md, and the notes recording a bug that was found and fixed — those
are the comments that carry weight, because they answer a question the
code cannot answer about itself. What did not: restating a function
signature in prose, and narration of the statement underneath.
Diffstat (limited to 'src/recipe.rs')
| -rw-r--r-- | src/recipe.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/recipe.rs b/src/recipe.rs index 4ba6a6f..cfdb4c6 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -1,9 +1,3 @@ -//! Recipe parsing: `.SRCINFO` (authoritative, present in every AUR repo) with a -//! `PKGBUILD` fallback, plus `source=()` parsing. -//! -//! The recipe is what a human reviews, so parsing failures are loud: a recipe we -//! cannot read must never silently produce a candidate with an empty source list. - use std::collections::BTreeMap; use crate::db::model::{Recipe, SourceEntry}; @@ -92,8 +86,8 @@ fn push_field(r: &mut Recipe, in_pkg: bool, pkg: Option<&str>, k: &str, v: &str) /// Minimal `PKGBUILD` variable reader: top-level `var=value` and `var=(...)` /// assignments, including arrays spanning several lines and quoted elements. /// -/// This is a fallback for recipes without `.SRCINFO`; it deliberately does not -/// try to evaluate bash. Anything it cannot read is reported, not guessed. +/// A fallback for recipes without `.SRCINFO`; it deliberately does not evaluate +/// bash. Anything it cannot read is reported, not guessed. pub fn parse_pkgbuild(text: &str) -> Result<Recipe> { let vars = pkgbuild_vars(text); let mut r = Recipe::default(); @@ -357,13 +351,9 @@ pub fn is_diffable(path: &str) -> bool { /// The executable part of a `PKGBUILD`: everything from the first function /// definition onward. /// -/// The variable assignments above the functions are metadata — a new version -/// string, another dependency. The functions are code that runs on this machine -/// and, through the package, on every machine that installs it. Reviewers and -/// the risk scorer both need that line drawn in the same place, so it is drawn -/// once here (§6 m-2): two copies had drifted, and the diff panel's version -/// compared only the function *header* lines, so a rewritten `build()` body -/// with the same function names showed the reviewer nothing. +/// The assignments above the functions are metadata; the functions are code that runs +/// here and, through the package, everywhere it installs. +/// scorer need that line drawn in the same place (§6 m-2). pub fn pkgbuild_bodies(text: &str) -> String { let mut out = String::new(); let mut inside = false; |
