---
title: "U7001: Non-canonical formatting"
url: https://una-lang.org/en/docs/errors/U7001/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U7001.md
---

# U7001: Non-canonical formatting

A region of a file differs from the file's canonical form. `una check` compares each file with its canonical form and reports U7001 for every region that differs.

## Why Una rejects it

Every Una program has one canonical form (ADR 0011, ADR 0020):

- two spaces per indentation level,
- one line per statement or clause,
- one space around binary operators,
- the short form for a function without clauses whose body is one line,
- constructor arguments in the order their fields are declared,
- sorted imports, and
- exactly one blank line between declarations.

A file with syntax errors is checked for U7001 once they are fixed.

## How to fix it

`una check` reports each region with a mechanical edit that replaces the region. `una fmt` rewrites whole files, and `una fmt --check` reports without writing. The formatter keeps every comment on its line.

## The repair at a glance

```diff
  module demo

- pub double(x: Int) -> Int
- =
-   x * 2
+ pub double(x: Int) -> Int = x * 2
```

## Failing example

```una
module demo

pub double(x: Int) -> Int
=
  x * 2
```

## Fixed example

```una
module demo

pub double(x: Int) -> Int = x * 2
```
