From a64214526e236db738c8f160b26423bfec2d09a1 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 4 Jul 2024 09:45:58 +0100 Subject: [PATCH 1/4] feat: display elapsed time to nearest millisecond Close #337 Signed-off-by: Brian McGee --- stats/stats.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stats/stats.go b/stats/stats.go index d15af95c..b065bc56 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -60,6 +60,6 @@ func Print() { Value(Emitted), Value(Matched), Value(Formatted), - Elapsed(), + Elapsed().Round(time.Millisecond), ) } From da7b0151902cd93f9d56f7553538d228f02da954 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 4 Jul 2024 10:11:51 +0100 Subject: [PATCH 2/4] feat: improve summary stats Close #340 Signed-off-by: Brian McGee --- cli/helpers_test.go | 2 +- stats/stats.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/helpers_test.go b/cli/helpers_test.go index c6fd2406..4779cea3 100644 --- a/cli/helpers_test.go +++ b/cli/helpers_test.go @@ -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)) } diff --git a/stats/stats.go b/stats/stats.go index b065bc56..80f9da37 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -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", "", } From 631cf04fff32d3c413642d6a3c020cbd8df5ce44 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Fri, 5 Jul 2024 16:18:18 +0100 Subject: [PATCH 3/4] chore: remove console.log in vitepress config Signed-off-by: Brian McGee --- docs/.vitepress/config.mts | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 0ce43eaf..752961b9 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -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: '/', From e5e1c9d32635b6f89e16beb8211c17b42b0ae8b3 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Fri, 5 Jul 2024 16:20:35 +0100 Subject: [PATCH 4/4] doc: update summary statistics examples Signed-off-by: Brian McGee --- docs/about.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/about.md b/docs/about.md index e3e97d61..04e4f391 100644 --- a/docs/about.md +++ b/docs/about.md @@ -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.