Skip to content

Fixed Bug where last file in the lcov parse would not get added to the list. #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ func (l Parser) processLcov() (Report, error) {
}

}
// Add last file
report.Files = append(report.Files, fileReport)
Comment on lines +142 to +143

Choose a reason for hiding this comment

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

While it would be unusual, I suspect it is technically legal to have an lcov file with no files listed. If that is the case this should probably be:

                         if fileReport.Path != "" {
				report.Files = append(report.Files, fileReport)
			}

return report, nil
}

Expand Down
2 changes: 2 additions & 0 deletions coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ func TestLCOV(t *testing.T) {
assert.Equal(t, 1695, report.TotalFunctions)
assert.Equal(t, 2798, report.CoveredLines)
assert.Equal(t, 6395, report.TotalLines)
assert.Equal(t, 182, len(report.Files))

}

func TestCobertura(t *testing.T) {
Expand Down