cljstyle – tool for formatting Clojure code

cljstyle is a configurable code formatting utility for Clojure. It provides tools for checking source files against established formatting rules and automatically correcting inconsistencies.

The program originated as a rewrite of cljfmt, introducing additional formatting capabilities and configuration options. It can reorganise poorly formatted expressions into a more consistent layout, including namespace declarations, function definitions and nested data structures.

cljstyle is designed to integrate into existing development workflows. Developers can inspect formatting differences before applying changes, reformat individual files or work with source code through standard input and output.

The program provides sensible default formatting rules, but these can be customised to suit individual projects. Configuration files can be placed at different levels of a source tree, allowing formatting preferences to be inherited and refined.

This is free and open source software.

Key Features

  • Automatically reformats Clojure source code according to configurable style rules.
  • Corrects indentation, whitespace and the layout of nested expressions.
  • Reformats namespace declarations and organises require and import clauses.
  • Supports configurable rules for formatting different Clojure forms.
  • Provides a check command for identifying formatting errors without changing files.
  • Displays differences between existing source code and proposed formatting changes.
  • Offers a fix command for applying corrections to selected files or project directories.
  • Includes a pipe command for formatting code read from standard input.
  • Provides a find command for identifying files selected for formatting.
  • Includes a config command for inspecting the effective configuration.
  • Supports hierarchical .cljstyle configuration files within source trees.
  • Allows formatting rules, width constraints and indentation behaviour to be customised.
  • Can ignore forms wrapped in comment expressions or preceded by reader discard macros.
  • Supports metadata directives for excluding selected forms from formatting.
  • Provides verbose output for investigating formatting operations.
  • Integrates with shell scripts, code editors, tests and automated development workflows.
  • Cross-platform support – runs on Linux and macOS.

Website: github.com/greglook/cljstyle
Support:
Developer: Greg Look
License: Eclipse Public License v1.0

clystyle commands and options

cljstyle is written in Clojure. Learn Clojure with our recommended free books and free tutorials.


Related Software

Clojure Code Formatters
cljfmtTool for detecting and fixing formatting errors in Clojure code
JokerSmall Clojure interpreter, linter and formatter
zprintReformat Clojure and Clojurescript source code
cljstyleSupports several different commands for checking source files.
Standard Clojure StyleJavaScript implementation of a formatter for Clojure source code

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted