Closed mark-davenport-fountain closed 1 year ago
hmm, so @mark-davenport-fountain this isn't well documented as it is mostly for the developers of coverband, but I have also used it for tool integration in the past... There are two JSON endpoints
I think these would cover your use cases... to enable and display links to that data add this to your coverband config:
config.web_debug = true
If these don't have the specific data you are after we could modify or add another endpoint... I am more likely to support an API than some of the recent requests to dump static reports... All of these 'extra' options that folks do a bit more of one off processing has in the past added a lot of maintenance burden and isn't frequently used. Take a look at the current endpoints and let me know if they meet your needs...
Otherwise the code and pattern looks good, so I could cleanup and move all the JSON api endpoints more towards this style, if there is enough interest in using the JSON.
I saw those to endpoints but they didn't meed my needs since they didn't have the data clearly laid out to consume. The enriched_debug_data has it a little closer, but I wanted to have an endpoint that made it clear and simple for how to use the data that is presented in JSON.
For example: I assume the data array has all the information in it, but I'm not sure how to consume it. The web UI has it pretty clearly spelled out so I was looking for something similar to relate to.
"./config/routes.rb": {
"first_updated_at": 1676067851,
"last_updated_at": 1676300488,
"file_hash": "c6975f2631903dd08b43afec8de92306",
"data": [
null,
17,
0,
null,
null,
null,
null,
]
}
},
Runtime relevant lines is easier to understand, and coverage also is her but still not clear how to tell what they mean.
{
"filename": "/Users/mark/fountain/coverband_demo/app/controllers/application_controller.rb",
"runtime_relavant_lines": null,
"coverage": [4, 4, 0, null, null, null, 4, 0, null, null, null],
"last_updated_at": "2023-02-13T09:01:28.000-06:00",
"first_updated_at": "2023-02-10T16:24:36.000-06:00",
"never_loaded": false
},
I could probably use these endpoints if they add some good docs on how to make sense of the responses.
OK, I think we can take your approach, could you resolve the conflict and ensure that it has all the data for your use cases... If so I am good with pulling this in, after it is merged, I will likely move over all the other json endpoints to follow some of these patterns.
@mark-davenport-fountain let me know if you run into any issues.
Sounds good. I 'll get this fixed up shortly. I as out on vacation last week. I'll let you know!
I've got this ready now. @danmayer please take a look, and may want to approve the workflow to run.
@mark-davenport-fountain approved workflow run
Looks like I missed running standardrb on one of my files. I've got that done now. Should be green on the next run. @danmayer
Just a small bump on this @danmayer.
hmm still another standard error
Alright - got that one too. I was running into some trouble with standardrb locally. I'm seeing this same scanning error locally as I'm seeing in CI, but I guess it's not causing any actual problems. Looks like to fix it you'd need to unlock and update standardrb. Should be good to go now anyhow.
merged, thanks I will update the changes and get this in a RC release sometime soon
Than you @danmayer
ok so you can install coverband RC release 5.2.6.rc.4 to test out this functionality let me know if you have any issues @mark-davenport-fountain
I'm proposing adding a JSON route and reporter. This can be used by systems to pull a structured view of the data and then can be easily processed.
I based this off of what was in the html file view.
In my use case I'd like to be able to hit this end point periodically and then store the results to process locally and give feedback during dev about usage of a file that's in production, but having this structured set available for systems to use could be valuable for other use cases as well.
Example output (truncated):