Note that there are some explanatory texts on larger screens.

plurals
  1. POStand-alone Java code formatter/beautifier/pretty printer?
    primarykey
    data
    text
    <p>I'm interested in learning about the available choices of <strong>high-quality, stand-alone source code formatters for Java.</strong></p> <p>The formatter must be stand-alone, that is, it must support a <strong>"batch" mode</strong> that is <a href="https://stackoverflow.com/questions/384101"><strong>decoupled from any particular development environment</strong></a>. Ideally, it should be <strong>independent of any particular operating system</strong> as well. So, a built-in formatter for the IDE du jour is of little interest here (unless that IDE supports batch mode formatter invocation, perhaps from the command line). A formatter written in closed-source C/C++ that only runs on, say, Windows is not ideal, but is somewhat interesting.</p> <p><strong>To be clear, a "formatter" (or "beautifier") is not the same as a "style checker."</strong> A formatter accepts source code as input, applies styling rules, and produces styled source code that is semantically equivalent to the original source code. Syntactic modifications are limited to things like modifying code layout as in changing whitespace, or organizing <code>import</code> statements. Very little, if any, other refactoring is performed. A style checker also applies styling rules, but it simply <em>reports</em> rule violations <em>without producing modified source code</em> as output. So the picture looks like this:</p> <p><strong>Formatter</strong> (produces modified source code that conforms to styling rules)</p> <p>Read Source Code &rarr; Apply Styling Rules &rarr; Write Styled Source Code</p> <p><strong>Style Checker</strong> (does not produce modified source code)</p> <p>Read Source Code &rarr; Apply Styling Rules &rarr; Write Rule Violations</p> <p><strong>Further Clarifications</strong></p> <p>Solutions must be highly configurable. I want to be able to specify my own style, not simply select from a preset list.</p> <p>Also, I'm <strong>not looking for a <a href="https://stackoverflow.com/questions/332166">general purpose pretty-printer written in Java</a></strong> that can pretty-print many things. I want to style Java code.</p> <p>I'm also <strong>not <em>necessarily</em> interested in a <a href="https://stackoverflow.com/questions/251622">grand-unified formatter</a></strong> for many languages. I suppose it might be nice for a solution to have support for languages other than Java, but that is not a requirement.</p> <p>Furthermore, <strong><a href="https://stackoverflow.com/questions/206441">tools that only perform code highlighting</a> are <a href="http://en.wikipedia.org/wiki/Holy_Hand_Grenade_of_Antioch" rel="noreferrer">right</a> <a href="http://www.youtube.com/watch?v=xOrgLj9lOwk" rel="noreferrer">out</a>.</strong></p> <p>I'm also <strong>not interested in a web service.</strong> I want a tool that I can run locally.</p> <p>Finally, solutions need not be restricted to open source, public domain, shareware, free software, commercial, or anything else. <strong>All forms of licensing are acceptable</strong>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload