fix(copyright): handle Javadoc @author with a trailing homepage anchor#1283
Conversation
The prior fix recovered `@author <a href="url">Name</a>` (name inside the anchor). eclipse-vertx/vert.x also uses the form where the name is plain text and an http anchor follows it as a handle/homepage link — `@author Francesco Guardiani <a href="https://…">@slinkydeveloper</a>` — which still produced no author because the trailing URL and `@handle` broke extraction. Drop the trailing http(s) anchor (href and link text) from an author-marked line when a plain-text name precedes it, leaving just the name. Scoped to an author marker; the name-inside-anchor form and copyright/contact anchors are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Greptile SummaryThis PR extends Javadoc
Confidence Score: 5/5Safe to merge — the change is a narrowly scoped fix to two well-isolated extraction layers, both guarded by letter/at-sign checks that prevent misfires against the existing name-inside-anchor form. Both new code paths carry explicit guards that prevent them from firing on the patterns handled by the previous PR. The regex ordering in prepare.rs is correct: the new trailing-anchor regex runs first and the letter guard ensures the name-inside-anchor form is unaffected. The refiner function is guarded against email-bearing or empty prefixes. End-to-end tests cover both new patterns through the full detection pipeline. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "docs(copyright): correct the trailing-an..." | Re-trigger Greptile |
Some Javadoc `@author` tags follow the name with a bare social/VCS handle rather than an anchor — `@author Francesco Guardiani @slinkydeveloper`. The handle's `@` prefix got the whole candidate rejected as a code fragment, so no author was extracted. Strip a trailing `@handle` when a real name precedes it, keeping just the name. Guarded so an email address or a standalone `@ref`/`@type` token is left untouched. Closes the last of the vert.x `@author` residual. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Address review: under the `(?i)` flag `[A-Z]` is case-insensitive, so the "begins with an uppercase letter" comment was misleading. Spell the class as `[A-Za-z]` and describe the guard accurately — the text between the marker and the anchor must begin with a letter (never `<`), which is what separates this trailing-anchor form from the name-inside-anchor form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Summary
Follow-up to #1281, closing the remaining
@authorresidual oneclipse-vertx/vert.x.#1281 recovered
@author <a href="url">Name</a>(name inside the anchor). vert.x also uses the form where the name is plain text and an http anchor follows it as a handle/homepage link:The trailing URL +
@handlestill broke extraction (no author). This drops the trailing http(s) anchor (href and link text) from an author-marked line when a plain-text name precedes it, leaving just the name. Scoped to an author marker; the name-inside-anchor form and copyright/contact anchors are unaffected.Testing
cargo test --lib copyright::detector::tests_false_positives::test_javadoc_author_with_html_anchor_is_extracted— extended with the trailing-anchor case.cargo test --features golden-tests --test copyright_golden— 36/36 pass.cargo test --lib copyright::prepare— 103 pass.Compare evidence
eclipse-vertx/vert.x @ 78ade62: recoversFrancesco Guardiani(and the other trailing-anchor@authorfiles), closing the 4-file residual noted in #1282.🤖 Generated with Claude Code