avh4 / avh4/elm-format

document --validate

Open
#489 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.3k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

I'm trying to setup automatic PR validation for my org's elm repos using `elm-format` (as well as some other tools).
The problem is that there is no easy way to fail if a format is required.

Currently we have to make it so that the build server sets up a proper git clone of the repo, then run the following bash script:
```BASH
yarn elm-format --yes
if [[ `git status --porcelain` ]]; then
exit 1
fi;
```

(in case you don't know - `git status --porcelain` will print nothing if there are no changes on the repo, or a list of changed files if there are any.)

I'd love it if there was a `--fail-on-format` flag (or similar) that would cause the tool to `process.exit(1)` when it detects that a format must be done on the file.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the `yarn elm-format --yes` invocation described in the issue and inspect how elm-format reports whether formatting changes are needed. The work is done when a documented validation flag causes a nonzero exit status when formatting is required, while the existing formatting behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm, haskell
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.