Skip to content

Commit

Permalink
Merge pull request #340 from numtide/feat/reduce-stats-time-precision
Browse files Browse the repository at this point in the history
Improve summary stats
  • Loading branch information
mergify[bot] authored Jul 5, 2024
2 parents 9bbc49a + e5e1c9d commit be50beb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ func assertStats(t *testing.T, as *require.Assertions, traversed int32, emitted

func assertFormatted(t *testing.T, as *require.Assertions, output []byte, count int) {
t.Helper()
as.Contains(string(output), fmt.Sprintf("formatted %d files", count))
as.Contains(string(output), fmt.Sprintf("(%d changed)", count))
}
2 changes: 0 additions & 2 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ versions.forEach(version => {
sidebar[`/${version}/`] = sidebar["/"].map(({ text, link }) => ({ text, link: `/${version}${link}`}))
})

console.log("sidebar", sidebar)

// https://vitepress.dev/reference/site-config
export default defineVersionedConfig({
base: '/',
Expand Down
10 changes: 4 additions & 6 deletions docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,18 @@ instance, take the caching optimization.

It takes about 23 seconds to traverse a project of 40,559 files and no changes without caching:

```
```console
traversed 41273 files
emitted 41273 files for processing
matched 34311 files to formatters
formatted 14338 files in 23.679339987s
formatted 34111 files (14338 changed) in 23.679s
```

...while it takes **239 milliseconds** to traverse the same project with caching:

```
```console
traversed 41273 files
emitted 0 files for processing
matched 0 files to formatters
formatted 0 files in 239.024064ms
formatted 0 files (0 changed) in 239ms
```

The tool can be invoked manually or integrated into your CI. There's currently no integration with IDEs, but the feature is coming soon.
Expand Down
5 changes: 2 additions & 3 deletions stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ func Print() {
components := []string{
"traversed %d files",
"emitted %d files for processing",
"matched %d files to formatters",
"formatted %d files in %v",
"formatted %d files (%d changed) in %v",
"",
}

Expand All @@ -60,6 +59,6 @@ func Print() {
Value(Emitted),
Value(Matched),
Value(Formatted),
Elapsed(),
Elapsed().Round(time.Millisecond),
)
}

0 comments on commit be50beb

Please sign in to comment.