When developing Clojure(script) software in a team environment, it can be very useful to use a common formatting tool such as zprint. There are two issues in this environment:
1. Decide if you want all files to be formatted identically
2. Ensure that all members of your group use zprint the same way
Classic zprint will do exactly that -- it will reformat every file you give it into what it thinks is the optimal format. Classic zprint is highly (some might say "overly") configurable, and can be configured to reproduce most common Clojure source formatting styles. If you have trouble configuring zprint to do what you want, submit an issue (with an example of what you want), and I'll be glad to help find a way to configure zprint to do what you want.
There are three different ways to get zprint to recognize the existing formatting while still cleaning things up to varying degrees:
{:style :indent-only}
You can use zprint's {:style :indent-only}
to clean up
the indentation and white space in files, without otherwise changing their
basic format.
{:style :respect-bl}
zprint's {:style :respect-bl}
will enforce a particular
format on the file -- with the exception of blank lines, which it will
always keep. For many people, having the blank lines they put in the file
stay there, and having zprint format everything around those blank lines
is a nice mix between enforcing a particular format, and giving people
some latitude to format things "their way".
{:style :respect-nl}
zprint's {:style :respect-nl}
will keep all
of the newlines in the file. zprint will add newlines as necessary
to try to keep things within the width as well as format functions
as they are configured to be formatted. This is a real middle ground
between {:style :indent-only}
and classic zprint.
Whether you are using zprint to enforce a particular format, or simply to clean up the existing format in your team's source files, it is important to have all members of your team using the same zprint configuration.
zprint can read its configuration from several different places:
$HOME/.zprintrc
.zprintrc
file in a projectzprintrc
fileFor personal use, keeping the zprint configuration in $HOME/.zprintrc
is convenient. However, when you want different formatting conventions
for different projects, or when working with other team members,
locating the zprint configuration with the project files can be a
simpler solution.
Look here for information about how to keep zprint configuration information local to a project.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close