Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow status should indicate the number of files checked #863

Closed
danvk opened this issue Sep 25, 2015 · 1 comment
Closed

flow status should indicate the number of files checked #863

danvk opened this issue Sep 25, 2015 · 1 comment

Comments

@danvk
Copy link
Contributor

danvk commented Sep 25, 2015

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.

@SamChou19815
Copy link
Contributor

You can find it out though flow ls

@SamChou19815 SamChou19815 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants