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

Coverage Service for Cobertura XML #30

Merged
merged 72 commits into from
Oct 21, 2014
Merged

Coverage Service for Cobertura XML #30

merged 72 commits into from
Oct 21, 2014

Conversation

jkrumow
Copy link
Collaborator

@jkrumow jkrumow commented Oct 12, 2014

Hi marklarr,
as promised here is the pull request for the Cobertura XML coverage service.

It generates a nice xml report conforming to the dtd (see here) including line and branch coverage.

Have a look at it and tell me what you think.

Cheers
tarbrain

Julian Krumow added 30 commits October 5, 2014 16:40
Contains simple parser to bundle the file's lines of code by methods.
TODOs:
- ignore comments inside methods
- skip lines between '/*' and '*/'
Needs refactoring.
…tection algoritm.

Refactored rate calculation.
@jkrumow
Copy link
Collaborator Author

jkrumow commented Oct 16, 2014

Ok. I have made the changes - and added some fixes too.

data.gsub(/^function(.*) called [0-9]+ returned [0-9]+% blocks executed(.*)$/, '')
end

def coverage_for_line(line)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is overriding the super class' implementation necessary here?

@jkrumow
Copy link
Collaborator Author

jkrumow commented Oct 16, 2014

Ok. Merged CoberturaCoverageFile into CoverageFile.
Now there are three ways to get coverage data:

  • gcov_data with the raw line information including branch coverage information (lines which are no valid lines of code)
  • line_coverage_data formerly known as coverage_data where all branch coverage information is stripped out
  • branch_coverage_data which is a hash that groups the hit counts of the branches by the line number of the branch statement:
branch_coverage_data = {
    "15" : [ 0, 5, 2, 0] ,
    "32" : [ ..... ]
}

gcov_data
end
end

def coverage_data
def line_coverage_data
if gcov_data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if cleaned_gcov_data might be better now that we're using that below :)

Julian Krumow added 7 commits October 17, 2014 13:33
Use integer for line_number in branch_coverage_data.
Use cleaned_gcov_data.
Simplified collection operations.
Ruby-ficated implementation of num_branches_testable and num_branches_tested.
Add devision by zero checks.
Extracts line of code with branch statement and all following "branch X taken / never excuted" annotations.
@marklarr
Copy link
Contributor

tarbrain, thanks so much! This is a really good addition and you even learned some Ruby along the way!

marklarr added a commit that referenced this pull request Oct 21, 2014
Coverage Service for Cobertura XML
@marklarr marklarr merged commit 3288ddb into SlatherOrg:master Oct 21, 2014
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

Successfully merging this pull request may close these issues.

4 participants