flosse / sloc

simple tool to count SLOC (source lines of code)
MIT License
943 stars 84 forks source link

cannot exclude node_modules and .git (and .meteor etc) #117

Open andrewlorenz opened 4 years ago

andrewlorenz commented 4 years ago

npx sloc --format cli-table --format-option head --exclude "node_modules|.git|.meteor|" .

this fails, moaning about files in .meteor, which I have told it to exclude(!)

As others have said, the information provided as to how this exclusion string is being processed is very vague, and the lack of good, real-world examples really lets it down.

andrewlorenz commented 4 years ago

after a quick test and checking out the source, it looks like this repo first gets a list of ALL files in the given folder structure - initially REGARDLESS of the exclusions - and only then applies the exclude regex. This also accounts for why it takes quite some time to count a small number of source lines when there is also a huge node_modules - it applies the regex to every file in turn ...

Unfortunately unless the code is revamped so that it walks the folder structure and applies the exclude to folder names as it goes, then its not at all suitable for node type project sources (nor those under git control, or with frameworks like meteor around them ..