MIT licensed by fix-whitespace was originally written by Nils Anders Danielsson as part of Agda 2 with contributions from Ulf Norell, Andrés Sicard-Ramírez, Andreas Abel, Philipp Hausmann, Jesper Cockx, Vlad Semenov, Liang-Ting Chen, and Artem Pelenitsyn.
Maintained by Andreas Abel, Liang-Ting Chen
This version can be pinned in stack with:fix-whitespace-0.1@sha256:c466b42367166d3fb9ce3e32f8b68bd4bd3ada06cf88dc5a5348c0c09a5c987c,3052

Module documentation for 0.1

fix-whitespace: Fixes whitespace issues

Hackage version fix-whitespace on Stackage Nightly Stackage LTS version Build status Haskell-CI

This tool can keep your project and repository clean of trailing whitespace and missing terminal newline.

Usage: fix-whitespace [-h|--help] [-v|--verbose] [-V|--version] [--check] [--config CONFIG] [FILES]

The program does the following to files specified in FILES or in the configuration file fix-whitespace.yaml under the current directory (and its subdirectories):

  • Remove trailing whitespace.
  • Remove trailing lines containing nothing but whitespace.
  • Ensure that the file ends in a newline character.
  • Expand tabs to spaces (optionally).

Available options:

  • -h --help

    Show this help information.

  • -v --verbose

    Show files as they are being checked. Since 0.1: Display location of detected whitespace violations.

  • -V --version

    Show program’s version.

  • --config=CONFIG

    Override the project configuration fix-whitespace.yaml.

  • --tab=TABSIZE

    Expand tab characters to TABSIZE (default: 8) many spaces. Keep tabs if 0 is given as TABSIZE. (Option available since 0.0.9.)

  • --check

    With --check the program does not change any files, it just checks if any files would have been changed. In the latter case, it returns with a non-zero exit code.

For an example configuration file see the one of Agda.

Continuous integration

fix-whitespace comfortably integrates into your GitHub CI via the fix-whitespace-action.



Version history.

0.1 Rainy Summer edition released 2023-08-07

  • Flag --verbose now also displays locations of whitespace violations (#7, contributed by Artem Pelenitsyn).
  • Tested with GHC 8.0.2 - 9.8.1-alpha1.

0.0.11 Santa Clause edition released 2022-12-06

  • Delete trailing tabs even when --tab=0 #42
  • Tested with GHC 8.0.2 - 9.4.3.

0.0.10 released 2022-08-21

  • Symlink problem #9 fixed in dependency filepattern-0.1.3.
  • Tested with GHC 8.0.2 - 9.4.1.

0.0.9 released 2022-08-10

  • New option --tab to set tab-size or keep tabs #31.
  • Tested with GHC 8.0.2 - 9.4.1.

0.0.8 released 2022-05-29

  • New option --version displaying program version #33.
  • Skip files that are not UTF8 encoded, rather than crashing #29.
  • Tested with GHC 8.0.2 - 9.2.2 and 9.4.1 alpha.

0.0.7 released 2021-09-07

  • Support GHC 8.10.7.

0.0.6 released 2021-07-29

  • Fix the release version: The tag 0.0.5 on the GitHub repo was released on 14 Oct 2019 while 0.0.5 on Hackage is the commit 1394ec6.
  • Include -Wall and -Wcompact during compilation.
  • Update stack-x.y.z.yaml and add stack-8.10.5.yaml.

0.0.5 released 2021-03-11

  • Initial release.
  • Tested with GHC 8.0.2 - 9.0.1.