SonarCloud more lines that project actually has


We added repo for analyzing. Console command 'find . -name '*.*' | xargs wc -l' shows 200k~ lines but when it goes to sonarcloud it shows 800k lines which affect monthly payment a lot, could you shed a light on that? thanks

Welcome to the community!

I’m not sure how you interpreted the output of that command. In particular, if you simply looked at the last line of the output (“X total”), that may not be the grand total. With enough files to find, xargs will make multiple calls to wc -l, and therefore there will be multiple “… total” outputs, all of which would have to be summed.

Try this instead:

find . -type f | xargs wc -l | awk '$2 == "total" {sum += $1} END {print sum}'