jamalasidd opened a new pull request, #3799:
URL: https://github.com/apache/fory/pull/3799
## Why?
Issue #3233 asks for generated code to include clear generated-file headers
and better line breaking. In my local reproduction, the generated-file notice
was already present, but generated output still contained long lines over 80
characters across multiple languages.
This PR focuses on the reproducible long-line formatting part of the issue.
The changes update specific generator patterns such as Java builder chains, Go
`fory.New(...)` calls, Python `pyfory.field(...)` output, Rust helper/type
lines, and C++ generated method/macro lines.
## What does this PR do?
This PR improves generated code formatting for Apache Fory compiler output
by wrapping long generated lines in several language generators. It adds
targeted, language-safe line breaks in the Java, Go, Python, Rust, and C++
generators instead of using a generic line wrapper that could break syntax.
The implementation keeps the changes focused on generated output formatting
and avoids changing generated behavior.
## Related issues
* Fixes #3233
## AI Contribution Checklist
* [x] Substantial AI assistance was used in this PR: `yes`
* [x] I included the required AI Usage Disclosure.
* [ ] Final `ai_review` evidence has been completed.
### AI Usage Disclosure
Substantial AI assistance was used for this PR. I used AI assistance to help
understand the issue, trace generated long lines back to language-specific
generator code, suggest safe language-specific line-break changes, debug local
testing commands, and organize the PR/README documentation.
I reviewed the suggested code changes manually, applied them locally,
regenerated compiler output, and tested the reproduction case before committing
the changes. The implementation decisions and final submitted code were
reviewed and accepted by me before submission.
### ai_review Summary
Pending before requesting maintainer review.
* Fory-guided reviewer result: pending. I checked `upstream/main` and
`.claude/skills/fory-code-review/SKILL.md` does not currently exist there.
* Independent general reviewer result: pending.
## Does this PR introduce any user-facing change?
* [ ] Does this PR introduce any public API change?
* [ ] Does this PR introduce any binary protocol compatibility change?
This PR changes generated source formatting only. It is not intended to
change public APIs, binary protocol behavior, or generated runtime behavior.
## Benchmark
No benchmark was run. This PR changes compiler-generated source formatting
and is not expected to affect runtime performance.
## Testing
I tested this manually using a small reproduction schema:
```fdl
namespace repro;
struct Person {
1: string first_name;
2: string last_name;
3: string email_address;
4: list<string> tags;
5: map<string, string> metadata;
}
struct Company {
1: string company_name;
2: Person owner;
3: list<Person> employees;
}
```
Generated code with:
```powershell
foryc repro_3233.fdl --lang java,python,go,cpp,rust --output ./generated_3233
```
Then checked for generated lines longer than 80 characters with:
```powershell
Get-ChildItem .\generated_3233 -Recurse -File | ForEach-Object {
$file = $_.FullName
$lineNumber = 0
Get-Content $file | ForEach-Object {
$lineNumber++
if ($_.Length -gt 80) {
Write-Host "$file line $lineNumber has $($_.Length) characters"
Write-Host $_
Write-Host ""
}
}
}
```
After these changes, the checker produced no long-line output for the
reproduced generated files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]