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

What's the engine for counting the lines of code of projects? #12

Open
huskier opened this issue Oct 17, 2024 · 4 comments
Open

What's the engine for counting the lines of code of projects? #12

huskier opened this issue Oct 17, 2024 · 4 comments

Comments

@huskier
Copy link
Contributor

huskier commented Oct 17, 2024

I'm very curious which tool or engine is used to count lines of code of projects?

@lsk569937453 lsk569937453 added question Further information is requested and removed question Further information is requested labels Oct 19, 2024
@lsk569937453
Copy link
Owner

I currently use git2-rs to retrieve all commits from the current branch. For each commit, I calculate the line count by subtracting the number of deleted lines from the number of added lines (line count = added - deleted). To get the total line count, I sum these values across all commits.

@huskier
Copy link
Contributor Author

huskier commented Oct 20, 2024

Why do not employ the tokei/sloccount/sloc etc. line counting engines? I think they are more professional at counting lines; meanwhile, they are Language-sensitive。

@lsk569937453
Copy link
Owner

There are two places where the line count is needed:

  • File Tab: This should count the files and lines of code for the current commit in the repository. Using tokei here would be ideal since it provides additional useful metrics.

  • Lines Tab: This will generate a curve showing the line count for every commit over time. I’d prefer to keep this simple and not introduce any additional metrics.

@huskier
Copy link
Contributor Author

huskier commented Oct 21, 2024

  • Lines Tab: This will generate a curve showing the line count for every commit over time. I’d prefer to keep this simple and not introduce any additional metrics.

Thanks. I think that's OK for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants