You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
We are trying to fetch the lines of code from a bitbucket repository using python and any API available.
Till now we have tried to seek help from the following blog post - https://stiltsoft.com/blog/how-to-count-lines-of-code-in-bitbucket-to-decide-what-sonarqube-license-you-need/ but we are facing errors while establishing the connection.
Is there any method, api, documentation from where we can fetch this data?
Hello @kompal_sithta and thank you for reaching out to the community!
I'm afraid that currently Bitbucket Cloud does not have a built-in feature to track code statistics, like the number of lines of code in a workspace or repository, so we don't currently have an API for that particular operation. We do have an open feature request to implement this functionality, which you can access with the link below :
I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.
While this feature is not available, you have the option to clone the repository locally and use the following git command to get the total number of lines per repository file :
git ls-files | xargs wc -l 50 .gitignore 44 README.md 1 fileA.txt 1 fileB.txt 2 fileD.txt 98 total
Alternatively, you can also check out for available code reviews add-ons in Bitbucket's Marketplace :
Thank you, @kompal_sithta !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.