opengrok icon indicating copy to clipboard operation
opengrok copied to clipboard

Lines/LOC REST API

Open ChristopheBordieu opened this issue 4 years ago • 5 comments

Hi,

Since OG 1.7.0, Lines and LOC are available for files and directories at any level starting from repository root (.../xref/PROJECT/repo[/...]).

  • Are these data available from a REST API request targetting any path? I found nothing regarding this in REST API doc (https://opengrok.docs.apiary.io/#). Would it be possible to implement a new request for this?

  • At project level (.../xref/PROJECT), the Lines and LOC are not accumulated and available. Is it something that could be set?

ChristopheBordieu avatar Oct 06 '21 15:10 ChristopheBordieu

The first part is probably a dup of #3047, the second part I noticed myself recently.

vladak avatar Oct 06 '21 16:10 vladak

Indeed, it is.

ChristopheBordieu avatar Oct 06 '21 16:10 ChristopheBordieu

We can also contemplate adding API endpoint just for the purpose of getting the LOC/lines.

vladak avatar Oct 06 '21 18:10 vladak

My users' use case is to know the # of Lines/LOC at repo level and also actually per language types. So, if you provide an API resource providing directly this info at any path, it answers my users' first need. For the language type reporting, no idea if this is something feasible/you have already thought to.

ChristopheBordieu avatar Oct 07 '21 08:10 ChristopheBordieu

The per-language time reporting I don't think this can be done reasonably. Perhaps if there is a API to get the LOC/line numbers one can use the search API and then traverse all the documents that match certain criteria and compute the sum. The search API itself can actually provide the numbers as well since they are stored in the index.

vladak avatar Oct 07 '21 09:10 vladak