mirror of
https://github.com/numtide/treefmt.git
synced 2024-11-25 21:02:04 +03:00
commit
bc7cce244f
26
.github/workflows/coverage.yml
vendored
Normal file
26
.github/workflows/coverage.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: Code Coverage
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
coverage:
|
||||
runs-on: "ubuntu-20.04"
|
||||
name: Coverage
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v30
|
||||
with:
|
||||
extra_nix_config: |
|
||||
accept-flake-config = true
|
||||
experimental-features = nix-command flakes
|
||||
- name: Run coverage
|
||||
run: nix build .#treefmt.tests.coverage
|
||||
- name: Upload coverage
|
||||
uses: coverallsapp/github-action@v2
|
||||
with:
|
||||
github-token: ${{ secrets.github_token }}
|
||||
file: result
|
||||
format: golang
|
47
README.md
47
README.md
@ -1,15 +1,21 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<img src="docs/content/assets/images/logo.svg" alt="logo" width="200">
|
||||
<br>
|
||||
treefmt — one CLI to format your repo
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
<div align="center">
|
||||
|
||||
[![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)
|
||||
# treefmt
|
||||
|
||||
**Status: beta**
|
||||
<img src="docs/content/assets/images/logo.svg" height="150"/>
|
||||
|
||||
**One CLI to format your repo**
|
||||
|
||||
_A <a href="https://numtide.com/">numtide</a> project._
|
||||
|
||||
<p>
|
||||
<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>
|
||||
<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>
|
||||
<img alt="Static Badge" src="https://img.shields.io/badge/status-beta-yellow">
|
||||
<a href="https://app.element.io/#/room/#home:numtide.com"><img src="https://img.shields.io/badge/Support-%23numtide-blue"/></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
`treefmt` streamlines the process of applying formatters to your project, making it a breeze with just one command line.
|
||||
|
||||
@ -147,27 +153,6 @@ This project is still pretty new. Down the line we also want to add support for:
|
||||
All contributions are welcome! We try to keep the project simple and focused. Please refer to the [Contributing](./docs/content/contributing/code.md)
|
||||
guidelines for more information.
|
||||
|
||||
## Moving from Rust To Go
|
||||
|
||||
You may be familiar with [Version 1], which is written in [Rust]. So, why re-write it in [Go]?
|
||||
|
||||
Ultimately, `treefmt` is spending most of it's time shelling out calls to the underlying formatters. This process is
|
||||
just as fast/performant in Go as it is in Rust.
|
||||
|
||||
The remaining tasks are processing some cli args and parsing a config file. Do we really need something as _heavy duty_
|
||||
as Rust for that?
|
||||
|
||||
Despite all this, you can make good, sane arguments for continuing with [Version 1] in Rust instead of a re-write.
|
||||
So here's a _bad argument_.
|
||||
|
||||
[Brian] wanted to improve performance by moving away from a [Toml] cache file, introduce pipelines for applying multiple
|
||||
formatters against the same file set, and add an extensible approach for how `treefmt` walks file systems. He knows Go
|
||||
much better than Rust.
|
||||
|
||||
[zimbatm] thought it was a good idea too.
|
||||
|
||||
So here we are :shrug:.
|
||||
|
||||
## Commercial support
|
||||
|
||||
Looking for help or customization?
|
||||
|
@ -63,8 +63,22 @@ in
|
||||
git config --global user.name "Treefmt Test"
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
golangci-lint = perSystem.self.treefmt.overrideAttrs (old: {
|
||||
passthru.tests = let
|
||||
inherit (perSystem.self) treefmt;
|
||||
in {
|
||||
coverage = lib.optionalAttrs pkgs.stdenv.isx86_64 (treefmt.overrideAttrs (old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.gcc];
|
||||
CGO_ENABLED = 1;
|
||||
buildPhase = ''
|
||||
HOME=$TMPDIR
|
||||
go test -race -covermode=atomic -coverprofile=coverage.out -v ./...
|
||||
'';
|
||||
installPhase = ''
|
||||
mv coverage.out $out
|
||||
'';
|
||||
}));
|
||||
|
||||
golangci-lint = treefmt.overrideAttrs (old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.golangci-lint];
|
||||
buildPhase = ''
|
||||
HOME=$TMPDIR
|
||||
|
Loading…
Reference in New Issue
Block a user