Skip to content

flow status should indicate the number of files checked #863

@danvk

Description

@danvk

TL;DR: Instead of No errors!, Flow should say something like No errors! (Checked 1,234 files).

I recently noticed that vim-flow was getting borderline annoyingly slow. Whenever I saved, it took ~3 seconds for me to get control of my cursor back.

I could reproduce this on the command line in my project:

$ echo '' >> src/main/GeneTrack.js; time flow status
No errors!
flow status  0.41s user 0.10s system 19% cpu 2.567 total

I had 81 files in my repo and I was using Flow 0.16.0:

$ git ls-files | grep '\.js$' | wc -l
81
$ flow --version
Flow, a static type checker for JavaScript, version 0.16.0

Eventually I discovered the reason that Flow was slow: it was scanning over a ton of irrelevant files in node_modules:

$ flow check --verbose 2> /tmp/flow-all.txt
$ grep -o 'pileup.js/node_modules.*' /tmp/flow-all.txt | perl -pe 's/:.*//; s/[\\]?".*//; s/ .*//' | sort | uniq | wc -l
   11729

I tried adding this to my .flowrc, but it produced many errors:

[ignore]
.*node_modules/.*

I wound up using this command to find the worst offenders:

$ grep -o 'node_modules.*' /tmp/flow-all.txt | perl -pe 's/:.*//; s/[\\]?".*//; s/ .*//' | sort | uniq | perl -pe 's,node_modules/([^/]+)/.*,$1,' | uniq -c | sort -nr
2012 grunt-browserify
1758 watchify
1554 browserify
 919 istanbul
 800 fabric
 593 grunt-contrib-uglify
 541 react-tools
 534 sniper
 307 jstransformify
 268 react

and I blacklisted them in my .flowconfig:

[ignore]
.*node_modules/grunt-browserify.*
.*node_modules/watchify.*
.*node_modules/browserify.*
.*node_modules/fabric.*
...

Now I'm down to a mere 1228 files checked. flow status runs dramatically faster: 0.5s instead of 2.5s.

I suspect there are many Flow users who don't realize that they have a ton of node_modules slowing them down. Adding a less roundabout way to get at the number of file checked would encourage users to deal with this. One way would be to add a file count to the No errors! message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions