NixOS/nixfmt

Add line length limit which includes indentation

Open

#288 opened on Mar 2, 2025

View on GitHub
 (1 comment) (5 reactions) (0 assignees)Haskell (1,506 stars) (74 forks)batch import
enhancementgood first issuehelp wanted

Description

Description

The input is 81 columns wide. If I use --width 80, the output is the same as the input. If I incrementally decrease the width by one character, I find the output does eventually get reflowed at --width 76.

I experienced this on 187985fd1408074a352d3be407bd9524417afe57.

Small example input

    sprinkles = if sprinkles == null then import source.sprinkles else sprinkles;

Expected output

I personally prefer this, but I would also accept the output given with --width 76 which is shown later.

    sprinkles = if sprinkles == null
      then import source.sprinkles
      else sprinkles;

Actual output

At 80 columns:

    sprinkles = if sprinkles == null then import source.sprinkles else sprinkles;

At 76 columns:

    sprinkles =
      if sprinkles == null then import source.sprinkles else sprinkles;

Contributor guide

Add line length limit which includes indentation · NixOS/nixfmt#288 | Good First Issue