pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

Fix singular and plural in summary

Open hugovk opened this issue 6 months ago • 4 comments
trafficstars

Computers are really bad at some things, but one thing they're really good at is counting :)

So let's replace:

 INFO 0 errors shown, 0 errors ignored, 1 modules, 65 transitive dependencies, 18,208 lines, took 0.10s, peak memory physical 76 MiB

With:

 INFO 0 errors shown, 0 errors ignored, 1 module, 65 transitive dependencies, 18,208 lines, took 0.57s, peak memory physical 89.3 MiB

hugovk avatar May 21 '25 13:05 hugovk

I'm mixed on this overall, I generally prefer these types of outputs to have exact same text and only the numbers differ, because then it's easier to do some find/replace or regex to turn it into a CSV.

These days you could probably feed it to an LLM to extract the numbers, so maybe it's no big deal.

yangdanny97 avatar May 22 '25 21:05 yangdanny97

This is human-readable output, intended for humans to read, not machine-readable JSON or other format. If someone does want to parse these, it's not too difficult either.

By the same token, you may at some point want to change this summary for other reasons, like adding or removing more info. This could also cause problems with parsing the output, but that shouldn't stop you.

Here's a couple of other tools that do human output:

# git
 1 file changed, 1 insertion(+), 2 deletions(-)
...
 55 files changed, 1364 insertions(+), 866 deletions(-)

# mypy
Success: no issues found in 1 source file
...
Success: no issues found in 6 source files

Alternatively, it could be rewritten:

INFO errors shown: 0, errors ignored: 0, modules: 1, transitive dependencies: 65, lines: 18,208, took 0.10s, peak memory physical 76 MiB

hugovk avatar May 23 '25 13:05 hugovk

@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar May 26 '25 03:05 facebook-github-bot

I like the idea of flipping the order - then the benefits @yangdanny97 mentioned are there without the grammatical error. It also keeps the code more concise

stroxler avatar May 26 '25 13:05 stroxler

Thanks, order flipped.

hugovk avatar Jun 02 '25 08:06 hugovk

@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jun 02 '25 15:06 facebook-github-bot

@yangdanny97 merged this pull request in facebook/pyrefly@e6d566be7e2c860872fe757a16edcef26df60ada.

facebook-github-bot avatar Jun 02 '25 18:06 facebook-github-bot

Thanks for your contribution @hugovk :)

yangdanny97 avatar Jun 02 '25 21:06 yangdanny97