Skip to content

RAT-581: Check license headers in Rust source files - #753

Merged
Claudenw merged 2 commits into
apache:masterfrom
tisonkun:codex/check-rust-license-headers
Oct 19, 2026
Merged

Claudenw merged 2 commits into
apache:masterfrom
tisonkun:codex/check-rust-license-headers

Conversation

@tisonkun

Copy link
Copy Markdown
Member

Rust .rs source files are reported as BINARY because Tika identifies them as application/rls-services+xml, which RAT does not map to a text document. As a result, neither approved headers nor missing or unapproved licenses are checked.

Classify this XML media type as STANDARD, following the existing XML mappings and the approach used for XSLT in #658. Content detection still takes precedence: a PNG named .rs remains binary. Add analyzer-level regression tests for Apache, GPL, unknown and missing Rust license headers, actual RLS XML, and a renamed PNG.

The separate Tika filename ambiguity is tracked in TIKA-4977.

Validation:

  • Without the mapping, the four Rust license cases and the RLS XML case fail because the documents are BINARY; the renamed PNG test passes.
  • With the mapping, ./mvnw -B -ntp clean install passes with JDK 25.0.2 and Maven 3.10.0.

@ottlinger ottlinger changed the title Check license headers in Rust source files RAT-581: Check license headers in Rust source files Oct 18, 2026

@ottlinger ottlinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - @Claudenw are you okay as well or should we add Rust to the testdata structure/testdata files instead?

@ottlinger
ottlinger requested a review from Claudenw October 18, 2026 21:05

@Claudenw Claudenw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tisonkun Thank you for your contribution.

@ottlinger This change is restricted to the core code and so does not impact the UI work.

@Claudenw
Claudenw merged commit 3205c61 into apache:master Oct 19, 2026
12 of 13 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.

3 participants