Skip to content

Commit bc7cce2

Browse files
authored
Merge pull request #480 from numtide/new-README
README: new format
2 parents 3676bd6 + ef9fd92 commit bc7cce2

File tree

3 files changed

+58
-33
lines changed

3 files changed

+58
-33
lines changed

.github/workflows/coverage.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Code Coverage
2+
3+
on: [push]
4+
5+
jobs:
6+
coverage:
7+
runs-on: "ubuntu-20.04"
8+
name: Coverage
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- name: Install Nix
14+
uses: cachix/install-nix-action@v30
15+
with:
16+
extra_nix_config: |
17+
accept-flake-config = true
18+
experimental-features = nix-command flakes
19+
- name: Run coverage
20+
run: nix build .#treefmt.tests.coverage
21+
- name: Upload coverage
22+
uses: coverallsapp/github-action@v2
23+
with:
24+
github-token: ${{ secrets.github_token }}
25+
file: result
26+
format: golang

README.md

+16-31
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
<h1 align="center">
2-
<br>
3-
<img src="docs/content/assets/images/logo.svg" alt="logo" width="200">
4-
<br>
5-
treefmt — one CLI to format your repo
6-
<br>
7-
<br>
8-
</h1>
1+
<div align="center">
92

10-
[![Support room on Matrix](https://img.shields.io/matrix/treefmt:numtide.com.svg?label=%23treefmt%3Anumtide.com&logo=matrix&server_fqdn=matrix.numtide.com)](https://matrix.to/#/#treefmt:numtide.com)
3+
# treefmt
114

12-
**Status: beta**
5+
<img src="docs/content/assets/images/logo.svg" height="150"/>
6+
7+
**One CLI to format your repo**
8+
9+
_A <a href="https://numtide.com/">numtide</a> project._
10+
11+
<p>
12+
<a href='https://coveralls.io/github/numtide/treefmt?branch=new-README'><img src='https://coveralls.io/repos/github/numtide/treefmt/badge.svg?branch=new-README' alt='Coverage Status' /></a>
13+
<a href="https://github.com/numtide/treefmt/actions/workflows/release.yml"><img src="https://github.com/numtide/treefmt/actions/workflows/release.yml/badge.svg"/></a>
14+
<img alt="Static Badge" src="https://img.shields.io/badge/status-beta-yellow">
15+
<a href="https://app.element.io/#/room/#home:numtide.com"><img src="https://img.shields.io/badge/Support-%23numtide-blue"/></a>
16+
</p>
17+
18+
</div>
1319

1420
`treefmt` streamlines the process of applying formatters to your project, making it a breeze with just one command line.
1521

@@ -147,27 +153,6 @@ This project is still pretty new. Down the line we also want to add support for:
147153
All contributions are welcome! We try to keep the project simple and focused. Please refer to the [Contributing](./docs/content/contributing/code.md)
148154
guidelines for more information.
149155

150-
## Moving from Rust To Go
151-
152-
You may be familiar with [Version 1], which is written in [Rust]. So, why re-write it in [Go]?
153-
154-
Ultimately, `treefmt` is spending most of it's time shelling out calls to the underlying formatters. This process is
155-
just as fast/performant in Go as it is in Rust.
156-
157-
The remaining tasks are processing some cli args and parsing a config file. Do we really need something as _heavy duty_
158-
as Rust for that?
159-
160-
Despite all this, you can make good, sane arguments for continuing with [Version 1] in Rust instead of a re-write.
161-
So here's a _bad argument_.
162-
163-
[Brian] wanted to improve performance by moving away from a [Toml] cache file, introduce pipelines for applying multiple
164-
formatters against the same file set, and add an extensible approach for how `treefmt` walks file systems. He knows Go
165-
much better than Rust.
166-
167-
[zimbatm] thought it was a good idea too.
168-
169-
So here we are :shrug:.
170-
171156
## Commercial support
172157

173158
Looking for help or customization?

nix/packages/treefmt/default.nix

+16-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,22 @@ in
6363
git config --global user.name "Treefmt Test"
6464
'';
6565

66-
passthru.tests = {
67-
golangci-lint = perSystem.self.treefmt.overrideAttrs (old: {
66+
passthru.tests = let
67+
inherit (perSystem.self) treefmt;
68+
in {
69+
coverage = lib.optionalAttrs pkgs.stdenv.isx86_64 (treefmt.overrideAttrs (old: {
70+
nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.gcc];
71+
CGO_ENABLED = 1;
72+
buildPhase = ''
73+
HOME=$TMPDIR
74+
go test -race -covermode=atomic -coverprofile=coverage.out -v ./...
75+
'';
76+
installPhase = ''
77+
mv coverage.out $out
78+
'';
79+
}));
80+
81+
golangci-lint = treefmt.overrideAttrs (old: {
6882
nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.golangci-lint];
6983
buildPhase = ''
7084
HOME=$TMPDIR

0 commit comments

Comments
 (0)