google / google/go-jsonnet

Figure out what code-modifying tools should do about formatting

Open
#389 8 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

Currently there are no code-modifying tools, other than the autoformatter that I know about, but we may want to add autofix to linter one day. Some 3rd party users also expressed interest in writing code-manipulating tools.

This is finally possible with the addition of Fodder to the AST. Unfortunately it is still not clear how to actually save the AST back in the text form. Using autoformatter to dump AST requires being aware of the formatting options. Also, using a pinned version of the formatter makes sense.

Perhaps we can have a near-full-fidelity, optionless unparser?
The tools could then change the affected part of the code, without affecting the rest too much. Implementing such unparser may require changing the definition of the Fodder and saving some additional info in the AST.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.