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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculable fields should be server-side calculated #329

Open
pbrisbin opened this issue Apr 15, 2018 · 1 comment
Open

Calculable fields should be server-side calculated #329

pbrisbin opened this issue Apr 15, 2018 · 1 comment
Assignees

Comments

@pbrisbin
Copy link
Contributor

馃憢 hey CC, how're things!

I'm writing a parser-formatter that takes coverage information about Haskell
tests in its native format and outputs it as the JSON payload expected by
cc-test-reporter.

I'm working against your schema.json, and I'm specifically only including
data marked as required in said schema:

  • Git information:

    • branch
    • commit sha
    • commit timestamp
  • Source files

    • path
    • blob id
    • coverage array

I'm producing valid payloads that are accepted by the reporter, and the line
coverage is accurately displayed on the site:

https://codeclimate.com/github/pbrisbin/hs-shellwords/src/ShellWords.hs/source

Here's my most recent payload:

{
  "git": {
    "branch": "master",
    "committed_at": 1523657633,
    "head": "151184831f27726c5450255726d696f044694bc1"
  },
  "source_files": [
    {
      "name": "src/ShellWords.hs",
      "blob_id": "9a6c61963caa274c5f5d9321600096f53ffc3080",
      "coverage": "[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,null,1,null,null,1,null,null,null,1,1,10,null,null,null,1,1,1,null,null,null,1,1,1,null,null,null,1,1,1,null,null,null,1,null,null,11,null,null,1,null,null,1]"
    }
  ]
}

What's going wrong: coverage for the repository is reported as 0%.

It seems the backend is defaulting the covered_percent values I'm omitting to 0.

What I'd love: calculate omitted calculable fields server-side.

When I saw that things like covered_percent were optional, I assumed (and I
think it's reasonable to assume) that those values would be calculated by
something downstream based on the source_files[].coverage arrays I am
submitting.

The same could be said of other calculable fields like covered_strength and
line_counts, though I can't tell in the UI if those are being defaulted to
"empty" values too.

If this can't happen, or won't happen just yet, I would recommend you update
your schema.json to indicate these fields are required. The system doesn't
really work with such calculated fields defaulted to empty values when
omitted.

What I'd really love is if any calculable fields were removed from the
schema entirely and just always calculated. I think that'd be simpler on your
end as well.

I'll probably just start working on doing the calculations client-side to unblock myself, but I'm interested what you think of my suggestion.

As a workaround, I thought I could write a small converter from the Haskell format into gcov, which is already reportable, but then I ran into #328.

@ale7714
Copy link
Contributor

ale7714 commented Apr 17, 2018

馃憢 @pbrisbin great suggestions, thank you! We are planning to update our server-side process to reduce some of the redundant information that's currently required. But in the meantime, I'll follow up this comment by updating the schema.json file to reduce confusion.

ale7714 pushed a commit that referenced this issue Apr 17, 2018
Follow up on #329
@wfleming wfleming assigned ale7714 and unassigned wfleming Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants